diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 33e3e3aa..626c2a5e 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,11 +10,17 @@ build: os: ubuntu-22.04 tools: python: "3.11" + jobs: + pre_install: + # - curl -LsSf https://astral.sh/uv/install.sh | sh + - pip install uv + - uv export --only-group docs --no-hashes --no-color > requirements-docs.txt + post_install: + - pip install -r requirements-docs.txt + pre_build: + - make -C docs html # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py -python: - install: - - requirements: docs/requirements.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2281f167..97a5f89f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,11 +18,96 @@ This section covers the changes between major version 2 and version 3. .. towncrier release notes start +Version 3.0.3 +============= + +:Released: 2025-01-18 +:Maintainer: Tom Schraitle + + +Bug Fixes +--------- + +* :pr:`453`: The check in ``_comparator`` does not match the check in :meth:`Version.compare`. + This breaks comparision with subclasses. + + + +Improved Documentation +---------------------- + +* :pr:`435`: Several small improvements for documentation: + + * Add meta description to improve SEO + * Use canonicals on ReadTheDocs (commit 87f639f) + * Pin versions for reproducable doc builds (commit 03fb990) + * Add missing :file:`.readthedocs.yaml` file (commit ec9348a) + * Correct some smaller issues when building (commit f65feab) + +* :pr:`436`: Move search box more at the top. This makes it easier for + users as if the TOC is long, the search box isn't visible + anymore. + + + +Features +-------- + +* :pr:`439`: Improve type hints to fix TODOs + + + +Internal Changes +---------------- + +* :pr:`440`: Update workflow file + +* :pr:`446`: Add Python 3.13 to GitHub Actions + +* :pr:`447`: Modernize project configs with :file:`pyproject.toml` and + use Astral's uv command. + + * In :file:`pyproject.toml`: + + * Move all project related data from :file:`setup.cfg` to :file:`pyproject.toml` + * Use new dependency group from :pep:`735` + * Consolidate flake8, isort, pycodestyle with ruff + * Split towncrier config type "trivial" into "trivial" and "internal" + + * Create config file for ruff (:file:`.ruff.toml`) + * Create config file for pytest (:file:`.pytest.ini`) + * Simplify :file:`tox.ini` and remove old stuff + * Document installation with new :command:`uv` command + * Simplify Sphinx config with :func:`find_version()` + * Update the authors + * Use :command:`uv` in GitHub Action :file:`python-testing.yml` workflow + +* Update :file:`release-procedure.md`. + +* :pr:`451`: Turn our Markdown issue templates into YAML + + +Trivial Changes +--------------- + +* :pr:`438`: Replace organization placeholder in license + +* :pr:`445`: Improve private :func:`_nat_cmp` method: + + * Remove obsolete else. + * Find a better way to identify digits without the :mod:`re` module. + * Fix docstring in :meth:`Version.compare` + + + +---- + + Version 3.0.2 ============= :Released: 2023-10-09 -:Maintainer: +:Maintainer: Tom Schraitle Bug Fixes diff --git a/changelog.d/pr435.doc.rst b/changelog.d/pr435.doc.rst deleted file mode 100644 index 87925c3d..00000000 --- a/changelog.d/pr435.doc.rst +++ /dev/null @@ -1,7 +0,0 @@ -Several small improvements for documentation: - -* Add meta description to improve SEO -* Use canonicals on ReadTheDocs (commit 87f639f) -* Pin versions for reproducable doc builds (commit 03fb990) -* Add missing :file:`.readthedocs.yaml` file (commit ec9348a) -* Correct some smaller issues when building (commit f65feab) diff --git a/changelog.d/pr436.doc.rst b/changelog.d/pr436.doc.rst deleted file mode 100644 index 5f078361..00000000 --- a/changelog.d/pr436.doc.rst +++ /dev/null @@ -1,3 +0,0 @@ -Move search box more at the top. This makes it easier for -users as if the TOC is long, the search box isn't visible -anymore. diff --git a/changelog.d/pr447.internal.rst b/changelog.d/pr447.internal.rst deleted file mode 100644 index 2f1e367d..00000000 --- a/changelog.d/pr447.internal.rst +++ /dev/null @@ -1,15 +0,0 @@ -Modernize project configs with :file:`pyproject.toml` - -* In :file:`pyproject.toml`: - * Move all project related data from :file:`setup.cfg` to :file:`pyproject.toml` - * Use new dependency group from :pep:`735` - * Consolidate flake8, isort, pycodestyle with ruff - * Split towncrier config type "trivial" into "trivial" and - "internal" -* Create config file for ruff (:file:`.ruff.toml`) -* Create config file for pytest (:file:`.pytest.ini`) -* Simplify :file:`tox.ini` and remove old stuff -* Document installation with new :command:`uv` command -* Simplify Sphinx config with :func:`find_version()` -* Update the authors -* Use :command:`uv` in GitHub Action :file:`python-testing.yml` workflow diff --git a/docs/build-semver.rst b/docs/build-semver.rst index b5626d22..9c0441d8 100644 --- a/docs/build-semver.rst +++ b/docs/build-semver.rst @@ -7,58 +7,27 @@ Building semver :description lang=en: Building semver -.. _PEP 517: https://www.python.org/dev/peps/pep-0517/ -.. _PEP 621: https://www.python.org/dev/peps/pep-0621/ -.. _A Practical Guide to Setuptools and Pyproject.toml: https://godatadriven.com/blog/a-practical-guide-to-setuptools-and-pyproject-toml/ -.. _Declarative config: https://setuptools.rtfd.io/en/latest/userguide/declarative_config.html +.. _Installing uv: https://docs.astral.sh/uv/getting-started/installation/ -This project changed slightly its way how it is built. The reason for this -was to still support the "traditional" way with :command:`setup.py`, -but at the same time try out the newer way with :file:`pyproject.toml`. -As Python 3.6 got deprecated, this project does support from now on only -:file:`pyproject.toml`. +This project changed its way how it is built over time. We used to have +a :file:`setup.py` file, but switched to a :file:`pyproject.toml` setup. +The build process is managed by :command:`uv` command. -Background information ----------------------- +You need: -Skip this section and head over to :ref:`build-pyproject-build` if you just -want to know how to build semver. -This section gives some background information how this project is set up. +* Python 3.7 or newer. -The traditional way with :command:`setup.py` in this project uses a -`Declarative config`_. With this approach, the :command:`setup.py` is -stripped down to its bare minimum and all the metadata is stored in -:file:`setup.cfg`. +* The :mod:`setuptools` module version 61 or newer which is used as + a build backend. -The new :file:`pyproject.toml` contains only information about the build backend, currently setuptools.build_meta. The idea is taken from -`A Practical Guide to Setuptools and Pyproject.toml`_. -Setuptools-specific configuration keys as defined in `PEP 621`_ are currently -not used. +* The command :command:`uv` from Astral. Refer to the section + `Installing uv`_ for more information. -.. _build-pyproject-build: - -Building with pyproject-build ------------------------------ - -To build semver you need: - -* The :mod:`build` module which implements the `PEP 517`_ build - frontend. - Install it with:: - - pip install build - - Some Linux distributions has already packaged it. If you prefer - to use the module with your package manager, search for - :file:`python-build` or :file:`python3-build` and install it. - -* The command :command:`pyproject-build` from the :mod:`build` module. - To build semver, run:: - pyproject-build + uv build After the command is finished, you can find two files in the :file:`dist` folder: a ``.tar.gz`` and a ``.whl`` file. \ No newline at end of file diff --git a/docs/usage/semver-version.rst b/docs/usage/semver-version.rst index 51165293..df04a74f 100644 --- a/docs/usage/semver-version.rst +++ b/docs/usage/semver-version.rst @@ -4,4 +4,4 @@ Getting the Version of semver To know the version of semver itself, use the following construct:: >>> semver.__version__ - '3.0.3-alpha.1' + '3.0.3' diff --git a/pyproject.toml b/pyproject.toml index 6c9cb93a..33986287 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,6 @@ [build-system] requires = [ - # sync with setup.py until we discard non-pep-517/518 "setuptools>=61", # "setuptools-scm>=8", ] @@ -19,6 +18,8 @@ requires-python = ">=3.7" name = "semver" description = "Python helper for Semantic Versioning (https://semver.org)" readme = "README.rst" +# PEP 639 +# licence = "BSD-2-Clause" # readme.content-type = "text/x-rst" license = { file = "LICENSE.txt" } authors = [ @@ -34,7 +35,7 @@ classifiers = [ "Environment :: Web Environment", "Intended Audience :: Developers", "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: BSD License", + # "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", @@ -92,6 +93,7 @@ docs = [ "sphinx", # ==7.0.1 "sphinx-argparse", # ==0.4.0 "sphinx-autodoc-typehints", # ==1.24.0 + "restview", ] devel = [ {include-group = "typing"}, diff --git a/release-procedure.md b/release-procedure.md index 4225bfd9..f6c7c377 100644 --- a/release-procedure.md +++ b/release-procedure.md @@ -3,120 +3,142 @@ The following procedures gives a short overview of what steps are needed to create a new release. -## Prepare the Release +## Prepare your environment -1. Verify: +1. Create your API tokens: - * all issues for a new release are closed: . + 1. From the [PyPI test server](https://test.pypi.org/manage/account/token/). - * that all pull requests that should be included in this release are merged: . + 1. From the official [PyPI server](https://test.pypi.org/manage/account/token/). - * that continuous integration for latest build was passing: - . + 1. Save both tokens it in a safe place like your password manager. + +1. Create a file `~/.pypirc` with file mode 0600 and the following minimal content: + + # Protect the file with chmod 0600 ~/.pypirc + [distutils] + index-servers = + test-semver + semver + + [test-semver] + repository = https://test.pypi.org/legacy/ + username = __token__ + password = + + [semver] + repository = https://pypi.org/legacy/ + username = __token__ + password = + +1. Install uv as shown in Astral's [Installing uv](https://docs.astral.sh/uv/getting-started/installation/) documentation. + +1. Update the project's environment: + + uv sync --group devel + +1. Activate your environment: + + source .venv/bin/activate + +## Prepare the Release 1. Create a new branch `release/`. -1. If one or several supported Python versions have been removed or added, verify that the 3 following files have been updated: - * `setup.cfg` +1. If one or several supported **Python** versions have been removed or added, verify that the following files have been updated: + * `pyproject.toml` (look into the key `project.requires-python` and `project.classifiers`) * `tox.ini` * `.git/workflows/pythonpackage.yml` * `CITATION.cff` -1. Verify that the version has been updated and follow - : +1. Verify that: + + * the version has been updated and follow : + * `src/semver/__about__.py` + * `docs/usage/semver-version.rst` + + * all issues for a new release are closed: . - * `src/semver/__about__.py` - * `docs/usage/semver-version.rst` + * all pull requests that should be included in this release are merged: . + + * continuous integration for latest build was passing: + . 1. Add eventually new contributor(s) to [CONTRIBUTORS](https://github.com/python-semver/python-semver/blob/master/CONTRIBUTORS). +1. Create the changelog: -1. Check if all changelog entries are created. If some are missing, [create them](https://python-semver.readthedocs.io/en/latest/development.html#adding-a-changelog-entry). + 1. Check if all changelog entries are created. If some are missing, [create them](https://python-semver.readthedocs.io/en/latest/development.html#adding-a-changelog-entry). -1. Show the new draft [CHANGELOG](https://github.com/python-semver/python-semver/blob/master/CHANGELOG.rst) entry for the latest release with: + 1. Show the new draft [CHANGELOG](https://github.com/python-semver/python-semver/blob/master/CHANGELOG.rst) entry for the latest release with: - $ tox -e changelog + uvx tox r -e changelog - Check the output. If you are not happy, update the files in the - `changelog.d/` directory. - If everything is okay, build the new `CHANGELOG` with: + 1. Check the output. If you are not happy, update the files in the + `changelog.d/` directory. + If everything is okay, build the new `CHANGELOG` with: - $ tox -e changelog -- build + uvx tox r -e changelog -- build 1. Build the documentation and check the output: - $ tox -e docs + uvx tox r -e docs 1. Commit all changes, push, and create a pull request. ## Create the New Release -1. Ensure that long description ([README.rst](https://github.com/python-semver/python-semver/blob/master/README.rst)) can be correctly rendered by Pypi using `restview --long-description` +1. Ensure that long description ([README.rst](https://github.com/python-semver/python-semver/blob/master/README.rst)) can be correctly rendered by Pypi using `uvx restview -b README.rst` 1. Clean up your local Git repository. Be careful, as it **will remove all files** which are not versioned by Git: - $ git clean -xfd + git clean -xfd Before you create your distribution files, clean the directory too: - $ rm dist/* + rm dist/* 1. Create the distribution files (wheel and source): - $ tox -e prepare-dist + uvx tox r -e prepare-dist 1. Upload the wheel and source to TestPyPI first: - ```bash - $ twine upload --repository-url https://test.pypi.org/legacy/ dist/* - ``` + twine upload --verbose --repository test-semver dist/* - If you have a `~/.pypirc` with a `testpypi` section, the upload can be - simplified: - - $ twine upload --repository testpypi dist/* + (Normally you would do it with `uv publish`, but for some unknown reason it didn't work for me.) 1. Check if everything is okay with the wheel. Check also the web site `https://test.pypi.org/project//` +# Finish the release + 1. If everything looks fine, merge the pull request. 1. Upload to PyPI: - ```bash - $ git clean -xfd - $ tox -e prepare-dist - $ twine upload dist/* - ``` + $ git clean -xfd + $ tox r -e prepare-dist + $ twine upload --verbose --repository semver dist/* 1. Go to https://pypi.org/project/semver/ to verify that new version is online and the page is rendered correctly. -# Finish the release - 1. Create a tag: - ```bash - $ git tag -a x.y.z - ``` + git tag -a x.y.z - It's recommended to use the generated Tox output - from the Changelog. + It's recommended to use the generated Tox output from the Changelog. 1. Push the tag: - ```bash - $ git push origin x.y.z - ``` + git push origin x.y.z -1. In [GitHub Release page](https://github.com/python-semver/python-semver/release) - document the new release. - Select the tag from the last step and copy the - content of the tag description into the release - description. +1. In [GitHub Release page](https://github.com/python-semver/python-semver/release) document the new release. + Select the tag from the last step and copy the content of the tag description into the release description. 1. Announce it in . diff --git a/src/semver/__about__.py b/src/semver/__about__.py index 697372f8..d971e038 100644 --- a/src/semver/__about__.py +++ b/src/semver/__about__.py @@ -16,7 +16,7 @@ """ #: Semver version -__version__ = "3.0.3-alpha.1" +__version__ = "3.0.3" #: Original semver author __author__ = "Kostiantyn Rybnikov" diff --git a/tox.ini b/tox.ini index 74918c44..5c9db174 100644 --- a/tox.ini +++ b/tox.ini @@ -63,6 +63,7 @@ skip_install = true allowlist_externals = make echo + uvx commands = uvx make -C docs html commands_post = diff --git a/uv.lock b/uv.lock index 026a5848..c14d1363 100644 --- a/uv.lock +++ b/uv.lock @@ -278,7 +278,7 @@ name = "click" version = "8.1.7" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, { name = "importlib-metadata", marker = "python_full_version < '3.8'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 } @@ -876,16 +876,16 @@ wheels = [ [[package]] name = "readme-renderer" -version = "37.3" +version = "36.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "bleach" }, { name = "docutils" }, { name = "pygments" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/81/c3/d20152fcd1986117b898f66928938f329d0c91ddc47f081c58e64e0f51dc/readme_renderer-37.3.tar.gz", hash = "sha256:cd653186dfc73055656f090f227f5cb22a046d7f71a841dfa305f55c9a513273", size = 29718 } +sdist = { url = "https://files.pythonhosted.org/packages/15/4e/0ffa80eb3e0d0fcc0c6b901b36d4faa11c47d10b9a066fdd42f24c7e646a/readme_renderer-36.0.tar.gz", hash = "sha256:f71aeef9a588fcbed1f4cc001ba611370e94a0cd27c75b1140537618ec78f0a2", size = 28680 } wheels = [ - { url = "https://files.pythonhosted.org/packages/97/52/fd8a77d6f0a9ddeb26ed8fb334e01ac546106bf0c5b8e40dc826c5bd160f/readme_renderer-37.3-py3-none-any.whl", hash = "sha256:f67a16caedfa71eef48a31b39708637a6f4664c4394801a7b0d6432d13907343", size = 14055 }, + { url = "https://files.pythonhosted.org/packages/0a/3e/ce07c86adbc46cfedf637dd77333184bcd0a913f9c169b0b3afc25f67b6b/readme_renderer-36.0-py3-none-any.whl", hash = "sha256:2c37e472ca96755caba6cc58bcbf673a5574bc033385a2ac91d85dfef2799876", size = 14076 }, ] [[package]] @@ -915,6 +915,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3f/51/d4db610ef29373b879047326cbf6fa98b6c1969d6f6dc423279de2b1be2c/requests_toolbelt-1.0.0-py2.py3-none-any.whl", hash = "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06", size = 54481 }, ] +[[package]] +name = "restview" +version = "3.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "docutils" }, + { name = "pygments" }, + { name = "readme-renderer" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3d/d4/36ed06051e9702d3dae5f7bb0296b79b18621ff5a1bf43247509cbfeff8d/restview-3.0.2.tar.gz", hash = "sha256:8b4d75a0bed76b67b456ef7011f4eb6c98a556c9f837642df2202c7312fccc1a", size = 50048 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/11/69/4046cbec75d4574e84fa3b2be53487ae9054129527211961555631805849/restview-3.0.2-py3-none-any.whl", hash = "sha256:9fbd26507f6ddc436a49d0ffced5bc8102a898f289fe53c1234a17be46eb660d", size = 38020 }, +] + [[package]] name = "rfc3986" version = "2.0.0" @@ -978,7 +992,6 @@ wheels = [ [[package]] name = "semver" -version = "3.0.3a1" source = { editable = "." } [package.dev-dependencies] @@ -993,6 +1006,7 @@ devel = [ { name = "pyright" }, { name = "pytest" }, { name = "pytest-cov" }, + { name = "restview" }, { name = "ruff" }, { name = "sphinx" }, { name = "sphinx-argparse" }, @@ -1002,6 +1016,7 @@ devel = [ { name = "twine" }, ] docs = [ + { name = "restview" }, { name = "sphinx" }, { name = "sphinx-argparse" }, { name = "sphinx-autodoc-typehints" }, @@ -1019,6 +1034,7 @@ gh-action = [ { name = "pyright" }, { name = "pytest" }, { name = "pytest-cov" }, + { name = "restview" }, { name = "ruff" }, { name = "sphinx" }, { name = "sphinx-argparse" }, @@ -1054,6 +1070,7 @@ devel = [ { name = "pyright" }, { name = "pytest" }, { name = "pytest-cov" }, + { name = "restview" }, { name = "ruff" }, { name = "sphinx" }, { name = "sphinx-argparse" }, @@ -1063,6 +1080,7 @@ devel = [ { name = "twine" }, ] docs = [ + { name = "restview" }, { name = "sphinx" }, { name = "sphinx-argparse" }, { name = "sphinx-autodoc-typehints" }, @@ -1080,6 +1098,7 @@ gh-action = [ { name = "pyright" }, { name = "pytest" }, { name = "pytest-cov" }, + { name = "restview" }, { name = "ruff" }, { name = "sphinx" }, { name = "sphinx-argparse" },