From f407de8d00702f0d7abfc3f39ec62c9808b43f65 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 9 Nov 2023 21:52:39 +0000 Subject: [PATCH 1/8] Remove setup.py information from info.py Shift away from info.py as source of setup information. --- README.rst | 3 - doc/devel/guidelines/make_release.rst | 62 ++-------- nipy/__init__.py | 16 +-- nipy/info.py | 170 +------------------------- pyproject.toml | 77 +++++++++++- requirements.txt | 2 +- tools/refresh_readme.py | 34 ------ 7 files changed, 92 insertions(+), 272 deletions(-) delete mode 100755 tools/refresh_readme.py diff --git a/README.rst b/README.rst index 043b94cd7..d56acf9d5 100644 --- a/README.rst +++ b/README.rst @@ -4,9 +4,6 @@ .. image:: https://codecov.io/gh/nipy/nipy/branch/main/graph/badge.svg :target: https://app.codecov.io/gh/nipy/nipy/branch/main -.. Following contents should be from LONG_DESCRIPTION in nipy/info.py - - ==== NIPY ==== diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index b1f41fb11..a9e1a6e86 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -6,29 +6,6 @@ A guide to making a nipy release A guide for developers who are doing a nipy release -.. _release-tools: - -Release tools -============= - -Run:: - - make check-version-info - -This installs the code from a git archive, from the repository, and for -in-place use, and runs the ``get_info()`` function to confirm that -installation is working and information parameters are set correctly. Look for the output at the end, which should look something like:: - - ######## - Versions - ######## - - nipy - zip: 0.5.0 - nipy - install: 0.5.0 - nipy - editable: 0.5.0 - -where the `0.5.0` should be the version in `nipy/info.py`. - .. _release-checklist: Release checklist @@ -56,20 +33,16 @@ Release checklist * Check the copyright years in ``doc/conf.py`` and ``LICENSE`` -* Refresh the ``README.rst`` text from the ``LONG_DESCRIPTION`` in ``info.py`` - by running ``make refresh-readme``. - - Check the output of:: +* Check the output of:: rst2html.py README.rst > ~/tmp/readme.html because this will be the output used by PyPI_ -* Check the dependencies listed in ``nipy/info.py`` (e.g. - ``NUMPY_MIN_VERSION``) and in ``requirements.txt`` and in - ``doc/users/installation.rst``. They should at least match. Do they still - hold? Make sure ``.travis.yml`` is testing these minimum dependencies - specifically. +* Check the dependencies listed in ``pyproject.toml`` and in + ``requirements.txt`` and in ``doc/users/installation.rst``. They should at + least match. Do they still hold? Make sure ``.travis.yml`` is testing these + minimum dependencies specifically. * Check the examples in python 2 and python 3, by running something like:: @@ -131,17 +104,15 @@ Doing the release * The release should now be ready. -* Edit :file:`nipy/info.py` to set ``_version_extra`` to ``''``; commit. +* Edit :file:`nipy/__init__.py` to set ``version`` to e.g. ``0.5.2``; commit. Then:: make source-release * For the wheel build / upload, follow the `wheel builder README`_ - instructions again. Edit the ``.travis.yml`` and ``appveyor.yml`` files (if - present) to give the release tag to build. Check the build has passed on - the Travis-CI interface at https://travis-ci.org/MacPython/nipy-wheels. Now - follow the instructions in the page above to download the built wheels to a - local machine and upload to PyPI. + instructions again. Push. Check the build has passed on the Github + interface. Now follow the instructions in the page above to download the + built wheels to a local machine and upload to PyPI. * Once everything looks good, you are ready to upload the source release to PyPI. See `setuptools intro`_. Make sure you have a file ``\$HOME/.pypirc``, @@ -174,23 +145,12 @@ Doing the release further substantial development (often called 'trunk') and another for maintenance releases. - * Branch to maintenance:: - - git co -b maint/0.5.x - - Set ``_version_extra`` back to ``.dev1`` and bump ``_version_micro`` by - 1. Thus the maintenance series will have version numbers like - say - - '0.5.1.dev1' until the next maintenance release - say '0.5.1'. - Commit. Don't forget to push upstream with something like:: - - git push upstream maint/0.2.x --set-upstream - * Start next development series:: git co main-master - then restore ``.dev`` to ``_version_extra``, and bump - ``_version_minor`` by 1. Thus the development series ('trunk') will + then restore ``.dev`` to ``__version__``, and bump + the minor version by 1. Thus the development series ('trunk') will have a version number here of '0.3.0.dev' and the next full release will be '0.3.0'. diff --git a/nipy/__init__.py b/nipy/__init__.py index abe3d0707..9cee0a98a 100644 --- a/nipy/__init__.py +++ b/nipy/__init__.py @@ -1,10 +1,11 @@ +""" Nipy + +Nipy is a library for neuroimaging analysis. +""" import os -from .info import LONG_DESCRIPTION as __doc__ -from .info import STATUS as __status__ -from .info import URL as __url__ -from .info import __version__ +__version__ = "0.5.1.dev1" def _test_local_install(): @@ -32,10 +33,3 @@ def _test_local_install(): # Cleanup namespace del _test_local_install -# If this file is exec after being imported, the following lines will -# fail -try: - del version - del Tester -except: - pass diff --git a/nipy/info.py b/nipy/info.py index edf9e5d57..43b0343d7 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -1,172 +1,8 @@ -""" This file contains defines parameters for nipy that we use to fill -settings in setup.py, the nipy top-level docstring, and for building the -docs. In setup.py in particular, we exec this file, so it cannot import nipy +""" Data package information """ -# nipy version information. An empty _version_extra corresponds to a -# full release. '.devN' as a _version_extra string means this is a development -# version -# See: https://www.python.org/dev/peps/pep-0440 -_version_major = 0 -_version_minor = 5 -_version_micro = 1 -_version_extra = '.dev1' # For development -# _version_extra = 'rc1' # For release candidate -# _version_extra = '' # For release - -# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" -__version__ = f"{_version_major}.{_version_minor}.{_version_micro}{_version_extra}" - -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 = 'A python package for analysis of neuroimaging data' - -# Note: this long_description is the canonical place to edit this text. -# It also appears in README.rst, but it should get there by running -# ``tools/refresh_readme.py`` which pulls in this version. -long_description = \ -""" -==== -NIPY -==== - -Neuroimaging tools for Python. - -The aim of NIPY is to produce a platform-independent Python environment for -the analysis of functional brain imaging data using an open development model. - -In NIPY we aim to: - -1. Provide an open source, mixed language scientific programming environment - suitable for rapid development. - -2. Create software components in this environment to make it easy to develop - tools for MRI, EEG, PET and other modalities. - -3. Create and maintain a wide base of developers to contribute to this - platform. - -4. To maintain and develop this framework as a single, easily installable - bundle. - -NIPY is the work of many people. We list the main authors in the file -``AUTHOR`` in the NIPY distribution, and other contributions in ``THANKS``. - -Website -======= - -Current information can always be found at the `NIPY project website -`_. - -Mailing Lists -============= - -For questions on how to use nipy or on making code contributions, please see -the ``neuroimaging`` mailing list: - - https://mail.python.org/mailman/listinfo/neuroimaging - -Please report bugs at github issues: - - https://github.com/nipy/nipy/issues - -You can see the list of current proposed changes at: - - https://github.com/nipy/nipy/pulls - -Code -==== - -You can find our sources and single-click downloads: - -* `Main repository`_ on Github; -* Documentation_ for all releases and current development tree; -* Download the `current development version`_ as a tar/zip file; -* Downloads of all `available releases`_. - -.. _main repository: https://github.com/nipy/nipy -.. _Documentation: http://nipy.org/nipy -.. _current development version: https://github.com/nipy/nipy/archive/main.zip -.. _available releases: http://pypi.python.org/pypi/nipy - -Tests -===== - -To run nipy's tests, you will need to install the pytest_ Python testing -package:: - - pip install pytest - -Then:: - - pytest nipy - -You can run the doctests along with the other tests with:: - - pip install pytest-doctestplus - -Then:: - - pytest --doctest-plus nipy - -Installation -============ - -See the latest `installation instructions`_. - -License -======= - -We use the 3-clause BSD license; the full license is in the file ``LICENSE`` in -the nipy distribution. - -.. links: -.. _python: http://python.org -.. _numpy: http://numpy.org -.. _scipy: http://scipy.org -.. _sympy: http://sympy.org -.. _nibabel: http://nipy.org/nibabel -.. _ipython: http://ipython.org -.. _matplotlib: http://matplotlib.org -.. _pytest: http://pytest.org -.. _installation instructions: http://nipy.org/nipy/users/installation.html -""" - -# minimum versions -# Update in readme text above -# Update in requirements.txt -NUMPY_MIN_VERSION='1.22' -SCIPY_MIN_VERSION = '1.8' -NIBABEL_MIN_VERSION = '4.0' -SYMPY_MIN_VERSION = '1.9' -MAYAVI_MIN_VERSION = '4.7' -CYTHON_MIN_VERSION = '0.12.1' - -NAME = 'nipy' -MAINTAINER = "nipy developers" -MAINTAINER_EMAIL = "neuroimaging@python.org" -DESCRIPTION = description -LONG_DESCRIPTION = long_description -URL = "http://nipy.org/nipy" -DOWNLOAD_URL = "http://github.com/nipy/nipy/archives/main" -LICENSE = "BSD license" -CLASSIFIERS = CLASSIFIERS -AUTHOR = "nipy developmers" -AUTHOR_EMAIL = "neuroimaging@python.org" -PLATFORMS = "OS Independent" -MAJOR = _version_major -MINOR = _version_minor -MICRO = _version_micro -ISRELEASE = _version_extra == '' -VERSION = __version__ -REQUIRES = ["numpy", "scipy", "sympy", "nibabel"] -STATUS = 'beta' +# For compatibility +from . import __version__ # Versions and locations of optional data packages NIPY_DATA_URL= 'http://nipy.org/data-packages/' diff --git a/pyproject.toml b/pyproject.toml index 7d5d3b805..138c476f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,79 @@ +[project] +name = "nipy" +dynamic = ['version'] +license = {file = "LICENSE"} +description = 'A python package for analysis of neuroimaging data' +readme = 'README.rst' +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 = [ + 'numpy>=1.22', + 'scipy>=1.8', + 'nibabel>=3.2', + 'sympy>=1.9', + 'transforms3d' +] + +[[project.maintainers]] +name = 'nipy developers' +email = 'neuroimaging@python.org' + +[project.urls] +homepage = 'https://nipy.org/nipy' +documentation = 'https://scikit-image.org/docs/stable' +source = 'https://github.com/nipy/nipy' +download = 'https://pypi.org/project/nipy/#files' +tracker = 'https://github.com/nipy/nipy/issues' + +[project.optional-dependencies] +build = [ + 'meson-python>=0.13', + 'wheel', + 'setuptools>=67', + 'ninja', + 'Cython>=3', + 'numpy>=1.22', + 'spin==0.3', + 'build', +] +default = [ + 'numpy>=1.22', + 'scipy>=1.8', + 'nibabel>=3.2', + 'sympy>=1.9', + 'transforms3d' +] +developer = [ + 'pre-commit', + 'rtoml', +] +docs = [ + 'sphinx>=7.0', + 'numpydoc>=1.6.0', + 'matplotlib', + 'texext', + 'ipython' +] +optional = [ + 'matplotlib>=3', +] +test = [ + 'matplotlib>=3', + 'pytest>=7.2', + 'pytest-cov>=4.0', + 'pytest-doctestplus' +] + [build-system] build-backend = "mesonpy" requires = [ "meson-python>=0.13", + "ninja", "setuptools", "cython>=3", # Newer than NEP29-minimum: compile against oldest numpy available @@ -10,11 +82,6 @@ requires = [ "numpy==1.22; python_version >= '3.7' and python_version < '3.9'", ] -[project] -name = "nipy" -version = "0.5.1.dev1" -license = {file = "LICENSE"} - [project.scripts] nipy_3dto4d = 'nipy.cli.img3dto4d:main' nipy_4dto3d = 'nipy.cli.img4dto3d:main' diff --git a/requirements.txt b/requirements.txt index bd7c23612..9db11ae52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# See nipy/info.py for requirement definitions +# See pyproject.toml for requirement definitions numpy>=1.22 scipy>=1.8 sympy>=1.9 diff --git a/tools/refresh_readme.py b/tools/refresh_readme.py deleted file mode 100755 index dbbf2b59b..000000000 --- a/tools/refresh_readme.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -""" Refresh README.rst file from long description - -Should be run from project root (containing setup.py) -""" - -import os -import sys - - -def main(): - project_name = sys.argv[1] - readme_lines = [] - with open('README.rst') as fobj: - for line in fobj: - readme_lines.append(line) - if line.startswith('.. Following contents should be'): - break - else: - raise ValueError('Expected comment not found') - - rel = {} - with open(os.path.join(project_name, 'info.py')) as fobj: - exec(fobj.read(), {}, rel) - - readme = ''.join(readme_lines) + '\n' + rel['LONG_DESCRIPTION'] - - with open('README.rst', "w") as fobj: - fobj.write(readme) - - print('Done') - -if __name__ == '__main__': - main() From ee349e878e4c7d54926f9402c00eb13a9cdf04eb Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 11:42:05 +0000 Subject: [PATCH 2/8] Allow older numpy for Python >=3.9 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 138c476f9..b2476b4f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ requires = [ "setuptools", "cython>=3", # Newer than NEP29-minimum: compile against oldest numpy available - "numpy>=1.25; python_version > '3.8'", + "numpy>=1.22; python_version > '3.8'", # NEP29-minimum as of Sep 21, 2023 "numpy==1.22; python_version >= '3.7' and python_version < '3.9'", ] From b4ace6ab64f760c7e8beeab602655d3331abf9ff Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 11:57:57 +0000 Subject: [PATCH 3/8] Fix documentation URL --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b2476b4f9..768a03565 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ email = 'neuroimaging@python.org' [project.urls] homepage = 'https://nipy.org/nipy' -documentation = 'https://scikit-image.org/docs/stable' +documentation = 'http://nipy.org/nipy/documentation.html' source = 'https://github.com/nipy/nipy' download = 'https://pypi.org/project/nipy/#files' tracker = 'https://github.com/nipy/nipy/issues' From 1c922fe3915155444f2663d9af7200bfe93a2ae2 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 14:09:57 +0000 Subject: [PATCH 4/8] Update pyproject.toml Co-authored-by: Chris Markiewicz --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 768a03565..d199e49bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,11 +24,11 @@ name = 'nipy developers' email = 'neuroimaging@python.org' [project.urls] -homepage = 'https://nipy.org/nipy' -documentation = 'http://nipy.org/nipy/documentation.html' -source = 'https://github.com/nipy/nipy' -download = 'https://pypi.org/project/nipy/#files' -tracker = 'https://github.com/nipy/nipy/issues' +Homepage = 'https://nipy.org/nipy' +Documentation = 'http://nipy.org/nipy/documentation.html' +Source = 'https://github.com/nipy/nipy' +Download = 'https://pypi.org/project/nipy/#files' +Tracker = 'https://github.com/nipy/nipy/issues' [project.optional-dependencies] build = [ From 23bfef52ccbe49cdc6f057828bf6e76e5624a8cb Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 14:48:16 +0000 Subject: [PATCH 5/8] Revert "Allow older numpy for Python >=3.9" This reverts commit ee349e878e4c7d54926f9402c00eb13a9cdf04eb, and adds some comments. --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d199e49bd..b7b3d10ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,8 +76,10 @@ requires = [ "ninja", "setuptools", "cython>=3", - # Newer than NEP29-minimum: compile against oldest numpy available - "numpy>=1.22; python_version > '3.8'", + # From Numpy 1.25, Numpy is always backwards compatible for any given Python + # version. See: + # https://numpy.org/doc/stable/release/1.25.0-notes.html#compiling-against-the-numpy-c-api-is-now-backwards-compatible-by-default + "numpy>=1.25; python_version > '3.8'", # NEP29-minimum as of Sep 21, 2023 "numpy==1.22; python_version >= '3.7' and python_version < '3.9'", ] From 8f513d72d627dc9b617e65afb23f95a0ff907589 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 20:05:19 +0000 Subject: [PATCH 6/8] Try dropping ninja --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b7b3d10ac..c9ef02da4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,6 @@ test = [ build-backend = "mesonpy" requires = [ "meson-python>=0.13", - "ninja", "setuptools", "cython>=3", # From Numpy 1.25, Numpy is always backwards compatible for any given Python From 053fd4764b26c401f81b5a19063bcb61889c3b65 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 21:34:44 +0000 Subject: [PATCH 7/8] Add back ninja after discussion https://github.com/nipy/nipy/pull/551#issuecomment-1806459891 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index c9ef02da4..b7b3d10ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,6 +73,7 @@ test = [ build-backend = "mesonpy" requires = [ "meson-python>=0.13", + "ninja", "setuptools", "cython>=3", # From Numpy 1.25, Numpy is always backwards compatible for any given Python From adfaf66957cbbca4c1ec7053ffba779934076fd5 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 10 Nov 2023 23:10:32 +0000 Subject: [PATCH 8/8] Delete build and default sections of optional deps --- pyproject.toml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b7b3d10ac..53c110c70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,23 +31,6 @@ Download = 'https://pypi.org/project/nipy/#files' Tracker = 'https://github.com/nipy/nipy/issues' [project.optional-dependencies] -build = [ - 'meson-python>=0.13', - 'wheel', - 'setuptools>=67', - 'ninja', - 'Cython>=3', - 'numpy>=1.22', - 'spin==0.3', - 'build', -] -default = [ - 'numpy>=1.22', - 'scipy>=1.8', - 'nibabel>=3.2', - 'sympy>=1.9', - 'transforms3d' -] developer = [ 'pre-commit', 'rtoml',