From ed7b1f89820172b745a8100d9e1785552b881b0c Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Mon, 25 Nov 2024 21:14:01 +0100 Subject: [PATCH] switch to hatchling and hatch vcs --- .github/CONTRIBUTING.md | 1 + .github/workflows/python_build.yml | 2 +- .github/workflows/python_tests.yml | 1 - .github/workflows/release.yml | 2 +- .gitignore | 1 + MANIFEST.in | 22 -------------------- pybv/__init__.py | 10 ++++++++- pybv/io.py | 3 +++ pyproject.toml | 33 +++++++++++++++++++----------- tests/test_write_brainvision.py | 3 +++ 10 files changed, 40 insertions(+), 38 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5f55764..1560482 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -54,6 +54,7 @@ Credentials for Read the Docs are currently held by: ## Info about versioning We follow a [semantic versioning scheme](https://semver.org/). +This is implemented via [hatch-vcs](https://github.com/ofek/hatch-vcs). ## Making a release on GitHub, PyPi, and Conda-Forge diff --git a/.github/workflows/python_build.yml b/.github/workflows/python_build.yml index e2de531..1ad5795 100644 --- a/.github/workflows/python_build.yml +++ b/.github/workflows/python_build.yml @@ -32,7 +32,7 @@ jobs: - name: Update pip etc. run: | python -m pip install --upgrade pip - python -m pip install --upgrade setuptools wheel build twine + python -m pip install --upgrade build twine - uses: actions/checkout@v4 with: diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index ee34557..da6b60f 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -71,7 +71,6 @@ jobs: - name: Check formatting if: matrix.platform == 'ubuntu-latest' run: | - check-manifest pre-commit run --all-files - name: Test with pytest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6674117..18d302d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade setuptools wheel build twine + python -m pip install --upgrade build twine - run: python -m build --sdist --wheel - run: twine check --strict dist/* - uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index b85e76b..15fedcd 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ htmlcov/ *.vmrk *.eeg *.vhdr +.ruff_cache diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 76b277f..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,22 +0,0 @@ -include MANIFEST.in -include README.rst -include LICENSE -include CITATION.cff -include .mailmap - -graft docs -graft pybv -graft specification - -recursive-exclude pybv/__pycache__ * -recursive-exclude pybv/tests/__pycache__ * -recursive-exclude docs/_build * -recursive-exclude docs/generated * -recursive-exclude .github * -recursive-exclude specification * - -exclude .readthedocs.yaml -exclude .git-blame-ignore-revs -exclude .pre-commit-config.yaml -exclude .gitignore -global-exclude *.pyc diff --git a/pybv/__init__.py b/pybv/__init__.py index 22ee46a..1b95daf 100644 --- a/pybv/__init__.py +++ b/pybv/__init__.py @@ -1,7 +1,15 @@ """A lightweight I/O utility for the BrainVision data format.""" -__version__ = "0.8.0.dev5" +# Authors: pybv developers +# SPDX-License-Identifier: BSD-3-Clause from .io import write_brainvision __all__ = ["write_brainvision"] + +try: + from importlib.metadata import version + + __version__ = version("pybv") +except Exception: + __version__ = "0.0.0" diff --git a/pybv/io.py b/pybv/io.py index 800bb59..199ff67 100644 --- a/pybv/io.py +++ b/pybv/io.py @@ -1,5 +1,8 @@ """BrainVision writer.""" +# Authors: pybv developers +# SPDX-License-Identifier: BSD-3-Clause + import copy import datetime import os diff --git a/pyproject.toml b/pyproject.toml index 25418fd..3b479dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -build-backend = "setuptools.build_meta" -requires = ["setuptools"] +build-backend = "hatchling.build" +requires = ["hatch-vcs", "hatchling"] [project] authors = [ @@ -19,8 +19,6 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python", "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering", - "Topic :: Software Development", ] dependencies = [ "numpy >= 1.18.1", @@ -33,12 +31,11 @@ maintainers = [ {email = "stefan.appelhoff@mailbox.org", name = "Stefan Appelhoff"}, ] name = "pybv" -readme = "README.rst" +readme = {content-type = "text/x-rst", file = "README.rst"} requires-python = ">=3.9" [project.optional-dependencies] dev = ["ipykernel", "ipython", "pybv[test,docs]"] -# Dependencies for developer installations docs = [ "intersphinx_registry", "matplotlib", @@ -48,7 +45,6 @@ docs = [ ] test = [ "build", - "check-manifest", "matplotlib", "mne", "pre-commit", @@ -71,6 +67,22 @@ exclude_lines = ["if 0:", "if __name__ == .__main__.:", "pragma: no cover"] [tool.coverage.run] omit = ["*tests*"] +[tool.hatch.build] +exclude = [ + "/.*", + "/.github/**", + "/docs", + "/specification", + "tests/**", +] + +[tool.hatch.metadata] +allow-direct-references = true # allow specifying URLs in our dependencies + +[tool.hatch.version] +raw-options = {version_scheme = "release-branch-semver"} +source = "vcs" + [tool.pytest.ini_options] addopts = """. --doctest-modules --cov=pybv/ --cov-report=xml --cov-config=pyproject.toml --verbose -s""" filterwarnings = [ @@ -80,11 +92,8 @@ filterwarnings = [ ignore = ["D203", "D213"] select = ["A", "B006", "D", "E", "F", "I", "UP", "W"] -[tool.setuptools.dynamic] -version = {attr = "pybv.__version__"} - -[tool.setuptools.packages.find] -exclude = ["docs", "specification"] +[tool.ruff.lint.pydocstyle] +convention = "numpy" [tool.tomlsort] all = true diff --git a/tests/test_write_brainvision.py b/tests/test_write_brainvision.py index cd93fc6..9ef03f5 100644 --- a/tests/test_write_brainvision.py +++ b/tests/test_write_brainvision.py @@ -1,5 +1,8 @@ """BrainVision writer tests.""" +# Authors: pybv developers +# SPDX-License-Identifier: BSD-3-Clause + import itertools import os import re