Skip to content
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
11 changes: 7 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ include CHANGES COPYING COPYING.LESSER

# Files from setup.py package_data that are not automatically added to source distributions
recursive-include lib/iris/tests/results *.cml *.cdl *.txt *.xml *.json
recursive-exclude lib/iris/fileformats/_pyke_rules/compiled_krb *
recursive-include lib/iris/etc *
include lib/iris/fileformats/_pyke_rules/*.k?b
include lib/iris/tests/stock*.npz
include lib/iris/fileformats/_pyke_rules/*.krb

include requirements/*.txt
recursive-include requirements *

# File required to build docs
recursive-include docs Makefile *.js *.png *.py *.rst
prune docs/build
prune docs/src/_build
prune docs/src/generated
prune docs/gallery_tests

# Files required to build std_names module
include tools/generate_std_names.py
include etc/cf-standard-name-table.xml

global-exclude *.pyc
global-exclude __pycache__
global-exclude iris_image_test_output
2 changes: 2 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ This document explains the changes made to Iris for this release
supported Python versions tested by `cirrus-ci`_ for documentation.
(:pull:`4163`)

#. `@bjlittle`_ refactored ``setup.py`` into ``setup.cfg``. (:pull:`4168`)

.. comment
Whatsnew author names (@github name) in alphabetical order. Note that,
core dev names are automatically included by the common_links.inc:
Expand Down
7 changes: 0 additions & 7 deletions requirements/all.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements/core.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements/docs.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements/setup.txt

This file was deleted.

10 changes: 0 additions & 10 deletions requirements/test.txt

This file was deleted.

95 changes: 95 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[metadata]
author = SciTools Developers
author_email = [email protected]
classifiers =
Development Status :: 5 Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Operating System :: MacOS
Operating System :: POSIX
Operating System :: POSIX :: Linux
Operating System :: Unix
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Atmospheric Science
Topic :: Scientific/Engineering :: Visualization
description =
A powerful, format-agnostic, community-driven Python package for analysing and visualising Earth science data
download_url = https://github.com/SciTools/iris
keywords =
cf-metadata
data-analysis
earth-science
grib
netcdf
meteorology
oceanography
space-weather
ugrid
visualisation
license = LGPL-3.0-or-later
license_file = COPYING.LESSER
long_description = file: README.md
long_description_content_type = text/markdown
name = scitools-iris
project_urls =
Code = https://github.com/SciTools/iris
Discussions = https://github.com/SciTools/iris/discussions
Documentation = https://scitools-iris.readthedocs.io/en/stable/
Issues = https://github.com/SciTools/iris/issues
url = https://github.com/SciTools/iris
version = attr: iris.__version__

[options]
include_package_data = True
install_requires =
cartopy>=0.18
cf-units>=2
cftime<1.3.0
dask[array]>=2
matplotlib
netcdf4
numpy>=1.14
scipy
scitools-pyke
xxhash
packages = find:
package_dir =
=lib
python_requires =
>=3.7
zip_safe = False

[options.packages.find]
where = lib

[options.extras_require]
docs =
sphinx
sphinx-copybutton
sphinx-gallery
sphinx_rtd_theme
sphinxcontrib-napoleon
sphinx-panels
test =
asv
black==21.5b2
filelock
flake8
imagehash>=4.0
nose
pillow<7
pre-commit
requests
all =
mo_pack
nc-time-axis
pandas
pyugrid
stratify
%(docs)s
%(test)s
106 changes: 0 additions & 106 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from contextlib import contextmanager
from distutils.util import convert_path
import os
from shutil import copyfile
import sys
Expand All @@ -10,50 +9,6 @@
from setuptools.command.build_py import build_py


PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__))
PYPI_NAME = "scitools-iris"


# Returns the package and all its sub-packages
def find_package_tree(root_path, root_package):
root_path = root_path.replace("/", os.path.sep)
packages = [root_package]
root_count = len(root_path.split(os.path.sep))
for (dir_path, dir_names, file_names) in os.walk(convert_path(root_path)):
# Prune dir_names *in-place* to prevent unwanted directory recursion
for dir_name in list(dir_names):
contains_init_file = os.path.isfile(
os.path.join(dir_path, dir_name, "__init__.py")
)
if not contains_init_file:
dir_names.remove(dir_name)
# Exclude compiled PyKE rules, but keep associated unit tests.
if dir_name == "compiled_krb" and "tests" not in dir_path:
dir_names.remove(dir_name)
if dir_names:
prefix = dir_path.split(os.path.sep)[root_count:]
packages.extend(
[
".".join([root_package] + prefix + [dir_name])
for dir_name in dir_names
]
)
return packages


def file_walk_relative(top, remove=""):
"""
Returns a generator of files from the top of the tree, removing
the given prefix from the root/file result.

"""
top = top.replace("/", os.path.sep)
remove = remove.replace("/", os.path.sep)
for root, dirs, files in os.walk(top):
for file in files:
yield os.path.join(root, file).replace(remove, "")


@contextmanager
def temporary_path(directory):
"""
Expand All @@ -74,26 +29,6 @@ def temporary_path(directory):
from _runner import TestRunner # noqa:


def pip_requirements(*args):
requirements = []
for name in args:
fname = os.path.join(
PACKAGE_DIR, "requirements", "{}.txt".format(name)
)
if not os.path.exists(fname):
emsg = (
f"Unable to find the {name!r} requirements file at {fname!r}."
)
raise RuntimeError(emsg)
with open(fname, "r") as fh:
for line in fh:
line = line.strip()
if not line or line.startswith("#"):
continue
requirements.append(line)
return requirements


class SetupTestRunner(TestRunner, Command):
pass

Expand Down Expand Up @@ -217,25 +152,6 @@ def run(self):
return ExtendedCommand


def extract_version():
version = None
fname = os.path.join(PACKAGE_DIR, "lib", "iris", "__init__.py")
with open(fname) as fi:
for line in fi:
if line.startswith("__version__"):
_, version = line.split("=")
version = version.strip()[1:-1] # Remove quotations
break
return version


def long_description():
fname = os.path.join(PACKAGE_DIR, "README.md")
with open(fname, "rb") as fi:
result = fi.read().decode("utf-8")
return result


custom_commands = {
"test": SetupTestRunner,
"develop": custom_cmd(develop_cmd, [build_std_names, compile_pyke_rules]),
Expand All @@ -257,27 +173,5 @@ def long_description():


setup(
name=PYPI_NAME,
version=extract_version(),
url="http://scitools.org.uk/iris/",
author="UK Met Office",
author_email="[email protected]",
description="A powerful, format-agnostic, community-driven Python "
"package for analysing and visualising Earth science data",
long_description=long_description(),
long_description_content_type="text/markdown",
packages=find_package_tree("lib/iris", "iris"),
package_dir={"": "lib"},
include_package_data=True,
cmdclass=custom_commands,
zip_safe=False,
setup_requires=pip_requirements("setup"),
install_requires=pip_requirements("setup", "core"),
tests_require=[f"{PYPI_NAME}[test]"],
extras_require={
"all": pip_requirements("all"),
"docs": pip_requirements("docs"),
"test": pip_requirements("test"),
},
python_requires=">=3.7",
)