Skip to content

Remove setup.py information from info.py #551

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

Merged
merged 8 commits into from
Nov 11, 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
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
====
Expand Down
62 changes: 11 additions & 51 deletions doc/devel/guidelines/make_release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -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``,
Expand Down Expand Up @@ -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'.

Expand Down
16 changes: 5 additions & 11 deletions nipy/__init__.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down Expand Up @@ -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
170 changes: 3 additions & 167 deletions nipy/info.py
Original file line number Diff line number Diff line change
@@ -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
<http://nipy.org/nipy>`_.

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/'
Expand Down
64 changes: 58 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Member

Choose a reason for hiding this comment

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

I'm able to build without this. Is ninja a dependency of meson-python that you just want to be explicit about? Do you actually depend on ninja-specifics, or could the other build tools stop using it without you needing to change anything?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was getting errors trying to build without it, for the wheel builds. I'm afraid I don't understand the build mechanics well enough to respond. If ninja is missing, with meson-python use something else?

Copy link
Member

Choose a reason for hiding this comment

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

How are you building? I'm using python -m build.

Copy link
Member Author

Choose a reason for hiding this comment

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

pip wheel ...

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Possibly an old pip? I just created a fresh environment:

$ mamba create -n tmp python=3.11
$ mamba activate tmp
$ pip wheel .
Processing /home/chris/Projects/nipy/nipy
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: nipy
  Building wheel for nipy (pyproject.toml) ... done
  Created wheel for nipy: filename=nipy-0.5.1.dev1-cp311-cp311-linux_x86_64.whl size=1916097 sha256=7ff5b2a9a9fe053c913dd2e487ee8c8fd11991893cf96e0f806846c79d17cd8b
  Stored in directory: /tmp/pip-ephem-wheel-cache-sn4mrur1/wheels/a1/58/f7/1af5aca9b8327defaf19028fc61c6f4850bd54b33e92f89a43
Successfully built nipy
$ pip --version
pip 23.3.1 from /home/chris/mambaforge/envs/tmp/lib/python3.11/site-packages/pip (python 3.11)

"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'
Expand Down
Loading