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..53c110c70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,72 @@ +[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 = '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] +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 + # 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'", ] -[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()