Skip to content

Commit

Permalink
Replace versioneer with hatch (ME-ICA#35)
Browse files Browse the repository at this point in the history
* Update gitignore.

* Delete _version.py

* Adopt new packaging.

* Ignore the _version.py file.
  • Loading branch information
tsalo authored Mar 16, 2023
1 parent 8acf185 commit a2a30fa
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 2,478 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tedana/_version.py export-subst
.git_archival.txt export-subst

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# setuptools-scm
tedana/_version.py

.DS_Store
docs/generated/
.pytest_cache/
Expand Down
17 changes: 9 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.8"
jobs:
post_checkout:
- git fetch --unshallow

python:
version: 3.7
install:
- method: pip
path: .
Expand Down
124 changes: 118 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,98 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "tedana"
version = "0.0.12"
description = "TE-Dependent Analysis (tedana) of multi-echo functional magnetic resonance imaging (fMRI) data."
readme = "README.md"
authors = [{name = "tedana developers"}]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Information Analysis",
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
license = {file = "LICENSE"}
requires-python = ">=3.7"
dependencies = [
"bokeh<2.3.0",
"mapca>=0.0.3",
"matplotlib",
"nibabel>=2.5.1",
"nilearn>=0.7",
"numpy>=1.16",
"pandas>=0.24",
"scikit-learn>=0.21",
"scipy>=1.2.0",
"threadpoolctl",
"jinja2==3.0.1",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/ME-ICA/tedana"
Documentation = "https://www.tedana.readthedocs.io"
Paper = "https://joss.theoj.org/papers/10.21105/joss.03669"

[project.optional-dependencies]
doc = [
"sphinx>=1.5.3",
"sphinx_copybutton",
"sphinx_rtd_theme",
"sphinx-argparse",
"sphinxcontrib-bibtex",
]
tests = [
"codecov",
"coverage<5.0",
"flake8>=3.7",
"flake8-black",
"flake8-isort",
"pytest",
"pytest-cov",
"requests",
]

# Aliases
all = ["tedana[doc,tests]"]

[project.scripts]
tedana = "tedana.workflows.tedana:_main"
ica_reclassify = "tedana.workflows.ica_reclassify:_main"
t2smap = "tedana.workflows.t2smap:_main"
tedana = "tedana.workflows.tedana:_main"

[build-system]
requires = ["setuptools>=64", "wheel"]
#
# Hatch configurations
#

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.sdist]
exclude = [".git_archival.txt"] # No longer needed in sdist

[tool.hatch.build.targets.wheel]
packages = ["tedana"]
exclude = [
"tedana/tests/data", # Large test data directory
]

## The following two sections configure setuptools_scm in the hatch way

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "tedana/_version.py"

#
# Developer tool configurations
#

[tool.black]
line-length = 99
Expand All @@ -28,13 +112,41 @@ exclude = '''
| build
| dist
)/
| get_version.py
| versioneer.py
| tedana/_version.py
)
'''

[tool.isort]
profile = "black"
multi_line_output = 3

[tool.flake8]
max-line-length = 99
exclude = [
"*build/",
"tedana/_version.py",
]
ignore = ["E203", "E402", "W503"]
per-file-ignores = [
"*/__init__.py: F401",
]
docstring-convention = "numpy"

[tool.coverage.run]
branch = true
omit = [
"*/tests/*",
"*/__init__.py",
"*/conftest.py",
"tedana/_version.py",
]

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
'raise NotImplementedError',
'warnings\.warn',
]

[tool.pytest]
log_cli = true
90 changes: 0 additions & 90 deletions setup.cfg

This file was deleted.

18 changes: 18 additions & 0 deletions tedana/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Base module variables."""

try:
from tedana._version import __version__
except ImportError:
__version__ = "0+unknown"

__packagename__ = "tedana"
__copyright__ = "Copyright 2023, The ME-ICA Developers"
__credits__ = (
"Contributors: please check the ``.zenodo.json`` file at the top-level folder"
"of the repository"
)
__url__ = "https://github.com/ME-ICA/tedana"

DOWNLOAD_URL = f"https://github.com/ME-ICA/{__packagename__}/archive/{__version__}.tar.gz"
16 changes: 8 additions & 8 deletions tedana/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
tedana: A Python package for TE-dependent analysis of multi-echo data.
"""

"""tedana: A Python package for TE-dependent analysis of multi-echo data."""
import warnings

from ._version import get_versions

__version__ = get_versions()["version"]
from tedana.__about__ import __copyright__, __credits__, __packagename__, __version__

# cmp is not used, so ignore nipype-generated warnings
warnings.filterwarnings("ignore", r"cmp not installed")

del get_versions
__all__ = [
"__copyright__",
"__credits__",
"__packagename__",
"__version__",
]
Loading

0 comments on commit a2a30fa

Please sign in to comment.