Skip to content

Commit

Permalink
Use hatchling as build backend
Browse files Browse the repository at this point in the history
Also dynamically generate version number via hatch-vcs

Addresses mne-tools#1174
  • Loading branch information
hoechenberger committed Dec 7, 2023
1 parent e6ca823 commit fdbf6eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 3 additions & 1 deletion doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Detailed list of changes
🧐 API and behavior changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- nothing yet
- The package build backend has been switched from ``setuptools`` to ``hatchling``. This
only affects users who build and install MNE-BIDS from source, and should not lead to
changed runtime behavior, by `Richard Höchenberger`_ (:gh:`1204`)

🛠 Requirements
^^^^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion mne_bids/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
"""MNE software for easily interacting with BIDS compatible datasets."""

__version__ = "0.15.dev0"
try:
from importlib.metadata import version

__version__ = version("mne_bids")
except Exception:
__version__ = "0.0.0"

from mne_bids import commands
from mne_bids.report import make_report
from mne_bids.path import (
Expand Down
22 changes: 12 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "mne-bids"
Expand Down Expand Up @@ -40,6 +40,7 @@ classifiers = [
]
scripts = { mne_bids = "mne_bids.commands.run:main" }
dependencies = ["mne>=1.5", "numpy>=1.21.2", "scipy>=1.7.1"]

[project.optional-dependencies]
# Variants with dependencies that will get installed on top of those listed unter
# project.dependencies
Expand Down Expand Up @@ -80,7 +81,7 @@ doc = [
"mne-nirs @ https://github.com/mne-tools/mne-nirs/archive/refs/heads/main.zip",
"seaborn",
"openneuro-py",
"defusedxml", # for reading BrainVision montages: `examples/convert_eeg_to_bids.py`
"defusedxml", # for reading BrainVision montages: `examples/convert_eeg_to_bids.py`
]

# Dependencies for developer installations
Expand All @@ -94,14 +95,15 @@ dev = ["mne_bids[test,doc,full]", "pre-commit"]
"Forum" = "https://mne.discourse.group/"
"Source Code" = "https://github.com/mne-tools/mne-bids"

[tool.setuptools.packages.find]
where = ["."]
include = ["mne_bids"]
exclude = ["tests"]
namespaces = false
[tool.hatch.metadata]
allow-direct-references = true # allow specifying URLs in our dependencies

[tool.hatch.build]
exclude = ["tests/"]

[tool.setuptools.dynamic]
version = { attr = "mne_bids.__version__" }
[tool.hatch.version]
source = "vcs"
raw-options = { version_scheme = "release-branch-semver" }

[tool.ruff]
select = ["E", "F", "W", "D", "I"]
Expand Down

0 comments on commit fdbf6eb

Please sign in to comment.