Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-hatch_vcs for openSUSE:Factory checked in at 2023-11-06 21:13:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hatch_vcs (Old) and /work/SRC/openSUSE:Factory/.python-hatch_vcs.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hatch_vcs" Mon Nov 6 21:13:38 2023 rev:9 rq:1123601 version:0.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hatch_vcs/python-hatch_vcs.changes 2023-05-19 11:56:00.971433000 +0200 +++ /work/SRC/openSUSE:Factory/.python-hatch_vcs.new.17445/python-hatch_vcs.changes 2023-11-06 21:13:42.954022460 +0100 @@ -1,0 +2,12 @@ +Mon Nov 6 06:33:44 UTC 2023 - Johannes Kastl <ka...@b1-systems.de> + +- update to 0.4.0: + * Changed: + - Drop support for Python 3.7 + * Added: + - Officially support Python 3.12 + * Fixed: + - Prevent UserWarning when a template is not defined explicitly +- drop patch setuptools7x-tests.patch that is included upstream + +------------------------------------------------------------------- Old: ---- hatch_vcs-0.3.0.tar.gz setuptools7x-tests.patch New: ---- hatch_vcs-0.4.0.tar.gz BETA DEBUG BEGIN: Old: - Prevent UserWarning when a template is not defined explicitly - drop patch setuptools7x-tests.patch that is included upstream BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hatch_vcs.spec ++++++ --- /var/tmp/diff_new_pack.oxis4U/_old 2023-11-06 21:13:43.714050436 +0100 +++ /var/tmp/diff_new_pack.oxis4U/_new 2023-11-06 21:13:43.714050436 +0100 @@ -26,13 +26,12 @@ %endif %{?sle15_python_module_pythons} Name: python-hatch_vcs%{psuffix} -Version: 0.3.0 +Version: 0.4.0 Release: 0 Summary: Hatch plugin for versioning with your preferred VCS License: MIT URL: https://github.com/ofek/hatch-vcs Source: https://files.pythonhosted.org/packages/source/h/hatch_vcs/hatch_vcs-%{version}.tar.gz -Patch1: https://github.com/ofek/hatch-vcs/commit/47364faf5563df0eaa631ed10383817762c6b547.patch#/setuptools7x-tests.patch BuildRequires: fdupes BuildRequires: python-rpm-macros >= 20210929 # https://github.com/ofek/hatch-vcs/issues/8 ++++++ hatch_vcs-0.3.0.tar.gz -> hatch_vcs-0.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/.github/workflows/test.yml new/hatch_vcs-0.4.0/.github/workflows/test.yml --- old/hatch_vcs-0.3.0/.github/workflows/test.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/.github/workflows/test.yml 2020-02-02 01:00:00.000000000 +0100 @@ -24,7 +24,7 @@ fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/HISTORY.md new/hatch_vcs-0.4.0/HISTORY.md --- old/hatch_vcs-0.3.0/HISTORY.md 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/HISTORY.md 2020-02-02 01:00:00.000000000 +0100 @@ -8,6 +8,20 @@ ## Unreleased +## 0.4.0 - 2023-11-06 + +***Changed:*** + +- Drop support for Python 3.7 + +***Added:*** + +- Officially support Python 3.12 + +***Fixed:*** + +- Prevent `UserWarning` when a template is not defined explicitly + ## 0.3.0 - 2022-12-10 ***Changed:*** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/PKG-INFO new/hatch_vcs-0.4.0/PKG-INFO --- old/hatch_vcs-0.3.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hatch-vcs -Version: 0.3.0 +Version: 0.4.0 Summary: Hatch plugin for versioning with your preferred VCS Project-URL: Funding, https://github.com/sponsors/ofek Project-URL: History, https://github.com/ofek/hatch-vcs/blob/master/HISTORY.md @@ -12,14 +12,14 @@ Keywords: git,hatch,mercurial,plugin,scm,vcs,version Classifier: Development Status :: 4 - Beta Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy -Requires-Python: >=3.7 +Requires-Python: >=3.8 Requires-Dist: hatchling>=1.1.0 Requires-Dist: setuptools-scm>=6.4.0 Description-Content-Type: text/markdown @@ -136,7 +136,7 @@ **Note:** only Git is supported -The [metadata hook plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) name is `vcs`. +The [metadata hook plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) is for inserting VCS data (currently the commit hash) into metadata fields other than `version`. Its name is `vcs`. - ***pyproject.toml*** @@ -158,12 +158,23 @@ - `commit_hash` - the latest commit hash +Be sure to add `urls` to [`project.dynamic`](https://hatch.pypa.io/latest/config/metadata/#dynamic): + +- ***pyproject.toml*** + + ```toml + [project] + dynamic = [ + "urls", + ] + ``` + ### Example - ***pyproject.toml*** ```toml - [tool.hatch.metadata.hooks.vcs] + [tool.hatch.metadata.hooks.vcs.urls] Homepage = "https://www.example.com" source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip" ``` @@ -171,11 +182,42 @@ - ***hatch.toml*** ```toml - [metadata.hooks.vcs] + [metadata.hooks.vcs.urls] Homepage = "https://www.example.com" source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip" ``` +## Migration tips + +If you are migrating from [setuptools](https://setuptools.pypa.io), you may want access to +the version without performing a full build. + +By default, `python -m setuptools_scm` will display the version and perform any side-effects +like writing to a file. `hatch` separates these functions. + +### Display version + +`hatch version` will print the version to the terminal without modifying the source directory. + +```console +$ hatch version +23.0.0.dev17+g462372ba +``` + +### Write version to file + +If `version-file` is defined, you can write it to the source directory with the `build` command, +using the `--hooks-only` flag to modify the source tree but skip creation of sdists or wheels. + +```console +$ hatch build --hooks-only +$ cat package/_version.py +# file generated by setuptools_scm +# don't change, don't track in version control +__version__ = version = '23.0.0.dev17+g462372ba' +__version_tuple__ = version_tuple = (23, 0, 0, 'dev17', 'g462372ba') +``` + ## License `hatch-vcs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/README.md new/hatch_vcs-0.4.0/README.md --- old/hatch_vcs-0.3.0/README.md 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/README.md 2020-02-02 01:00:00.000000000 +0100 @@ -110,7 +110,7 @@ **Note:** only Git is supported -The [metadata hook plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) name is `vcs`. +The [metadata hook plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) is for inserting VCS data (currently the commit hash) into metadata fields other than `version`. Its name is `vcs`. - ***pyproject.toml*** @@ -132,12 +132,23 @@ - `commit_hash` - the latest commit hash +Be sure to add `urls` to [`project.dynamic`](https://hatch.pypa.io/latest/config/metadata/#dynamic): + +- ***pyproject.toml*** + + ```toml + [project] + dynamic = [ + "urls", + ] + ``` + ### Example - ***pyproject.toml*** ```toml - [tool.hatch.metadata.hooks.vcs] + [tool.hatch.metadata.hooks.vcs.urls] Homepage = "https://www.example.com" source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip" ``` @@ -145,11 +156,42 @@ - ***hatch.toml*** ```toml - [metadata.hooks.vcs] + [metadata.hooks.vcs.urls] Homepage = "https://www.example.com" source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip" ``` +## Migration tips + +If you are migrating from [setuptools](https://setuptools.pypa.io), you may want access to +the version without performing a full build. + +By default, `python -m setuptools_scm` will display the version and perform any side-effects +like writing to a file. `hatch` separates these functions. + +### Display version + +`hatch version` will print the version to the terminal without modifying the source directory. + +```console +$ hatch version +23.0.0.dev17+g462372ba +``` + +### Write version to file + +If `version-file` is defined, you can write it to the source directory with the `build` command, +using the `--hooks-only` flag to modify the source tree but skip creation of sdists or wheels. + +```console +$ hatch build --hooks-only +$ cat package/_version.py +# file generated by setuptools_scm +# don't change, don't track in version control +__version__ = version = '23.0.0.dev17+g462372ba' +__version_tuple__ = version_tuple = (23, 0, 0, 'dev17', 'g462372ba') +``` + ## License `hatch-vcs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/hatch_vcs/__about__.py new/hatch_vcs-0.4.0/hatch_vcs/__about__.py --- old/hatch_vcs-0.3.0/hatch_vcs/__about__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/hatch_vcs/__about__.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev> # # SPDX-License-Identifier: MIT -__version__ = '0.3.0' +__version__ = '0.4.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/hatch_vcs/build_hook.py new/hatch_vcs-0.4.0/hatch_vcs/build_hook.py --- old/hatch_vcs-0.3.0/hatch_vcs/build_hook.py 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/hatch_vcs/build_hook.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,45 +1,37 @@ # SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev> # # SPDX-License-Identifier: MIT +from functools import cached_property + from hatchling.builders.hooks.plugin.interface import BuildHookInterface class VCSBuildHook(BuildHookInterface): PLUGIN_NAME = 'vcs' - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.__config_version_file = None - self.__config_template = None - - @property + @cached_property def config_version_file(self): - if self.__config_version_file is None: - version_file = self.config.get('version-file', '') - if not isinstance(version_file, str): - raise TypeError('Option `version-file` for build hook `{}` must be a string'.format(self.PLUGIN_NAME)) - elif not version_file: - raise ValueError('Option `version-file` for build hook `{}` is required'.format(self.PLUGIN_NAME)) + version_file = self.config.get('version-file') + if not version_file: + raise ValueError(f'Option `version-file` for build hook `{self.PLUGIN_NAME}` is required') + elif not isinstance(version_file, str): + raise TypeError(f'Option `version-file` for build hook `{self.PLUGIN_NAME}` must be a string') - self.__config_version_file = version_file + return version_file - return self.__config_version_file - - @property + @cached_property def config_template(self): - if self.__config_template is None: - template = self.config.get('template', '') - if not isinstance(template, str): - raise TypeError('Option `template` for build hook `{}` must be a string'.format(self.PLUGIN_NAME)) - - self.__config_template = template - - return self.__config_template + template = self.config.get('template') + if template is not None and not isinstance(template, str): + raise TypeError(f'Option `template` for build hook `{self.PLUGIN_NAME}` must be a string') + return template def initialize(self, version, build_data): from setuptools_scm import dump_version - dump_version(self.root, self.metadata.version, self.config_version_file, template=self.config_template) + kwargs = {} + if self.config_template: + kwargs['template'] = self.config_template + dump_version(self.root, self.metadata.version, self.config_version_file, **kwargs) - build_data['artifacts'].append('/{}'.format(self.config_version_file)) + build_data['artifacts'].append(f'/{self.config_version_file}') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/pyproject.toml new/hatch_vcs-0.4.0/pyproject.toml --- old/hatch_vcs-0.3.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -8,7 +8,7 @@ description = 'Hatch plugin for versioning with your preferred VCS' readme = "README.md" license = { text = "MIT" } -requires-python = ">= 3.7" +requires-python = ">= 3.8" keywords = [ "git", "hatch", @@ -24,11 +24,11 @@ classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] @@ -50,12 +50,12 @@ path = "hatch_vcs/__about__.py" [tool.black] -target-version = ["py37"] +target-version = ["py38"] line-length = 120 skip-string-normalization = true [tool.ruff] -target-version = "py37" +target-version = "py38" line-length = 120 select = [ "A", @@ -83,10 +83,10 @@ "FBT003", # Ignore checks for possible passwords "S105", "S106", "S107", -] -unfixable = [ - # Don't touch unused imports - "F401", + # Ignore noisy checks for insecure subprocess calls + "S603", "S607", + # Boolean default values + "FBT002", ] [tool.ruff.isort] @@ -100,7 +100,7 @@ [tool.ruff.per-file-ignores] # Tests can use relative imports and assertions -"tests/**/*" = ["I252", "S101"] +"tests/**/*" = ["TID252", "S101"] [tool.mypy] disallow_untyped_defs = false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/tests/conftest.py new/hatch_vcs-0.4.0/tests/conftest.py --- old/hatch_vcs-0.3.0/tests/conftest.py 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/tests/conftest.py 2020-02-02 01:00:00.000000000 +0100 @@ -3,10 +3,29 @@ # SPDX-License-Identifier: MIT import errno import os -import shutil import stat import tempfile from contextlib import contextmanager +from functools import wraps +from sys import version_info + +if version_info[:2] >= (3, 12): + from shutil import rmtree +else: + from shutil import rmtree as _rmtree + + # Backport the onexc keyword argument from Python 3.12 + @wraps(_rmtree) + def rmtree(path, ignore_errors=False, onerror=None, *args, **kwds): + if 'onexc' in kwds: + kwds = dict(kwds) + onexc = kwds.pop('onexc') + + def onerror(func, path, exc): + return onexc(func, path, exc[1]) + + return _rmtree(path, ignore_errors, onerror, *args, **kwds) + import pytest @@ -15,8 +34,8 @@ def handle_remove_readonly(func, path, exc): # no cov # PermissionError: [WinError 5] Access is denied: '...\\.git\\...' - if func in (os.rmdir, os.remove, os.unlink) and exc[1].errno == errno.EACCES: - os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + if func in (os.rmdir, os.remove, os.unlink) and exc.errno == errno.EACCES: + os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # noqa: S103 func(path) else: raise @@ -29,7 +48,7 @@ directory = os.path.realpath(directory) yield directory finally: - shutil.rmtree(directory, ignore_errors=False, onerror=handle_remove_readonly) + rmtree(directory, ignore_errors=False, onexc=handle_remove_readonly) @contextmanager diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hatch_vcs-0.3.0/tests/test_build.py new/hatch_vcs-0.4.0/tests/test_build.py --- old/hatch_vcs-0.3.0/tests/test_build.py 2020-02-02 01:00:00.000000000 +0100 +++ new/hatch_vcs-0.4.0/tests/test_build.py 2020-02-02 01:00:00.000000000 +0100 @@ -75,8 +75,10 @@ assert os.path.isfile(version_file) lines = read_file(version_file).splitlines() - assert lines[3].startswith(('version =', '__version__ =')) - assert lines[3].endswith("version = '1.2.3'") + version_starts = ('version = ', '__version__ = ') + assert any(line.startswith(version_starts) for line in lines) + version_line = next(line for line in lines if line.startswith(version_starts)) + assert " = '1.2.3'" in version_line @pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only')