Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-versioningit for
openSUSE:Factory checked in at 2025-10-12 22:24:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-versioningit (Old)
and /work/SRC/openSUSE:Factory/.python-versioningit.new.18484 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-versioningit"
Sun Oct 12 22:24:02 2025 rev:10 rq:1310795 version:3.3.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-versioningit/python-versioningit.changes
2025-07-06 16:59:34.686248738 +0200
+++
/work/SRC/openSUSE:Factory/.python-versioningit.new.18484/python-versioningit.changes
2025-10-12 22:29:00.041370729 +0200
@@ -1,0 +2,8 @@
+Sun Oct 5 00:53:26 UTC 2025 - Tejas Guruswamy <[email protected]>
+
+- update to 3.3.0:
+ * Added {normalized_version} to the fields available to the write and
onbuild steps
+ * Support reading configuration from a versioningit.toml file instead of
pyproject.toml (contributed by @b-sturgeon)
+ * Added NoConfigFileError and NoConfigSectionError subclasses of
NotVersioningitError
+
+-------------------------------------------------------------------
Old:
----
versioningit-3.1.2.tar.gz
New:
----
versioningit-3.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-versioningit.spec ++++++
--- /var/tmp/diff_new_pack.cw9R9F/_old 2025-10-12 22:29:01.473430690 +0200
+++ /var/tmp/diff_new_pack.cw9R9F/_new 2025-10-12 22:29:01.501431863 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-versioningit
#
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -23,7 +23,7 @@
%endif
%{?sle15_python_module_pythons}
Name: python-versioningit
-Version: 3.1.2
+Version: 3.3.0
Release: 0
Summary: Versioning It with your Version In Git
License: MIT
@@ -32,7 +32,12 @@
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
+BuildRequires: fdupes
BuildRequires: python-rpm-macros
+Requires: python-packaging
+Requires: python-tomli >= 1.2
+Suggests: python-dataclasses
+BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module build}
BuildRequires: %{python_module importlib-metadata if %python-base < 3.10}
@@ -45,21 +50,16 @@
BuildRequires: %{python_module wheel}
BuildRequires: git-core
# /SECTION
-BuildRequires: fdupes
-Requires: python-packaging
-Requires: python-tomli >= 1.2
%if %{?python_version_nodots} < 310
Requires: python-importlib-metadata >= 3.6
%endif
-Suggests: python-dataclasses
%if %{with libalternatives}
-Requires: alts
BuildRequires: alts
+Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
-BuildArch: noarch
%python_subpackages
%description
@@ -80,7 +80,7 @@
%python_clone -a %{buildroot}%{_bindir}/versioningit
%check
-%pytest test -k 'not test_editable_mode or not test_end2end'
+%pytest test -k 'not test_editable_mode and not test_install_from'
%pre
%python_libalternatives_reset_alternative versioningit
++++++ versioningit-3.1.2.tar.gz -> versioningit-3.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/CHANGELOG.md
new/versioningit-3.3.0/CHANGELOG.md
--- old/versioningit-3.1.2/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100
@@ -1,3 +1,21 @@
+v3.3.0 (2025-06-27)
+-------------------
+- Added `{normalized_version}` to the fields available to the `write` and
+ `onbuild` steps
+
+v3.2.0 (2025-06-10)
+-------------------
+- Support reading configuration from a `versioningit.toml` file instead of
+ `pyproject.toml` (contributed by
+ [@b-sturgeon](https://github.com/b-sturgeon))
+- Added `NoConfigFileError` and `NoConfigSectionError` subclasses of
+ `NotVersioningitError`
+
+v3.1.3 (2025-05-12)
+-------------------
+- Support Python 3.13
+- **Bugfix**: Don't crash when `log.showSignature` is set in `.gitconfig`
+
v3.1.2 (2024-07-20)
-------------------
- Drop support for Python 3.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/LICENSE
new/versioningit-3.3.0/LICENSE
--- old/versioningit-3.1.2/LICENSE 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/LICENSE 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2021-2024 John Thorvald Wodder II and contributors
+Copyright (c) 2021-2025 John Thorvald Wodder II and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/PKG-INFO
new/versioningit-3.3.0/PKG-INFO
--- old/versioningit-3.1.2/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 2.3
+Metadata-Version: 2.4
Name: versioningit
-Version: 3.1.2
+Version: 3.3.0
Summary: Versioning It with your Version In Git
Project-URL: Source Code, https://github.com/jwodder/versioningit
Project-URL: Bug Tracker, https://github.com/jwodder/versioningit/issues
@@ -13,7 +13,6 @@
Classifier: Framework :: Hatch
Classifier: Framework :: Setuptools Plugin
Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
@@ -21,6 +20,7 @@
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Build Tools
@@ -79,7 +79,8 @@
.. _hatch: https://hatch.pypa.io
-- Installed & configured through :pep:`518`'s ``pyproject.toml``
+- Installed & configured through :pep:`518`'s ``pyproject.toml`` (or,
+ alternatively, through ``versioningit.toml`` for non-Python projects)
- Supports Git, modern Git archives, and Mercurial
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/README.rst
new/versioningit-3.3.0/README.rst
--- old/versioningit-3.1.2/README.rst 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/README.rst 2020-02-02 01:00:00.000000000 +0100
@@ -43,7 +43,8 @@
.. _hatch: https://hatch.pypa.io
-- Installed & configured through :pep:`518`'s ``pyproject.toml``
+- Installed & configured through :pep:`518`'s ``pyproject.toml`` (or,
+ alternatively, through ``versioningit.toml`` for non-Python projects)
- Supports Git, modern Git archives, and Mercurial
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/api.rst
new/versioningit-3.3.0/docs/api.rst
--- old/versioningit-3.1.2/docs/api.rst 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/docs/api.rst 2020-02-02 01:00:00.000000000 +0100
@@ -75,6 +75,10 @@
:show-inheritance:
.. autoexception:: NotVersioningitError
:show-inheritance:
+.. autoexception:: NoConfigFileError
+ :show-inheritance:
+.. autoexception:: NoConfigSectionError
+ :show-inheritance:
Utilities
---------
@@ -92,10 +96,10 @@
------------------------------
The functions & methods that take a path to a project directory normally read
-the project's configuration from the :file:`pyproject.toml` file therein, but
-they can also be passed a ``config`` argument to take the configuration from
-instead, in which case :file:`pyproject.toml` will be ignored and need not even
-exist.
+the project's configuration from the :file:`versioningit.toml` or
+:file:`pyproject.toml` file therein, but they can also be passed a ``config``
+argument to take the configuration from instead, in which case any
+configuration files will be ignored and need not even exist.
A ``config`` argument must be a `dict` whose structure mirrors the structure of
the ``[tool.versioningit]`` table in :file:`pyproject.toml`. For example, the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/changelog.rst
new/versioningit-3.3.0/docs/changelog.rst
--- old/versioningit-3.1.2/docs/changelog.rst 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/docs/changelog.rst 2020-02-02 01:00:00.000000000
+0100
@@ -3,6 +3,28 @@
Changelog
=========
+v3.3.0 (2025-06-27)
+-------------------
+- Added ``{normalized_version}`` to the fields available to the ``write`` and
+ ``onbuild`` steps
+
+
+v3.2.0 (2025-06-10)
+-------------------
+- Support reading configuration from a :file:`versioningit.toml` file instead
+ of :file:`pyproject.toml` (contributed by `@b-sturgeon
+ <https://github.com/b-sturgeon>`_)
+- Added `NoConfigFileError` and `NoConfigSectionError` subclasses of
+ `NotVersioningitError`
+
+
+v3.1.3 (2025-05-12)
+-------------------
+- Support Python 3.13
+- **Bugfix**: Don't crash when ``log.showSignature`` is set in
+ :file:`.gitconfig`
+
+
v3.1.2 (2024-07-20)
-------------------
- Drop support for Python 3.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/conf.py
new/versioningit-3.3.0/docs/conf.py
--- old/versioningit-3.1.2/docs/conf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/docs/conf.py 2020-02-02 01:00:00.000000000 +0100
@@ -2,7 +2,7 @@
project = "versioningit"
author = "John Thorvald Wodder II"
-copyright = "2021-2024 John Thorvald Wodder II" # noqa: A001
+copyright = "2021-2025 John Thorvald Wodder II" # noqa: A001
extensions = [
"sphinx.ext.autodoc",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/configuration.rst
new/versioningit-3.3.0/docs/configuration.rst
--- old/versioningit-3.1.2/docs/configuration.rst 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/docs/configuration.rst 2020-02-02
01:00:00.000000000 +0100
@@ -13,6 +13,19 @@
will be passed as parameters to the method when it's called. If the ``method``
key is omitted, the default method for the step is used.
+If you'd like to use ``versioningit`` for non-Python projects but don't want a
+misleading :file:`pyproject.toml` in the project's directory, you can place the
+configuration into a :file:`versioningit.toml` file instead. If a project
+contains both configuration files, ``versioningit`` will use the
+:file:`versioningit.toml` file.
+
+Any mentions of just :file:`pyproject.toml` in this documentation should be
+understood to apply to :file:`versioningit.toml` as well.
+
+.. versionadded:: 3.2.0
+
+ Support for :file:`versioningit.toml`
+
.. _specifying-method:
Specifying the Method
@@ -382,6 +395,10 @@
.. versionadded:: 2.0.0
+.. versionadded:: 3.3.0
+
+ The ``{normalized_version}`` field
+
The ``template-fields`` subtable controls the fields available for the
templates of the ``write`` and ``onbuild`` steps. ``versioningit`` provides
one ``template-fields`` method, ``"basic"`` (the default), which provides the
@@ -389,6 +406,9 @@
- ``{version}`` — the project's final version
+- ``{normalized_version}`` — the project's final version, normalized as per
+ :pep:`440`; if the version string cannot be normalized, it is left as-is
+
- ``{version_tuple}`` — a string representation of a tuple of ``{version}``'s
components; see below for how to configure how the version is split up
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/how.rst
new/versioningit-3.3.0/docs/how.rst
--- old/versioningit-3.1.2/docs/how.rst 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/docs/how.rst 2020-02-02 01:00:00.000000000 +0100
@@ -43,16 +43,17 @@
``versioningit`` registers plugins with both setuptools and Hatch that cause it
to be run whenever one of those backends computes the metadata for a project in
an environment in which ``versioningit`` is installed. If the project in
-question has a :file:`pyproject.toml` file with a ``[tool.versioningit]`` table
-(or, for Hatch only, a ``[tool.hatch.version]`` table containing more than just
-a ``source`` key), then ``versioningit`` performs the version calculations
-described above and sets the project's version to the final value. (If a
-version cannot be determined because the project is not in a repository or
-repository archive, then ``versioningit`` will assume the project is an
-unpacked sdist and will look for a :file:`PKG-INFO` file to fetch the version
-from instead.) If the configuration table contains a ``write`` subtable, then
-the ``write`` step will also be run at this time; the default ``write`` method
-creates a file at a specified path containing the project's version.
+question has a :file:`versioningit.toml` or :file:`pyproject.toml` file with a
+``[tool.versioningit]`` table (or, for Hatch only, a ``[tool.hatch.version]``
+table containing more than just a ``source`` key), then ``versioningit``
+performs the version calculations described above and sets the project's
+version to the final value. (If a version cannot be determined because the
+project is not in a repository or repository archive, then ``versioningit``
+will assume the project is an unpacked sdist and will look for a
+:file:`PKG-INFO` file to fetch the version from instead.) If the configuration
+table contains a ``write`` subtable, then the ``write`` step will also be run
+at this time; the default ``write`` method creates a file at a specified path
+containing the project's version.
``onbuild`` Step
^^^^^^^^^^^^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/index.rst
new/versioningit-3.3.0/docs/index.rst
--- old/versioningit-3.1.2/docs/index.rst 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/docs/index.rst 2020-02-02 01:00:00.000000000
+0100
@@ -35,7 +35,8 @@
.. _hatch: https://hatch.pypa.io
-- Installed & configured through :pep:`518`'s :file:`pyproject.toml`
+- Installed & configured through :pep:`518`'s :file:`pyproject.toml` (or,
+ alternatively, through :file:`versioningit.toml` for non-Python projects)
- Supports Git, modern Git archives, and Mercurial
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/notes.rst
new/versioningit-3.3.0/docs/notes.rst
--- old/versioningit-3.1.2/docs/notes.rst 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/docs/notes.rst 2020-02-02 01:00:00.000000000
+0100
@@ -38,12 +38,12 @@
``versioningit`` follows `Semantic Versioning`_, in which the major version
component is incremented whenever a breaking change is made. Moreover, the
-basic ``pyproject.toml`` interface to ``versioningit`` can be considered very
-stable; the only changes to expect to it will be the addition of new features
-and the occasional patching over of corner-case bugs. Nearly all breaking
-changes will be to the library or custom method API; if you've written any code
-that uses this part of the API, you are advised to declare the next major
-version of ``versioningit`` as an upper bound on your ``versioningit``
+basic :file:`pyproject.toml` interface to ``versioningit`` can be considered
+very stable; the only changes to expect to it will be the addition of new
+features and the occasional patching over of corner-case bugs. Nearly all
+breaking changes will be to the library or custom method API; if you've written
+any code that uses this part of the API, you are advised to declare the next
+major version of ``versioningit`` as an upper bound on your ``versioningit``
dependency.
.. _Semantic Versioning: https://semver.org
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/docs/requirements.txt
new/versioningit-3.3.0/docs/requirements.txt
--- old/versioningit-3.1.2/docs/requirements.txt 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/docs/requirements.txt 2020-02-02
01:00:00.000000000 +0100
@@ -1,4 +1,4 @@
-Sphinx~=7.0
+Sphinx~=8.0
sphinx-copybutton~=0.5.0
sphinx-inline-tabs
-sphinx_rtd_theme~=2.0
+sphinx_rtd_theme~=3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/pyproject.toml
new/versioningit-3.3.0/pyproject.toml
--- old/versioningit-3.1.2/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/pyproject.toml 2020-02-02 01:00:00.000000000
+0100
@@ -9,7 +9,7 @@
readme = "README.rst"
requires-python = ">=3.8"
license = "MIT"
-license-files = { paths = ["LICENSE"] }
+license-files = ["LICENSE"]
authors = [
{ name = "John Thorvald Wodder II", email = "[email protected]" }
]
@@ -31,9 +31,9 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
- "License :: OSI Approved :: MIT License",
"Framework :: Hatch",
"Framework :: Setuptools Plugin",
"Intended Audience :: Developers",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/__init__.py
new/versioningit-3.3.0/src/versioningit/__init__.py
--- old/versioningit-3.1.2/src/versioningit/__init__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/__init__.py 2020-02-02
01:00:00.000000000 +0100
@@ -13,7 +13,8 @@
.. _hatch: https://hatch.pypa.io
-- Installed & configured through :pep:`518`'s ``pyproject.toml``
+- Installed & configured through :pep:`518`'s ``pyproject.toml`` (or,
+ alternatively, through ``versioningit.toml`` for non-Python projects)
- Supports Git, modern Git archives, and Mercurial
@@ -43,7 +44,7 @@
<https://versioningit.rtfd.io> for more information.
"""
-__version__ = "3.1.2"
+__version__ = "3.3.0"
__author__ = "John Thorvald Wodder II"
__author_email__ = "[email protected]"
__license__ = "MIT"
@@ -66,6 +67,8 @@
InvalidTagError,
InvalidVersionError,
MethodError,
+ NoConfigFileError,
+ NoConfigSectionError,
NoTagError,
NotSdistError,
NotVCSError,
@@ -81,6 +84,8 @@
"InvalidTagError",
"InvalidVersionError",
"MethodError",
+ "NoConfigFileError",
+ "NoConfigSectionError",
"NoTagError",
"NotSdistError",
"NotVCSError",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/basics.py
new/versioningit-3.3.0/src/versioningit/basics.py
--- old/versioningit-3.1.2/src/versioningit/basics.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/basics.py 2020-02-02
01:00:00.000000000 +0100
@@ -3,6 +3,7 @@
from pathlib import Path
import re
from typing import Any, Optional
+from packaging.version import Version
from .core import VCSDescription
from .errors import ConfigError, InvalidTagError
from .logging import log, warn_extra_fields
@@ -194,4 +195,8 @@
fields["next_version"] = next_version
fields["version"] = version
fields["version_tuple"] = version_tuple
+ try:
+ fields["normalized_version"] = str(Version(version))
+ except ValueError:
+ fields["normalized_version"] = version
return fields
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/config.py
new/versioningit-3.3.0/src/versioningit/config.py
--- old/versioningit-3.1.2/src/versioningit/config.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/config.py 2020-02-02
01:00:00.000000000 +0100
@@ -3,7 +3,7 @@
from pathlib import Path
import sys
from typing import Any, Optional
-from .errors import ConfigError, NotVersioningitError
+from .errors import ConfigError, NoConfigSectionError
from .logging import log, warn_extra_fields
from .methods import (
CallableSpec,
@@ -79,7 +79,7 @@
``[tool.hatch.version]`` table has more than just a ``source`` key,
then a warning is emitted and the latter table is used.
- :raises NotVersioningitError:
+ :raises NoConfigSectionError:
if the file does not contain a versioningit configuration table
:raises ConfigError:
if the configuration table or any of its subfields are not of the
@@ -115,7 +115,7 @@
" [tool.hatch.build.hooks.versioningit-onbuild]."
)
if table is None:
- raise NotVersioningitError("versioningit not enabled in
pyproject.toml")
+ raise NoConfigSectionError(config_path=Path(filepath))
return cls.parse_obj(table)
@classmethod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/core.py
new/versioningit-3.3.0/src/versioningit/core.py
--- old/versioningit-3.1.2/src/versioningit/core.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/core.py 2020-02-02
01:00:00.000000000 +0100
@@ -4,7 +4,7 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
from .config import Config
-from .errors import Error, MethodError, NotSdistError, NotVCSError,
NotVersioningitError
+from .errors import Error, MethodError, NoConfigFileError, NotSdistError,
NotVCSError
from .logging import log, warn_bad_version
from .methods import VersioningitMethod
from .onbuild import OnbuildFileProvider, SetuptoolsFileProvider
@@ -148,27 +148,39 @@
``project_dir`` (default: the current directory).
If ``config`` is `None`, then ``project_dir`` must contain a
- :file:`pyproject.toml` file containing either a ``[tool.versioningit]``
- table or a ``[tool.hatch.version]`` table with the ``source`` key set
- to ``"versioningit"``; if it does not, a `NotVersioningitError` is
- raised. If ``config`` is not `None`, then any :file:`pyproject.toml`
- file in ``project_dir`` will be ignored, and the configuration will be
- taken from ``config`` instead. See ":ref:`config_dict`".
-
- :raises NotVersioningitError:
- - if ``config`` is `None` and ``project_dir`` does not contain a
- :file:`pyproject.toml` file
- - if ``config`` is `None` and the :file:`pyproject.toml` file does
- not contain a versioningit configuration table
+ :file:`versioningit.toml` or :file:`pyproject.toml` file; if both files
+ are present, the :file:`versioningit.toml` file is used. This file
+ must then contain either a ``[tool.versioningit]`` table or a
+ ``[tool.hatch.version]`` table with the ``source`` key set to
+ ``"versioningit"``; if it does not, a `NoConfigSectionError` is raised.
+ If ``config`` is not `None`, then any configuration files in
+ ``project_dir`` will be ignored, and the configuration will be taken
+ from ``config`` instead. See ":ref:`config_dict`".
+
+ .. versionchanged:: 3.2.0
+
+ A :file:`versioningit.toml` file can now be read in place of
+ :file:`pyproject.toml`
+
+ :raises NoConfigFileError:
+ if ``config`` is `None` and ``project_dir`` does not contain a
+ :file:`pyproject.toml` or :file:`versioningit.toml` file
+ :raises NoConfigSectionError:
+ if ``config`` is `None` and the configuration file does not contain
+ a versioningit configuration table
:raises ConfigError:
if the configuration object/table or any of its subfields are not
of the correct type
"""
if config is None:
+ pdir = Path(project_dir)
try:
- cfg = Config.parse_toml_file(Path(project_dir,
"pyproject.toml"))
+ path = pdir / "versioningit.toml"
+ if not path.is_file():
+ path = pdir / "pyproject.toml"
+ cfg = Config.parse_toml_file(path)
except FileNotFoundError:
- raise NotVersioningitError(f"No pyproject.toml file in
{project_dir}")
+ raise NoConfigFileError(project_dir=pdir)
else:
cfg = Config.parse_obj(config)
return cls.from_config(project_dir, cfg)
@@ -464,12 +476,14 @@
Determine the version for the project at ``project_dir``.
If ``config`` is `None`, then ``project_dir`` must contain a
- :file:`pyproject.toml` file containing either a ``[tool.versioningit]``
- table or a ``[tool.hatch.version]`` table with the ``source`` key set to
- ``"versioningit"``; if it does not, a `NotVersioningitError` is raised. If
- ``config`` is not `None`, then any :file:`pyproject.toml` file in
- ``project_dir`` will be ignored, and the configuration will be taken from
- ``config`` instead. See ":ref:`config_dict`".
+ :file:`versioningit.toml` or :file:`pyproject.toml` file; if both files are
+ present, the :file:`versioningit.toml` file is used. This file must then
+ contain either a ``[tool.versioningit]`` table or a
+ ``[tool.hatch.version]`` table with the ``source`` key set to
+ ``"versioningit"``; if it does not, a `NoConfigSectionError` is raised. If
+ ``config`` is not `None`, then any configuration files in ``project_dir``
+ will be ignored, and the configuration will be taken from ``config``
+ instead. See ":ref:`config_dict`".
If ``write`` is true, then the file specified in the ``write`` subtable of
the versioningit configuration, if any, will be updated.
@@ -479,17 +493,23 @@
assume that the directory is an unpacked sdist and will read the version
from the :file:`PKG-INFO` file.
+ .. versionchanged:: 3.2.0
+
+ A :file:`versioningit.toml` file can now be read in place of
+ :file:`pyproject.toml`
+
:raises NotVCSError:
if ``fallback`` is false and ``project_dir`` is not under version
control
:raises NotSdistError:
if ``fallback`` is true, ``project_dir`` is not under version control,
and there is no :file:`PKG-INFO` file in ``project_dir``
- :raises NotVersioningitError:
- - if ``config`` is `None` and ``project_dir`` does not contain a
- :file:`pyproject.toml` file
- - if ``config`` is `None` and the :file:`pyproject.toml` file does not
- contain a versioningit configuration table
+ :raises NoConfigFileError:
+ if ``config`` is `None` and ``project_dir`` does not contain a
+ :file:`pyproject.toml` or :file:`versioningit.toml` file
+ :raises NoConfigSectionError:
+ if ``config`` is `None` and the configuration file does not contain a
+ versioningit configuration table
:raises ConfigError:
if any of the values in ``config`` are not of the correct type
:raises MethodError: if a method returns a value of the wrong type
@@ -508,20 +528,28 @@
``project_dir``.
If ``config`` is `None`, then ``project_dir`` must contain a
- :file:`pyproject.toml` file containing either a ``[tool.versioningit]``
- table or a ``[tool.hatch.version]`` table with the ``source`` key set to
- ``"versioningit"``; if it does not, a `NotVersioningitError` is raised. If
- ``config`` is not `None`, then any :file:`pyproject.toml` file in
- ``project_dir`` will be ignored, and the configuration will be taken from
- ``config`` instead. See ":ref:`config_dict`".
+ :file:`versioningit.toml` or :file:`pyproject.toml` file; if both files are
+ present, the :file:`versioningit.toml` file is used. This file must then
+ contain either a ``[tool.versioningit]`` table or a
+ ``[tool.hatch.version]`` table with the ``source`` key set to
+ ``"versioningit"``; if it does not, a `NoConfigSectionError` is raised. If
+ ``config`` is not `None`, then any configuration files in ``project_dir``
+ will be ignored, and the configuration will be taken from ``config``
+ instead. See ":ref:`config_dict`".
+
+ .. versionchanged:: 3.2.0
+
+ A :file:`versioningit.toml` file can now be read in place of
+ :file:`pyproject.toml`
:raises NotVCSError:
if ``project_dir`` is not under version control
- :raises NotVersioningitError:
- - if ``config`` is `None` and ``project_dir`` does not contain a
- :file:`pyproject.toml` file
- - if ``config`` is `None` and the :file:`pyproject.toml` file does not
- contain a versioningit configuration table
+ :raises NoConfigFileError:
+ if ``config`` is `None` and ``project_dir`` does not contain a
+ :file:`pyproject.toml` or :file:`versioningit.toml` file
+ :raises NoConfigSectionError:
+ if ``config`` is `None` and the configuration file does not contain a
+ versioningit configuration table
:raises ConfigError:
if any of the values in ``config`` are not of the correct type
:raises MethodError: if a method returns a value of the wrong type
@@ -572,27 +600,36 @@
are building from an sdist, and `run_onbuild()` should not be called.
If ``config`` is `None`, then ``project_dir`` must contain a
- :file:`pyproject.toml` file containing a ``[tool.versioningit]`` table; if
- it does not, a `NotVersioningitError` is raised. If ``config`` is not
- `None`, then any :file:`pyproject.toml` file in ``project_dir`` will be
- ignored, and the configuration will be taken from ``config`` instead; see
- ":ref:`config_dict`".
+ :file:`versioningit.toml` or :file:`pyproject.toml` file; if both files are
+ present, the :file:`versioningit.toml` file is used. This file must then
+ contain either a ``[tool.versioningit]`` table or a
+ ``[tool.hatch.version]`` table with the ``source`` key set to
+ ``"versioningit"``; if it does not, a `NoConfigSectionError` is raised. If
+ ``config`` is not `None`, then any configuration files in ``project_dir``
+ will be ignored, and the configuration will be taken from ``config``
+ instead. See ":ref:`config_dict`".
.. versionchanged:: 2.0.0
``version`` argument replaced with ``template_fields``
+ .. versionchanged:: 3.2.0
+
+ A :file:`versioningit.toml` file can now be read in place of
+ :file:`pyproject.toml`
+
:param build_dir: The directory containing the in-progress build
:param is_source:
Set to `True` if building an sdist or other artifact that preserves
source paths, `False` if building a wheel or other artifact that uses
installation paths
:param template_fields: A `dict` of fields to be used when templating
- :raises NotVersioningitError:
- - if ``config`` is `None` and ``project_dir`` does not contain a
- :file:`pyproject.toml` file
- - if the :file:`pyproject.toml` file does not contain a
- ``[tool.versioningit]`` table
+ :raises NoConfigFileError:
+ if ``config`` is `None` and ``project_dir`` does not contain a
+ :file:`pyproject.toml` or :file:`versioningit.toml` file
+ :raises NoConfigSectionError:
+ if ``config`` is `None` and the configuration file does not contain a
+ versioningit configuration table
:raises ConfigError:
if any of the values in ``config`` are not of the correct type
:raises MethodError: if a method returns a value of the wrong type
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/errors.py
new/versioningit-3.3.0/src/versioningit/errors.py
--- old/versioningit-3.1.2/src/versioningit/errors.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/errors.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,3 +1,6 @@
+from pathlib import Path
+
+
class Error(Exception):
"""Base class of all ``versioningit``-specific errors"""
@@ -27,6 +30,39 @@
pass
+class NoConfigFileError(NotVersioningitError):
+ """
+ .. versionadded:: 3.2.0
+
+ Raised when ``versioningit`` is used on a project that does not contain a
+ :file:`versioningit.toml` or :file:`pyproject.toml` file
+ """
+
+ def __init__(self, project_dir: Path) -> None:
+ #: The path to the project directory
+ self.project_dir: Path = project_dir
+
+ def __str__(self) -> str:
+ return f"No pyproject.toml or versioningit.toml file in
{self.project_dir}"
+
+
+class NoConfigSectionError(NotVersioningitError):
+ """
+ .. versionadded:: 3.2.0
+
+ Raised when ``versioningit`` is used on a project whose
+ :file:`versioningit.toml` or :file:`pyproject.toml` file does not contain a
+ ``versioningit`` configuration table
+ """
+
+ def __init__(self, config_path: Path) -> None:
+ #: The path to the configuration file
+ self.config_path: Path = config_path
+
+ def __str__(self) -> str:
+ return f"versioningit not configured in {self.config_path}"
+
+
class NotSdistError(Error):
"""
Raised when attempting to read a :file:`PKG-INFO` file from a directory
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/git.py
new/versioningit-3.3.0/src/versioningit/git.py
--- old/versioningit-3.1.2/src/versioningit/git.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/git.py 2020-02-02
01:00:00.000000000 +0100
@@ -236,7 +236,9 @@
if "revision" not in vdesc.fields:
revision, author_ts, committer_ts = repo.read(
"--no-pager", "show", "-s", "--format=%H%n%at%n%ct"
- ).splitlines()
+ ).splitlines()[-3:]
+ # [-3:] to discard possible leading GPG signature
+ # <https://github.com/jwodder/versioningit/issues/111>
vdesc.fields["revision"] = revision
vdesc.fields["author_date"] = fromtimestamp(int(author_ts))
vdesc.fields["committer_date"] = fromtimestamp(int(committer_ts))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/hatch.py
new/versioningit-3.3.0/src/versioningit/hatch.py
--- old/versioningit-3.1.2/src/versioningit/hatch.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/hatch.py 2020-02-02
01:00:00.000000000 +0100
@@ -31,9 +31,8 @@
try:
vgit = Versioningit.from_project_dir(PROJECT_ROOT)
report = vgit.run(write=True, fallback=True)
- except NotVersioningitError: # pragma: no cover
- p = PROJECT_ROOT / "pyproject.toml"
- raise RuntimeError(f"versioningit not configured in {p}")
+ except NotVersioningitError as e: # pragma: no cover
+ raise RuntimeError(str(e))
except (NotSdistError, NoTagError) as e:
raise RuntimeError(
# If an error occurs in `get_version_data()`, hatchling throws
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/src/versioningit/hook.py
new/versioningit-3.3.0/src/versioningit/hook.py
--- old/versioningit-3.1.2/src/versioningit/hook.py 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/src/versioningit/hook.py 2020-02-02
01:00:00.000000000 +0100
@@ -21,8 +21,8 @@
try:
vgit = Versioningit.from_project_dir(PROJECT_ROOT)
report = vgit.run(write=True, fallback=True)
- except NotVersioningitError:
- log.info("versioningit not enabled in pyproject.toml; doing nothing")
+ except NotVersioningitError as e:
+ log.info(f"versioningit not enabled: {e}; doing nothing")
return
except (NotSdistError, NoTagError):
raise RuntimeError(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/versioningit-3.1.2/test/data/config-error/no-ving.txt
new/versioningit-3.3.0/test/data/config-error/no-ving.txt
--- old/versioningit-3.1.2/test/data/config-error/no-ving.txt 2020-02-02
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/test/data/config-error/no-ving.txt 2020-02-02
01:00:00.000000000 +0100
@@ -1 +1 @@
-versioningit not enabled in pyproject.toml
+versioningit not configured in {tomlfile}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/versioningit-3.1.2/test/data/config-error/other-hatch.txt
new/versioningit-3.3.0/test/data/config-error/other-hatch.txt
--- old/versioningit-3.1.2/test/data/config-error/other-hatch.txt
2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/test/data/config-error/other-hatch.txt
2020-02-02 01:00:00.000000000 +0100
@@ -1 +1 @@
-versioningit not enabled in pyproject.toml
+versioningit not configured in {tomlfile}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/versioningit-3.1.2/test/data/repos/git/onbuild-write-norming.json
new/versioningit-3.3.0/test/data/repos/git/onbuild-write-norming.json
--- old/versioningit-3.1.2/test/data/repos/git/onbuild-write-norming.json
1970-01-01 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/test/data/repos/git/onbuild-write-norming.json
2020-02-02 01:00:00.000000000 +0100
@@ -0,0 +1,18 @@
+{
+ "version": "0.1.0-r2",
+ "pkg_version": "0.1.0.post2",
+ "next_version": "0.2.0",
+ "files": [
+ {
+ "sdist_path": "src/mypackage/_version.py",
+ "wheel_path": "mypackage/_version.py",
+ "contents": "__raw_version__ = \"0.1.0-r2\"\n__version__ =
\"0.1.0.post2\"\n"
+ },
+ {
+ "sdist_path": "src/mypackage/__init__.py",
+ "wheel_path": "mypackage/__init__.py",
+ "in_project": false,
+ "contents": "\"\"\" A test package \"\"\"\n\n__raw_version__ =
\"0.1.0-r2\"\n__version__ = \"0.1.0.post2\"\n"
+ }
+ ]
+}
Binary files
old/versioningit-3.1.2/test/data/repos/git/onbuild-write-norming.zip and
new/versioningit-3.3.0/test/data/repos/git/onbuild-write-norming.zip differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/versioningit-3.1.2/test/data/repos/git/vgit-toml.json
new/versioningit-3.3.0/test/data/repos/git/vgit-toml.json
--- old/versioningit-3.1.2/test/data/repos/git/vgit-toml.json 1970-01-01
01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/test/data/repos/git/vgit-toml.json 2020-02-02
01:00:00.000000000 +0100
@@ -0,0 +1,4 @@
+{
+ "version": "0.2.0.dev1+gda20d46",
+ "next_version": "0.2.0"
+}
Binary files old/versioningit-3.1.2/test/data/repos/git/vgit-toml.zip and
new/versioningit-3.3.0/test/data/repos/git/vgit-toml.zip differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/test/test_config.py
new/versioningit-3.3.0/test/test_config.py
--- old/versioningit-3.1.2/test/test_config.py 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/test/test_config.py 2020-02-02 01:00:00.000000000
+0100
@@ -32,10 +32,9 @@
def test_parse_bad_toml_file(tomlfile: Path) -> None:
with pytest.raises((ConfigError, NotVersioningitError)) as excinfo:
Config.parse_toml_file(tomlfile)
- assert (
- str(excinfo.value)
- == tomlfile.with_suffix(".txt").read_text(encoding="utf-8").strip()
- )
+ assert str(excinfo.value) == tomlfile.with_suffix(".txt").read_text(
+ encoding="utf-8"
+ ).strip().format(tomlfile=tomlfile)
def test_parse_obj_callable_methods() -> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/test/test_end2end.py
new/versioningit-3.3.0/test/test_end2end.py
--- old/versioningit-3.1.2/test/test_end2end.py 2020-02-02 01:00:00.000000000
+0100
+++ new/versioningit-3.3.0/test/test_end2end.py 2020-02-02 01:00:00.000000000
+0100
@@ -64,11 +64,20 @@
class CaseDetails(BaseModel):
version: str
+ # Version reported by packaging metadata rather than by versioningit;
+ # differs from `version` when normalization happens:
+ pkg_version: Union[str, None] = None
next_version: Union[str, ErrorDetails]
local_modules: List[str] = Field(default_factory=list)
files: List[File] = Field(default_factory=list)
logmsgs: List[LogMsg] = Field(default_factory=list)
+ def get_pkg_version(self) -> str:
+ if self.pkg_version is not None:
+ return self.pkg_version
+ else:
+ return self.version
+
def mkcases(
subdir: str,
@@ -142,13 +151,13 @@
f.check(srcdir, "project")
sdist_src = unpack_sdist(srcdir / "dist", tmp_path)
- assert get_version_from_pkg_info(sdist_src) == details.version
+ assert get_version_from_pkg_info(sdist_src) == details.get_pkg_version()
for f in details.files:
f.check(sdist_src, "sdist")
wheel_src, wheel_dist_info = unpack_wheel(srcdir / "dist", tmp_path)
metadata = (wheel_dist_info / "METADATA").read_text(encoding="utf-8")
- assert parse_version_from_metadata(metadata) == details.version
+ assert parse_version_from_metadata(metadata) == details.get_pkg_version()
for f in details.files:
f.check(wheel_src, "wheel")
@@ -158,10 +167,16 @@
shutil.unpack_archive(DATA_DIR / "repos" / "no-versioningit.zip", srcdir)
with pytest.raises(NotVersioningitError) as excinfo:
get_version(project_dir=srcdir, write=False, fallback=True)
- assert str(excinfo.value) == "versioningit not enabled in pyproject.toml"
+ assert (
+ str(excinfo.value)
+ == f"versioningit not configured in {srcdir / 'pyproject.toml'}"
+ )
with pytest.raises(NotVersioningitError) as excinfo:
get_next_version(srcdir)
- assert str(excinfo.value) == "versioningit not enabled in pyproject.toml"
+ assert (
+ str(excinfo.value)
+ == f"versioningit not configured in {srcdir / 'pyproject.toml'}"
+ )
out = readcmd(
sys.executable,
@@ -173,8 +188,8 @@
stderr=subprocess.STDOUT,
)
assert (
- "[INFO ] versioningit: versioningit not enabled in pyproject.toml;"
- " doing nothing" in out.splitlines()
+ "[INFO ] versioningit: versioningit not enabled: versioningit not"
+ f" configured in {srcdir / 'pyproject.toml'}; doing nothing" in
out.splitlines()
)
sdist_src = unpack_sdist(srcdir / "dist", tmp_path)
@@ -190,10 +205,14 @@
shutil.unpack_archive(DATA_DIR / "repos" / "no-pyproject.zip", srcdir)
with pytest.raises(NotVersioningitError) as excinfo:
get_version(project_dir=srcdir, write=False, fallback=True)
- assert str(excinfo.value) == f"No pyproject.toml file in {srcdir}"
+ assert (
+ str(excinfo.value) == f"No pyproject.toml or versioningit.toml file in
{srcdir}"
+ )
with pytest.raises(NotVersioningitError) as excinfo:
get_next_version(srcdir)
- assert str(excinfo.value) == f"No pyproject.toml file in {srcdir}"
+ assert (
+ str(excinfo.value) == f"No pyproject.toml or versioningit.toml file in
{srcdir}"
+ )
out = readcmd(
sys.executable,
@@ -205,8 +224,8 @@
stderr=subprocess.STDOUT,
)
assert (
- "[INFO ] versioningit: versioningit not enabled in pyproject.toml;"
- " doing nothing" in out.splitlines()
+ "[INFO ] versioningit: versioningit not enabled: No pyproject.toml"
+ f" or versioningit.toml file in {srcdir}; doing nothing" in
out.splitlines()
)
sdist_src = unpack_sdist(srcdir / "dist", tmp_path)
@@ -373,7 +392,7 @@
wheel_src, wheel_dist_info = unpack_wheel(srcdir / "dist", tmp_path)
metadata = (wheel_dist_info / "METADATA").read_text(encoding="utf-8")
- assert parse_version_from_metadata(metadata) == details.version
+ assert parse_version_from_metadata(metadata) == details.get_pkg_version()
for f in details.files:
f.check(wheel_src, "wheel")
@@ -398,7 +417,7 @@
try:
assert get_repo_status(srcdir) == status
info = readcmd(sys.executable, "-m", "pip", "show", "mypackage")
- assert parse_version_from_metadata(info) == details.version
+ assert parse_version_from_metadata(info) == details.get_pkg_version()
version_var = readcmd(
sys.executable, "-c", "import mypackage;
print(mypackage.__version__)"
)
@@ -428,7 +447,7 @@
try:
assert get_repo_status(srcdir) == status
info = readcmd(sys.executable, "-m", "pip", "show", "mypackage")
- assert parse_version_from_metadata(info) == details.version
+ assert parse_version_from_metadata(info) == details.get_pkg_version()
version_var = readcmd(
sys.executable, "-c", "import mypackage;
print(mypackage.__version__)"
)
@@ -462,17 +481,75 @@
f.check(srcdir, "project")
sdist_src = unpack_sdist(srcdir / "dist", tmp_path)
- assert get_version_from_pkg_info(sdist_src) == details.version
+ assert get_version_from_pkg_info(sdist_src) == details.get_pkg_version()
for f in details.files:
f.check(sdist_src, "sdist")
wheel_src, wheel_dist_info = unpack_wheel(srcdir / "dist", tmp_path)
metadata = (wheel_dist_info / "METADATA").read_text(encoding="utf-8")
- assert parse_version_from_metadata(metadata) == details.version
+ assert parse_version_from_metadata(metadata) == details.get_pkg_version()
for f in details.files:
f.check(wheel_src, "wheel")
+@needs_git
+def test_install_from_git_url() -> None:
+ subprocess.run(
+ [
+ sys.executable,
+ "-m",
+ "pip",
+ "install",
+ "--no-build-isolation",
+ "--verbose",
+ "git+https://github.com/jwodder/versioningit-test",
+ ],
+ check=True,
+ env={**os.environ, "VERSIONINGIT_LOG_LEVEL": "DEBUG"},
+ )
+ try:
+ info = readcmd(sys.executable, "-m", "pip", "show",
"versioningit-test")
+ assert parse_version_from_metadata(info) == "0.1.0.post2+g0a4a58d"
+ finally:
+ subprocess.run(
+ [sys.executable, "-m", "pip", "uninstall", "--yes",
"versioningit-test"],
+ check=True,
+ )
+
+
+def test_install_from_zip_url() -> None:
+ subprocess.run(
+ [
+ sys.executable,
+ "-m",
+ "pip",
+ "install",
+ "--no-build-isolation",
+ "--verbose",
+
"https://github.com/jwodder/versioningit-git-archive-test/archive/master.zip",
+ ],
+ check=True,
+ env={**os.environ, "VERSIONINGIT_LOG_LEVEL": "DEBUG"},
+ )
+ try:
+ info = readcmd(
+ sys.executable, "-m", "pip", "show",
"versioningit-git-archive-test"
+ )
+ assert parse_version_from_metadata(info) == "0.2.0.post1+gfc89e73"
+ finally:
+ subprocess.run(
+ [
+ sys.executable,
+ "-m",
+ "pip",
+ "uninstall",
+ "--yes",
+ "versioningit-git-archive-test",
+ ],
+ check=True,
+ )
+
+
def get_repo_status(repodir: Path) -> str:
if (repodir / ".git").exists():
return readcmd("git", "status", "--porcelain", cwd=str(repodir))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/versioningit-3.1.2/test/test_methods/test_template_fields.py
new/versioningit-3.3.0/test/test_methods/test_template_fields.py
--- old/versioningit-3.1.2/test/test_methods/test_template_fields.py
2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/test/test_methods/test_template_fields.py
2020-02-02 01:00:00.000000000 +0100
@@ -97,6 +97,7 @@
"build_date": BUILD_DATE,
"branch": "main",
"version": version,
+ "normalized_version": version,
"version_tuple": version_tuple,
"base_version": "0.1.0",
"next_version": "0.2.0",
@@ -141,7 +142,11 @@
None,
None,
None,
- {"version": "1.2.3.post5", "version_tuple": '(1, 2, 3, "post5")'},
+ {
+ "version": "1.2.3.post5",
+ "version_tuple": '(1, 2, 3, "post5")',
+ "normalized_version": "1.2.3.post5",
+ },
),
(
DESCRIPTION,
@@ -155,6 +160,7 @@
"rev": "abcdef0",
"build_date": BUILD_DATE,
"branch": "main",
+ "normalized_version": "1.2.3.post5",
},
),
(
@@ -170,6 +176,7 @@
"build_date": BUILD_DATE,
"branch": "main",
"base_version": "1.2.3",
+ "normalized_version": "1.2.3.post5",
},
),
],
@@ -190,3 +197,45 @@
)
== fields
)
+
+
+def test_basic_template_fields_nonnormalized_version() -> None:
+ assert basic_template_fields(
+ version="2025.06.01",
+ description=DESCRIPTION,
+ base_version="2025.06.01",
+ next_version="2025.07.01",
+ params={},
+ ) == {
+ "distance": 5,
+ "vcs": "g",
+ "rev": "abcdef0",
+ "build_date": BUILD_DATE,
+ "branch": "main",
+ "version": "2025.06.01",
+ "normalized_version": "2025.6.1",
+ "version_tuple": "(2025, 6, 1)",
+ "base_version": "2025.06.01",
+ "next_version": "2025.07.01",
+ }
+
+
+def test_basic_template_fields_nonpep440_version() -> None:
+ assert basic_template_fields(
+ version="2025.06.01j",
+ description=DESCRIPTION,
+ base_version="2025.06.01",
+ next_version="2025.07.01",
+ params={},
+ ) == {
+ "distance": 5,
+ "vcs": "g",
+ "rev": "abcdef0",
+ "build_date": BUILD_DATE,
+ "branch": "main",
+ "version": "2025.06.01j",
+ "normalized_version": "2025.06.01j",
+ "version_tuple": '(2025, 6, "01j")',
+ "base_version": "2025.06.01",
+ "next_version": "2025.07.01",
+ }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/versioningit-3.1.2/tox.ini
new/versioningit-3.3.0/tox.ini
--- old/versioningit-3.1.2/tox.ini 2020-02-02 01:00:00.000000000 +0100
+++ new/versioningit-3.3.0/tox.ini 2020-02-02 01:00:00.000000000 +0100
@@ -1,5 +1,5 @@
[tox]
-envlist = lint,typing,py38,py39,py310,py311,py312,pypy3,py-oldsetup
+envlist = lint,typing,py38,py39,py310,py311,py312,py313,pypy3,py-oldsetup
skip_missing_interpreters = True
isolated_build = True
minversion = 3.3.0
@@ -58,7 +58,9 @@
# to some tests spawning subprocesses with changed working directories.
--cov-config=tox.ini
--no-cov-on-fail
-filterwarnings = error
+filterwarnings =
+ error
+ ignore:.*No source for code:coverage.exceptions.CoverageWarning
markers =
describe_exclude: Tests that use `git describe --exclude` (Added in Git
2.13.0)
oldsetup: Tests to only run under pre-v64 setuptools