From 3a6cf4ab60a6403f6b5fa977d4d2df8918fab058 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 11:18:26 -0400 Subject: [PATCH 01/10] MNT: Move most build metadata into pyproject.toml --- pyproject.toml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 44 ++++---------------------------------------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index defdd112..9ada047d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,56 @@ requires = [ ] build-backend = "setuptools.build_meta" +[project] +name = "nitime" +dynamic = ["version"] +description = "Nitime: timeseries analysis for neuroscience data" +readme = "README.txt" +license = { file = "LICENSE" } +requires-python = ">=3.7" +authors = [ + { name = "Nitime developers", email = "neuroimaging@python.org" }, +] +maintainers = [ + { name = "Nipy Developers", email = "neuroimaging@python.org" }, +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering", +] +dependencies = [ + "matplotlib", + "numpy", + "scipy", +] + +[project.optional-dependencies] +full = [ + "networkx", + "nibabel", +] + +[project.urls] +Download = "http://github.com/nipy/nitime/downloads" +Homepage = "http://nipy.org/nitime" + +[tool.setuptools.packages.find] +include = ["nitime*"] + +[tool.setuptools.package-data] +nitime = [ + "tests/*.txt", + "tests/*.npy", + "data/*.nii.gz", + "data/*.txt", + "data/*.csv", +] + [tool.cibuildwheel] # Disable CPython 3.6 here; if project.requires-python gets defined, # cp36* can be removed diff --git a/setup.py b/setup.py index 7935cb20..ba627651 100755 --- a/setup.py +++ b/setup.py @@ -2,50 +2,14 @@ """Setup file for the Python nitime package.""" import os -import sys +from runpy import run_path -# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly -# update it when the contents of directories change. -if os.path.exists('MANIFEST'): - os.remove('MANIFEST') - -from setuptools import find_packages, setup +from setuptools import setup # Get version and release info, which is all stored in nitime/version.py -ver_file = os.path.join('nitime', 'version.py') -with open(ver_file) as f: - exec(f.read()) - -REQUIRES = [] - -with open('requirements.txt') as f: - ll = f.readline()[:-1] - while ll: - REQUIRES.append(ll) - ll = f.readline()[:-1] - -PACKAGES = find_packages() - +VARS = run_path(os.path.join('nitime', 'version.py')) -opts = dict(name=NAME, - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - url=URL, - download_url=DOWNLOAD_URL, - license=LICENSE, - classifiers=CLASSIFIERS, - author=AUTHOR, - author_email=AUTHOR_EMAIL, - platforms=PLATFORMS, - version=VERSION, - packages=PACKAGES, - package_data=PACKAGE_DATA, - install_requires=REQUIRES, - requires=REQUIRES, - python_requires=PYTHON_REQUIRES, - ) +opts = {'version': VARS['__version__']} try: from setuptools import Extension From e6ef4daa221d386eed36bdd5e02724d4cea3a0f4 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 11:19:57 -0400 Subject: [PATCH 02/10] MNT: Remove everything but version from version.py --- nitime/version.py | 82 ----------------------------------------------- 1 file changed, 82 deletions(-) diff --git a/nitime/version.py b/nitime/version.py index 8c70331b..262975dd 100644 --- a/nitime/version.py +++ b/nitime/version.py @@ -15,85 +15,3 @@ _ver.append(_version_extra) __version__ = '.'.join(map(str, _ver)) - -CLASSIFIERS = ["Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Scientific/Engineering"] - -description = "Nitime: timeseries analysis for neuroscience data" - -# Note: this long_description is actually a copy/paste from the top-level -# README.txt, so that it shows up nicely on PyPI. So please remember to edit -# it only in one place and sync it correctly. -long_description = """ -=================================================== - Nitime: timeseries analysis for neuroscience data -=================================================== - -Nitime is library of tools and algorithms for the analysis of time-series data -from neuroscience experiments. It contains a implementation of numerical -algorithms for time-series analysis both in the time and spectral domains, a -set of container objects to represent time-series, and auxiliary objects that -expose a high level interface to the numerical machinery and make common -analysis tasks easy to express with compact and semantically clear code. - -Website and mailing list -======================== - -Current information can always be found at the nitime `website`_. Questions and -comments can be directed to the mailing `list`_. - -.. _website: http://nipy.org/nitime -.. _list: http://mail.scipy.org/mailman/listinfo/nipy-devel - -Code -==== - -You can find our sources and single-click downloads: - -* `Main repository`_ on Github. -* Documentation_ for all releases and current development tree. -* Download as a tar/zip file the `current trunk`_. -* Downloads of all `available releases`_. - -.. _main repository: http://github.com/nipy/nitime -.. _Documentation: http://nipy.org/nitime -.. _current trunk: http://github.com/nipy/nitime/archives/master -.. _available releases: http://github.com/nipy/nitime/downloads - - -License information -=================== - -Nitime is licensed under the terms of the new BSD license. See the file -"LICENSE" for information on the history of this software, terms & conditions -for usage, and a DISCLAIMER OF ALL WARRANTIES. - -All trademarks referenced herein are property of their respective holders. - -Copyright (c) 2006-2020, NIPY Developers -All rights reserved. -""" - -NAME = "nitime" -MAINTAINER = "Nipy Developers" -MAINTAINER_EMAIL = "neuroimaging@python.org" -DESCRIPTION = description -LONG_DESCRIPTION = long_description -URL = "http://nipy.org/nitime" -DOWNLOAD_URL = "http://github.com/nipy/nitime/downloads" -LICENSE = "Simplified BSD" -AUTHOR = "Nitime developers" -AUTHOR_EMAIL = "neuroimaging@python.org" -PLATFORMS = "OS Independent" -MAJOR = _version_major -MINOR = _version_minor -MICRO = _version_micro -VERSION = __version__ -PACKAGE_DATA = {"nitime": ["LICENSE", "tests/*.txt", "tests/*.npy", - "data/*.nii.gz", "data/*.txt", "data/*.csv"]} -PYTHON_REQUIRES = ">=3.7" From 395f3ffdf7aeb0ba72878d57ee47f8694edf356d Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 11:20:23 -0400 Subject: [PATCH 03/10] MNT: requires-python is defined, simplify cibuildwheel config --- pyproject.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9ada047d..201332a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,9 +61,8 @@ nitime = [ ] [tool.cibuildwheel] -# Disable CPython 3.6 here; if project.requires-python gets defined, -# cp36* can be removed -skip = "pp* cp36*" +# Disable PyPy +skip = "pp*" # 64-bit builds only; 32-bit builds seem pretty niche these days, so # don't bother unless someone asks From a3119cf0c5284416003fd857bb05e1cace8eb244 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:11:54 -0400 Subject: [PATCH 04/10] MNT: Switch to setuptools_scm --- .git_archival.txt | 4 ++++ .gitattributes | 1 + nitime/__init__.py | 2 +- nitime/version.py | 17 ----------------- pyproject.toml | 4 ++++ setup.py | 23 ++++++++++------------- 6 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 .git_archival.txt create mode 100644 .gitattributes delete mode 100644 nitime/version.py diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 00000000..8fb235d7 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..00a7b00c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst diff --git a/nitime/__init__.py b/nitime/__init__.py index c44f48c8..429060b0 100644 --- a/nitime/__init__.py +++ b/nitime/__init__.py @@ -21,7 +21,7 @@ __docformat__ = 'restructuredtext' -from .version import __version__ +from ._version import __version__ from . import algorithms from . import timeseries diff --git a/nitime/version.py b/nitime/version.py deleted file mode 100644 index 262975dd..00000000 --- a/nitime/version.py +++ /dev/null @@ -1,17 +0,0 @@ -"""nitime version/release information""" - -# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" -_version_major = 0 -_version_minor = 11 -_version_micro = '' # use '' for first of series, number for 1 and above -_version_extra = 'dev' -# _version_extra = '' # Uncomment this for full releases - -# Construct full version string from these. -_ver = [_version_major, _version_minor] -if _version_micro: - _ver.append(_version_micro) -if _version_extra: - _ver.append(_version_extra) - -__version__ = '.'.join(map(str, _ver)) diff --git a/pyproject.toml b/pyproject.toml index 201332a6..5f9ac117 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ "setuptools", + "setuptools_scm[toml]>=6.2", "cython", # Newer than NEP29-minimum: compile against oldest numpy available "numpy==1.24; python_version >= '3.11'", @@ -60,6 +61,9 @@ nitime = [ "data/*.csv", ] +[tool.setuptools_scm] +write_to = "nitime/_version.py" + [tool.cibuildwheel] # Disable PyPy skip = "pp*" diff --git a/setup.py b/setup.py index ba627651..43ca22db 100755 --- a/setup.py +++ b/setup.py @@ -1,27 +1,24 @@ #!/usr/bin/env python """Setup file for the Python nitime package.""" - -import os -from runpy import run_path - from setuptools import setup -# Get version and release info, which is all stored in nitime/version.py -VARS = run_path(os.path.join('nitime', 'version.py')) - -opts = {'version': VARS['__version__']} - try: from setuptools import Extension from Cython.Build import cythonize from numpy import get_include + # add Cython extensions to the setup options - exts = [Extension('nitime._utils', ['nitime/_utils.pyx'], - include_dirs=[get_include()])] - opts['ext_modules'] = cythonize(exts, language_level='3') + exts = [ + Extension( + 'nitime._utils', + ['nitime/_utils.pyx'], + include_dirs=[get_include()], + ) + ] + opts = {'ext_modules': cythonize(exts, language_level='3')} except ImportError: # no loop for you! - pass + opts = {} # Now call the actual setup function if __name__ == '__main__': From 29308eac822b11f87f15e2160f0a262953d47d53 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:14:48 -0400 Subject: [PATCH 05/10] MNT: Rely on setuptools_scm to find package data files --- MANIFEST.in | 18 ------------------ pyproject.toml | 9 --------- 2 files changed, 27 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4911aa34..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,18 +0,0 @@ -include *.txt *.py -include THANKS -include LICENSE -include INSTALL - -graft nitime -graft doc -graft tools - -# docs subdirs we want to skip -prune doc/_build -prune doc/api/generated - -global-exclude *~ -global-exclude *.flc -global-exclude *.pyc -global-exclude .dircopy.log -global-exclude .git diff --git a/pyproject.toml b/pyproject.toml index 5f9ac117..7db5618b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,15 +52,6 @@ Homepage = "http://nipy.org/nitime" [tool.setuptools.packages.find] include = ["nitime*"] -[tool.setuptools.package-data] -nitime = [ - "tests/*.txt", - "tests/*.npy", - "data/*.nii.gz", - "data/*.txt", - "data/*.csv", -] - [tool.setuptools_scm] write_to = "nitime/_version.py" From 965ee0042510cde499f65728fa3bbd89b15f974e Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:17:24 -0400 Subject: [PATCH 06/10] MNT: Update .gitignore --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index c89e3bb3..19f336c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,16 @@ +# Compiled python files *.pyc + +# Editor swap files *~ +.*.swp +# Build artifacts *.so *.c +*.egg-info/ build/ +dist/ + +# setuptools_scm +nitime/_version.py From a16f8c7448a318457598ebd5b62c2da3b5b9c924 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:22:56 -0400 Subject: [PATCH 07/10] BLD: Drop deprecated Numpy API --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 43ca22db..d373a69b 100755 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ 'nitime._utils', ['nitime/_utils.pyx'], include_dirs=[get_include()], + define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')], ) ] opts = {'ext_modules': cythonize(exts, language_level='3')} From 9157f2679894db34a4fba4f6773911646cbc1342 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:24:11 -0400 Subject: [PATCH 08/10] MNT: Remove setup_egg.py --- setup_egg.py | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 setup_egg.py diff --git a/setup_egg.py b/setup_egg.py deleted file mode 100644 index 6d5d631f..00000000 --- a/setup_egg.py +++ /dev/null @@ -1,2 +0,0 @@ -from setuptools import setup -execfile('setup.py') From 7213babc0ee9f39a470fd9a03e51fa89f251e9e0 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:25:26 -0400 Subject: [PATCH 09/10] MNT: Add reference to pyproject.toml in setup.py docstring --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d373a69b..3974b51f 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,9 @@ #!/usr/bin/env python -"""Setup file for the Python nitime package.""" +"""Setup file for the Python nitime package. + +This file only contains cython components. +See pyproject.toml for the remaining configuration. +""" from setuptools import setup try: From f30a4db0747b5a84133b0557398895dcf91c83d9 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Jun 2023 13:26:19 -0400 Subject: [PATCH 10/10] CI: Fetch history [build wheels] --- .github/workflows/wheels.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f362d080..5c64b33b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -40,6 +40,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Build sdist run: pipx run build -s - uses: actions/upload-artifact@v3 @@ -66,6 +68,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Build wheel(s) run: pipx run cibuildwheel