Skip to content

Commit

Permalink
Update installation method
Browse files Browse the repository at this point in the history
Try to update to use more-recent Python packaging code. It is
limited by Sherpa (in that I'm not trying to support newer
setuptools version than Sherpa, at least for the time being, even
if we can do here).
  • Loading branch information
DougBurke committed Sep 14, 2022
1 parent e03e56f commit 2f617cd
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 92 deletions.
15 changes: 7 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ with XSPEC support
The following Python packages are required:

- sherpa
- `Astropy <http://www.astropy.org/>`_ (restricted to version 3.0 when
using CIAO 4.11)
- `Astropy <http://www.astropy.org/>`_
- `SciPy <https://www.scipy.org/scipylib/>`_.

Installation
Expand All @@ -52,13 +51,13 @@ you should be able to install ``deproject`` with the command::

pip3 install deproject

For CIAO 4.11, please use the slightly-more involved::
The installation requires pip version 19 or higher, but as that
was released in early 2019 it should be available.

echo "numpy==1.12.1" > constraints.txt
pip3 install -c constraints.txt 'astropy<3.1' deproject scipy

which avoids updating NumPy (as this is an untested combination
with this build).
The `installation documentation
<https://deproject.readthedocs.io/installation.html>`_ describes how
to build a development version from the `GitHub repository
<https://github.com/sherpa-deprojcet/deproject>`_.

Example
-------
Expand Down
9 changes: 9 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
Changes
*******

.. _changes_021:

Version 0.2.1
=============

The build system has been updated to use ``pip`` rather than
``setup.py``. Please report any problems on the
`issues page <https://github.com/sherpa-deproject/deproject/issues/>`_.

.. _changes_020:

Version 0.2.0
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

# General information about the project.
project = u'deproject'
copyright = u'2009, 2019, 2020, 2021 Tom Aldcroft'
copyright = u'2009, 2019, 2020, 2021, 2022 Tom Aldcroft'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
46 changes: 14 additions & 32 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
Installation
============

As of :ref:`version 0.2.0 <changes_020>`,
the :mod:`deproject` package can be installed
directly from `PyPI`_. This requires
`CIAO 4.11 <http://cxc.harvard.edu/ciao/>`_
or later (as installation with pip in earlier versions of
CIAO is not well supported). The module *can* be used with the
`standalone release of
Sherpa <https://sherpa.readthedocs.io/en/latest/ciao.html>`_,
but it is only useful if Sherpa has been built with
`XSPEC support <https://sherpa.readthedocs.io/en/latest/install.html#xspec>`_
which is trickier to achieve than we would like.
As of :ref:`version 0.2.0 <changes_020>`, the :mod:`deproject` package
can be installed directly from `PyPI`_. This requires `CIAO 4.11
<http://cxc.harvard.edu/ciao/>`_ or later (in general the latest
release of CIAO should be used). The module *can* be used with the
`standalone release of Sherpa
<https://sherpa.readthedocs.io/en/latest/ciao.html>`_, but it is only
useful if Sherpa has been built with `XSPEC support
<https://sherpa.readthedocs.io/en/latest/install.html#xspec>`_ which
is trickier to achieve than we would like.

Requirements
------------
Expand All @@ -23,9 +21,9 @@ The package uses `Astropy`_ and `SciPy`_, for units support and
cosmological-distance calculations. It is assumed that
`Matplotlib`_ is available for plotting.

Installation is easier with CIAO 4.12 than CIAO 4.11 since
CIAO 4.12 is available via conda (so there is less need to
use a constraints file).
It is **strongly** advised to use the latest CIAO (at the time
of writing this is CIAO 4.14) installed with conda. Support
for CIAO installed via the ciao-install script is limited.

Using pip
---------
Expand All @@ -39,16 +37,6 @@ depends on whether CIAO was installed via `ciao-install` or
This approach should also work if you are using the standalone
version of Sherpa.

If you are using CIAO 4.11 then you should install `deproject`
with the following::

echo "numpy==1.12.1" > constraints.txt
pip install -c constraints.txt 'astropy<3.1' deproject

.. note::
The Astropy restriction is because version 3.1 requires NumPy version
1.13 or later but CIAO 4.11 is shipped with NumPy version 1.12.

Manual installation
-------------------

Expand All @@ -61,7 +49,7 @@ by cloning the repository) and moving into the directory
(`deproject-<version>` or `deproject`), installation just
requires::

python setup.py install
pip install .

.. note::
This command should only be run after setting up CIAO or whatever
Expand All @@ -71,18 +59,12 @@ Test
----

The source installation includes a basic test suite, which can be
run with either
run with

::
pytest

or

::
python setup.py test

Example data
------------

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
requires = ["setuptools >= 51.0.0, < 60", # follow Sherpa
"wheel"
]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ conda:
environment: rtd-environment.yml

python:
version: 3.7
version: 3.8
# setup_py_install: true
# use_system_site_packages: true
2 changes: 1 addition & 1 deletion rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- sherpa

dependencies:
- python=3.7
- python=3.8
- numpy
- sherpa
- astropy
49 changes: 45 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
[aliases]
test=pytest
[metadata]
version = 0.2.1
name = deproject
author = Douglas Burke, Tom Aldcroft
author_email = [email protected]
url = https://deproject.readthedocs.io/
project_urls =
Issue Tracker = https://github.com/sherpa-deproject/deproject/issues/
Source Code = https://github.com/sherpa-deproject/deproject/
Documentaion = https://deproject.readthedocs.io/

[build_sphinx]
source-dir = docs
keywords = deprojection, xray, 3d, 2d, plasma, Astrophysics, onion

description = Sherpa deprojection package (X-ray analysis of Galaxy Clusters, Groups, and Galaxies)
long_description = file: README.rst
long_description_content_type = text/x-rst
license = BSD
license_files = LICENSE
platforms = Linux, Mac OS X
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Scientific/Engineering :: Astronomy
Topic :: Scientific/Engineering :: Physics

[options]
# zip_safe = False
python_requires = ~=3.7
install_requires =
sherpa
astropy
scipy

tests_require =
pytest

package_dir =
=src
packages = find:

[options.packages.find]
where=src
48 changes: 3 additions & 45 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
from setuptools import setup, find_packages

with open('README.rst', 'rt') as fh:
long_description = fh.read()

setup(name='deproject',
version='0.2.1',
license='BSD',
description='Sherpa deprojection package (X-ray analysis of Galaxy Clusters, Groups, and Galaxies)',
keywords='deprojection xray 3d 2d plasma Astrophysics onion',
long_description=long_description,
long_description_content_type='text/x-rst',
author='Douglas Burke, Tom Aldcroft',
author_email='[email protected]',

url='https://deproject.readthedocs.io/',
project_urls={
'Documentation': 'https://deproject.readthedocs.io/',
'Source Code': 'https://github.com/sherpa-deproject/deproject/',
'Issues': 'https://github.com/sherpa-deproject/deproject/issues/',
},

packages=find_packages('src'),
package_dir={'': 'src'},

setup_requires=['pytest-runner'],
tests_require=['pytest'],
install_requires=['sherpa', 'astropy', 'scipy'],

python_requires='~=3.5',

classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Physics'
],

# I think this should be zip_safe, but have not tried it
# zip_safe=False
)
# This is needed to allow setuptools to handle efitable mode
from setuptools import setup
setup()

0 comments on commit 2f617cd

Please sign in to comment.