diff --git a/CHANGELOG.md b/CHANGELOG.md index e26844af..5787702d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ * Use bumpversion for version in Sphinx config [#44](https://github.com/NLeSC/python-template/issues/44) * Regenerated docs/conf.py with sphinx-quickstart v3.5.4 + enabled built-in extensions [#44](https://github.com/NLeSC/python-template/issues/44) * Generate api rst files with extension instead of custom function [#95](https://github.com/NLeSC/python-template/issues/95) +* Change from bump2version (unmaintained) to bump-my-version. ### Removed diff --git a/README.dev.md b/README.dev.md index c7bc7c99..7bdcd553 100644 --- a/README.dev.md +++ b/README.dev.md @@ -82,7 +82,7 @@ In addition to the information in `my-python-project/project_setup.md`, the deve 1. generating `my-python-project`'s documentation locally 1. running `my-python-project`'s tests locally 1. running `my-python-project`'s linters locally -1. verifying that the `my-python-project`'s version can be updated using `bumpversion` +1. verifying that the `my-python-project`'s version can be updated using `bump-my-version` 1. making a release of `my-python-project` on https://test.pypi.org/ Follow the instructions from `my-python-project/README.dev.md` and make sure that everything works. diff --git a/README.md b/README.md index d70b7d73..d2605527 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat an empty Python package. Features include: - Boilerplate unit tests and documentation, -- [Python static setup configuration]({{cookiecutter.directory_name}}/setup.cfg), +- [Python static setup configuration]({{cookiecutter.directory_name}}/pyproject.toml), - Open source software license, - Continuous integration with [GitHub action workflows]({{cookiecutter.directory_name}}/.github/workflows) for building, testing, link checking and linting, - Code style checking with [ruff](https://beta.ruff.rs/), @@ -69,7 +69,7 @@ cookiecutter https://github.com/nlesc/python-template.git | ------------------------- | ------------- | ----------- | | directory_name | my-python-project | Name of the directory that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems. To get an impression of what will be generated, see the directory tree [below](https://github.com/NLeSC/python-template#step-33-read-about-what-was-just-generated) | | package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. | -| package_short_description | Short description of package | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | +| package_short_description | Short description of package | The information that you enter here will end up in the README, documentation, license, and pyproject.toml, so it may be a good idea to prepare something in advance. | | keyword1 | keyword1 | A term that describes your package. | | keyword2 | keyword2 | Another term that describes your package. | | version | 0.1.0 |   | @@ -89,7 +89,6 @@ Good job! You have now generated the skeleton for your package: ```text my-python-project/ -├── .bumpversion.cfg ├── CHANGELOG.md ├── CITATION.cff ├── CODE_OF_CONDUCT.md diff --git a/tests/test_project.py b/tests/test_project.py index 42bc02d3..399dd799 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -182,7 +182,7 @@ def test_bumpversion(baked_with_development_dependencies, project_env_bin_dir): assert original_version in (project_dir / 'my_python_package' / '__init__.py').read_text('utf-8') assert original_version in (project_dir / 'docs' / 'conf.py').read_text('utf-8') - result = run([f'{bin_dir}bumpversion', 'major'], project_dir) + result = run([f'{bin_dir}bump-my-version', 'major'], project_dir) assert result.returncode == 0 assert '' in result.stdout expected_version = '1.0.0' diff --git a/{{cookiecutter.directory_name}}/.bumpversion.cfg b/{{cookiecutter.directory_name}}/.bumpversion.cfg deleted file mode 100644 index f39a78cb..00000000 --- a/{{cookiecutter.directory_name}}/.bumpversion.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[bumpversion] -current_version = {{ cookiecutter.version }} - -[comment] -comment = The contents of this file cannot be merged with that of setup.cfg until https://github.com/c4urself/bump2version/issues/185 is resolved - -[bumpversion:file:{{ cookiecutter.package_name }}/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bumpversion:file:pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" - -[bumpversion:file:CITATION.cff] -search = version: "{current_version}" -replace = version: "{new_version}" - -[bumpversion:file:docs/conf.py] -search = version = "{current_version}" -replace = version = "{new_version}" diff --git a/{{cookiecutter.directory_name}}/README.dev.md b/{{cookiecutter.directory_name}}/README.dev.md index 921634c0..a408bdb0 100644 --- a/{{cookiecutter.directory_name}}/README.dev.md +++ b/{{cookiecutter.directory_name}}/README.dev.md @@ -113,12 +113,12 @@ make doctest ## Versioning -Bumping the version across all files is done with [bumpversion](https://github.com/c4urself/bump2version), e.g. +Bumping the version across all files is done with [bump-my-version](https://github.com/callowayproject/bump-my-version), e.g. ```shell -bumpversion major -bumpversion minor -bumpversion patch +bump-my-version major # bumps from e.g. 0.3.2 to 1.0.0 +bump-my-version minor # bumps from e.g. 0.3.2 to 0.4.0 +bump-my-version patch # bumps from e.g. 0.3.2 to 0.3.3 ``` ## Making a release diff --git a/{{cookiecutter.directory_name}}/project_setup.md b/{{cookiecutter.directory_name}}/project_setup.md index 8fdbf182..91ce36df 100644 --- a/{{cookiecutter.directory_name}}/project_setup.md +++ b/{{cookiecutter.directory_name}}/project_setup.md @@ -76,7 +76,7 @@ help you decide which tool to use for packaging. ## Package version number - We recommend using [semantic versioning](https://guide.esciencecenter.nl/#/best_practices/releases?id=semantic-versioning). -- For convenience, the package version is stored in a single place: `{{ cookiecutter.directory_name }}/.bumpversion.cfg`. +- For convenience, the package version is stored in a single place: `{{ cookiecutter.directory_name }}/pyproject.toml` under the `tool.bumpversion` header. - Don't forget to update the version number before [making a release](https://guide.esciencecenter.nl/#/best_practices/releases)! ## Logging diff --git a/{{cookiecutter.directory_name}}/pyproject.toml b/{{cookiecutter.directory_name}}/pyproject.toml index 595f593f..1303b044 100644 --- a/{{cookiecutter.directory_name}}/pyproject.toml +++ b/{{cookiecutter.directory_name}}/pyproject.toml @@ -44,7 +44,7 @@ version = "{{ cookiecutter.version }}" [project.optional-dependencies] dev = [ "build", # build is not only used in publishing (below), but also in the template's test suite - "bump2version", + "bump-my-version", "coverage [toml]", "pytest", "pytest-cov", @@ -171,3 +171,18 @@ line-length = 120 known-first-party = ["{{ cookiecutter.package_name }}"] force-single-line = true no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] + +[tool.bumpversion] +current_version = "{{ cookiecutter.version }}" + +[[tool.bumpversion.files]] +filename = "{{ cookiecutter.package_name }}/__init__.py" + +[[tool.bumpversion.files]] +filename = "pyproject.toml" + +[[tool.bumpversion.files]] +filename = "CITATION.cff" + +[[tool.bumpversion.files]] +filename = "docs/conf.py"