Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hatchling as build backend #12269

Merged
merged 6 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions MANIFEST.in

This file was deleted.

5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ clean-cache:
clean: clean-build clean-pyc clean-so clean-ctags clean-cache

wheel:
$(PYTHON) -m build
$(PYTHON) -m build -w

sample_data:
@python -c "import mne; mne.datasets.sample.data_path(verbose=True);"
Expand Down Expand Up @@ -54,9 +54,6 @@ pep: pre-commit
codespell: # running manually
@codespell --builtin clear,rare,informal,names,usage -w -i 3 -q 3 -S $(CODESPELL_SKIPS) --ignore-words=ignore_words.txt --uri-ignore-words-list=bu $(CODESPELL_DIRS)

check-manifest:
check-manifest -q --ignore .circleci/config.yml,doc,logo,mne/io/*/tests/data*,mne/io/tests/data,mne/preprocessing/tests/data,.DS_Store,.git_archival.txt

check-readme: clean wheel
twine check dist/*

Expand Down
4 changes: 0 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ stages:
make nesting
displayName: make nesting
condition: always()
- bash: |
make check-manifest
displayName: make check-manifest
condition: always()
- bash: |
make check-readme
displayName: make check-readme
Expand Down
1 change: 1 addition & 0 deletions doc/changes/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Enhancements
- Inform the user about channel discrepancy between provided info, forward operator, and/or covariance matrices in :func:`mne.beamformer.make_lcmv` (:gh:`12238` by :newcontrib:`Nikolai Kapralov`)
- We added type hints for the return values of :func:`mne.read_evokeds` and :func:`mne.io.read_raw`. Development environments like VS Code or PyCharm will now provide more help when using these functions in your code. (:gh:`12250` by `Richard Höchenberger`_ and `Eric Larson`_)
- Add ``method="polyphase"`` to :meth:`mne.io.Raw.resample` and related functions to allow resampling using :func:`scipy.signal.upfirdn` (:gh:`12268` by `Eric Larson`_)
- The package build backend was switched from ``setuptools`` to ``hatchling``. This will only affect users who build and install MNE-Python from source. (:gh:`12269` by `Richard Höchenberger`_)

Bugs
~~~~
Expand Down
71 changes: 26 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "mne"
description = "MNE-Python project for MEG and EEG data analysis."
Expand Down Expand Up @@ -112,7 +116,6 @@ test = [
"ruff",
"numpydoc",
"codespell",
"check-manifest",
"tomli; python_version<'3.11'",
"twine",
"wheel",
Expand Down Expand Up @@ -168,52 +171,30 @@ Documentation = "https://mne.tools/"
Forum = "https://mne.discourse.group/"
"Source Code" = "https://github.com/mne-tools/mne-python/"

[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["."]
include = ["mne*"]
namespaces = false

[tool.setuptools_scm]
version_scheme = "release-branch-semver"

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
"mne" = [
"data/eegbci_checksums.txt",
"data/*.sel",
"data/icos.fif.gz",
"data/coil_def*.dat",
"data/helmets/*.fif.gz",
"data/FreeSurferColorLUT.txt",
"data/image/*gif",
"data/image/*lout",
"data/fsaverage/*.fif",
"channels/data/layouts/*.lout",
"channels/data/layouts/*.lay",
"channels/data/montages/*.sfp",
"channels/data/montages/*.txt",
"channels/data/montages/*.elc",
"channels/data/neighbors/*.mat",
"datasets/sleep_physionet/SHA1SUMS",
"datasets/_fsaverage/*.txt",
"datasets/_infant/*.txt",
"datasets/_phantom/*.txt",
"html/*.js",
"html/*.css",
"html_templates/repr/*.jinja",
"html_templates/report/*.jinja",
"icons/*.svg",
"icons/*.png",
"io/artemis123/resources/*.csv",
"io/edf/gdf_encodes.txt",
[tool.hatch.build]
exclude = [
"/.*",
Copy link
Member

@drammock drammock Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it excludes all files at the root level of the repo; if that's right I don't see why we're explicitly excluding things like /Makefile etc below. Am I misinterpreting /.* here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the same syntax as gitignore and matches any entry at the root that starts with a period

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I would recommend using inclusion overall rather than exclusion to account for new stuff in future

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the same syntax as gitignore and matches any entry at the root that starts with a period

ah right, like glob not regex.

Copy link
Member Author

@hoechenberger hoechenberger Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~everything that's tracked in the VCS (git) is included by default, hence I picked the exclusion-based approach to exclude what's tracked in git, but shouldn't be packaged

Do you think that's not a good idea, @ofek?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfectly valid but my personal preference for source distributions is to only ship the project and test directories. Totally up to you!

"/*.yml",
"/*.yaml",
"/*.toml",
"/*.txt",
"/mne/**/tests",
"/logo",
"/doc",
"/tools",
"/tutorials",
"/examples",
"/CITATION.cff",
"/codemeta.json",
"/ignore_words.txt",
"/Makefile",
"/CONTRIBUTING.md",
]

[tool.hatch.version]
source = "vcs"
raw-options = { version_scheme = "release-branch-semver" }

[tool.codespell]
ignore-words = "ignore_words.txt"
builtin = "clear,rare,informal,names,usage"
Expand Down