Skip to content

Commit

Permalink
switch to hatchling and hatch vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed Nov 25, 2024
1 parent 67c3bc2 commit ed7b1f8
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 38 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ htmlcov/
*.vmrk
*.eeg
*.vhdr
.ruff_cache
22 changes: 0 additions & 22 deletions MANIFEST.in

This file was deleted.

10 changes: 9 additions & 1 deletion pybv/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions pybv/io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""BrainVision writer."""

# Authors: pybv developers
# SPDX-License-Identifier: BSD-3-Clause

import copy
import datetime
import os
Expand Down
33 changes: 21 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools"]
build-backend = "hatchling.build"
requires = ["hatch-vcs", "hatchling"]

[project]
authors = [
Expand All @@ -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",
Expand All @@ -33,12 +31,11 @@ maintainers = [
{email = "[email protected]", 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",
Expand All @@ -48,7 +45,6 @@ docs = [
]
test = [
"build",
"check-manifest",
"matplotlib",
"mne",
"pre-commit",
Expand All @@ -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 = [
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/test_write_brainvision.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""BrainVision writer tests."""

# Authors: pybv developers
# SPDX-License-Identifier: BSD-3-Clause

import itertools
import os
import re
Expand Down

0 comments on commit ed7b1f8

Please sign in to comment.