From 33bc8f93457ef9379b14ea78208966cc02059c99 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:15:25 -0500 Subject: [PATCH] use latest cookiecutter commit --- .cruft.json | 2 +- .flake8 | 30 ++++++++++++++++++ .github/workflows/bump-version.yml | 4 +-- .github/workflows/main.yml | 2 +- .github/workflows/tag-testpypi.yml | 1 + .pre-commit-config.yaml | 3 +- CONTRIBUTING.rst | 38 ++++++++++++---------- Makefile | 2 +- environment-dev.yml | 2 +- pyproject.toml | 27 +++++++++++++++- setup.cfg | 51 ------------------------------ tox.ini | 2 +- 12 files changed, 86 insertions(+), 78 deletions(-) create mode 100644 .flake8 delete mode 100644 setup.cfg diff --git a/.cruft.json b/.cruft.json index 9cea25a..3df0643 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/Ouranosinc/cookiecutter-pypackage", - "commit": "31d78c6bc26d641561e498defe5d383b68d1afc8", + "commit": "e528361615f8bb4b886206b9cd49ffda76c45b45", "checkout": null, "context": { "cookiecutter": { diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1116575 --- /dev/null +++ b/.flake8 @@ -0,0 +1,30 @@ +[flake8] +exclude = + .eggs, + .git, + build, + docs, + tests +ignore = + AZ100, + AZ200, + AZ300, + C, + D, + E, + F, + W503 +per-file-ignores = +rst-roles = + doc, + mod, + py:attr, + py:attribute, + py:class, + py:const, + py:data, + py:func, + py:meth, + py:mod, + py:obj, + py:ref diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 32698b4..9531a78 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -48,9 +48,9 @@ jobs: run: echo "current_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)" - name: Bump Patch Version run: | - pip install bump2version + pip install bump-my-version echo "Bumping version" - bump2version patch + bump-my-version bump patch echo "new_version=$(grep -E '__version__' xdatasets/__init__.py | cut -d ' ' -f3)" - name: Push Changes uses: ad-m/github-push-action@master diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81e8e86..d14d705 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,7 +107,7 @@ jobs: # python -m pip check || true # - name: Test with pytest # run: | -# python -m pytest tests +# python -m pytest --cov xdatasets # - name: Report coverage # run: | # python -m coveralls diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index fc461d0..036d9a1 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -10,6 +10,7 @@ jobs: release: name: Create Release from tag runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0') steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d625390..da4247f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: rev: v4.4.0 hooks: - id: trailing-whitespace - exclude: setup.cfg - id: end-of-file-fixer - id: debug-statements - id: check-json @@ -46,7 +45,7 @@ repos: hooks: - id: flake8 additional_dependencies: [ 'flake8-alphabetize', 'flake8-rst-docstrings' ] - args: ['--config=setup.cfg'] + args: ['--config=.flake8'] - repo: https://github.com/nbQA-dev/nbQA rev: 1.7.0 hooks: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3037f82..b5dc0df 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -4,8 +4,7 @@ Contributing ============ -Contributions are welcome, and they are greatly appreciated! Every little bit -helps, and credit will always be given. +Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: @@ -26,21 +25,17 @@ If you are reporting a bug, please include: Fix Bugs ~~~~~~~~ -Look through the GitHub issues for bugs. Anything tagged with "bug" and "help -wanted" is open to whoever wants to implement it. +Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it. Implement Features ~~~~~~~~~~~~~~~~~~ -Look through the GitHub issues for features. Anything tagged with "enhancement" -and "help wanted" is open to whoever wants to implement it. +Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. Write Documentation ~~~~~~~~~~~~~~~~~~~ -xdatasets could always use more documentation, whether as part of the -official xdatasets docs, in docstrings, or even on the web in blog posts, -articles, and such. +xdatasets could always use more documentation, whether as part of the official xdatasets docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ @@ -117,9 +112,11 @@ Pull Request Guidelines Before you submit a pull request, check that it meets these guidelines: -1. The pull request should include tests. -2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in ``README.rst``. -3. The pull request should work for Python 3.8, 3.9, 3.10, and 3.11. Check that the tests pass for all supported Python versions. +#. The pull request should include tests. + +#. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in ``README.rst``. + +#. The pull request should work for Python 3.8, 3.9, 3.10, and 3.11. Check that the tests pass for all supported Python versions. Tips ---- @@ -133,13 +130,20 @@ Versioning/Tagging A reminder for the maintainers on how to deploy. This section is only relevant for maintainers when they are producing a new point release for the package. -In a new branch, make sure all your release information has been committed (in ``CHANGES.rst``). Then run:: +#. Create a new branch from `main` (e.g. `release-0.2.0`). +#. Update the `CHANGES.rst` file to change the `Unreleased` section to the current date. +#. Create a pull request from your branch to `main`. +#. Once the pull request is merged, create a new release on GitHub. On the main branch, run: + + .. code-block:: shell + + $ bump-my-version bump minor # In most cases, we will be releasing a minor version + $ git push + $ git push --tags -$ bumpversion patch # possible: major / minor / patch -$ git push -$ git push --tags + This will trigger the CI to build the package and upload it to TestPyPI. In order to upload to PyPI, this can be done by publishing a new version on GitHub. This will then trigger the workflow to build and upload the package to PyPI. -This will trigger the CI to build the package and upload it to TestPyPI. In order to upload to PyPI, this can be done by publishing a new version on GitHub. This will trigger the workflow to build and upload the package to PyPI. +#. Once the release is published, it will go into a `staging` mode on Github Actions. Once the tests pass, admins can approve the release (an e-mail will be sent) and it will be published on PyPI. .. note:: diff --git a/Makefile b/Makefile index e6d7577..c2a336a 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ clean-test: ## remove test and coverage artifacts lint/flake8: ## check style with flake8 ruff xdatasets tests - flake8 --config=setup.cfg xdatasets tests + flake8 --config=.flake8 xdatasets tests lint/black: ## check style with black black --check xdatasets tests diff --git a/environment-dev.yml b/environment-dev.yml index 8a6ec38..4755795 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -22,7 +22,7 @@ dependencies: # Dev tools and testing - black >=23.11.0 - blackdoc >=0.3.9 - - bump2version >=1.0.1 + - bump-my-version >=0.12.0 - coverage >=6.2.0,<7.0.0 - coveralls >=3.3.1 - flake8 >=6.1.0 diff --git a/pyproject.toml b/pyproject.toml index 546e65b..fee2889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ dev = [ # Dev tools and testing "black[jupyter]>=23.11.0", "blackdoc>=0.3.9", - "bump2version>=1.0.1", + "bump-my-version>=0.12.0", "coverage", "coverage>=6.2.2,<7.0.0", "coveralls>=3.3.1", @@ -131,6 +131,30 @@ target-version = [ "py311" ] +[tool.bumpversion] +current_version = "0.3.0" +commit = true +tag = true +tag_name = "{new_version}" +allow_dirty = false +serialize = ["{major}.{minor}.{patch}"] +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" + +[[tool.bumpversion.files]] +filename = "xdatasets/__init__.py" +search = "__version__ = \"{current_version}\"" +replace = "__version__ = \"{new_version}\"" + +[[tool.bumpversion.files]] +filename = "tests/test_xdatasets.py" +search = "__version__ = \"{current_version}\"" +replace = "__version__ = \"{new_version}\"" + +[[tool.bumpversion.files]] +filename = ".cruft.json" +search = "\"version\": \"{current_version}\"" +replace = "\"version\": \"{new_version}\"" + [tool.coverage.run] relative_files = true include = ["xdatasets/*"] @@ -164,6 +188,7 @@ exclude = [ ".coveralls.yml", ".cruft.json", ".editorconfig", + ".flake8", ".gitignore", ".nojekyll", ".pre-commit-config.yaml", diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 7cb2d93..0000000 --- a/setup.cfg +++ /dev/null @@ -1,51 +0,0 @@ -[bumpversion] -current_version = 0.3.0 -commit = True -tag = True - -[bumpversion:file:xdatasets/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bumpversion:file:tests/test_xdatasets.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bumpversion:file:.cruft.json] -search = "version": "{current_version}", -replace = "version": "{new_version}", - -[flake8] -exclude = - .eggs, - .git, - build, - docs, - docs, - tests -max-line-length = 88 -max-complexity = 12 -ignore = - AZ100, - AZ200, - AZ300, - C, - D, - E, - F, - W503 -per-file-ignores = - tests/*:E402 -rst-roles = - doc, - mod, - py:attr, - py:attribute, - py:class, - py:const, - py:data, - py:func, - py:meth, - py:mod, - py:obj, - py:ref diff --git a/tox.ini b/tox.ini index afe2fa7..b963aae 100644 --- a/tox.ini +++ b/tox.ini @@ -52,6 +52,6 @@ commands_pre = pip list pip check commands = - pytest --cov + pytest --cov xdatasets # Coveralls requires access to a repo token set in .coveralls.yml in order to report stats coveralls: - coveralls