Skip to content

Commit 0db0e0e

Browse files
committed
MAINT: Les setup.py use pyproject.toml & setup.cfg
When pytest config is moved to pyproject.toml, pytest test discovery changes and it catches a bug in MPL <=3.5.1. We shall make this change well after MPL 3.5.2 has shipped. Ref: matplotlib/matplotlib#22305
1 parent b831e2d commit 0db0e0e

10 files changed

Lines changed: 110 additions & 203 deletions

File tree

‎.coveragerc‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

‎.github/workflows/testing.yml‎

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,32 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
python-version: [3.6, 3.9]
16+
python-version: ["3.8", "3.10"]
1717

1818
steps:
1919
- name: Checkout Code
20-
uses: actions/checkout@v2
21-
22-
# Ref: https://github.com/marketplace/actions/setup-miniconda
23-
- name: Cache conda
24-
uses: actions/cache@v1
25-
env:
26-
# Increase this value to reset cache if etc/example-environment.yml
27-
# has not changed
28-
CACHE_NUMBER: 0
29-
with:
30-
path: ~/conda_pkgs_dir
31-
key:
32-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
33-
hashFiles('etc/example-environment.yml') }}
20+
uses: actions/checkout@v3
3421

35-
- name: Install Miniconda
36-
uses: conda-incubator/setup-miniconda@v2
22+
- name: Setup Python
23+
uses: actions/setup-python@v2
3724
with:
38-
auto-update-conda: true
3925
python-version: ${{ matrix.python-version }}
40-
activate-environment: mizani-ci-unittests
4126

4227
- name: Install Packages
4328
shell: bash -l {0}
4429
run: |
45-
conda install scipy pandas matplotlib
46-
conda install pytest-cov
47-
pip install palettable
48-
pip install -e .
30+
pip install -e ".[testing]"
4931
5032
- name: Environment Information
5133
shell: bash -l {0}
5234
run: |
53-
conda info
54-
conda list
5535
pip list
5636
5737
- name: Run Tests
5838
shell: bash -l {0}
5939
run: |
6040
coverage erase
6141
make test
62-
ls -la
6342
6443
- name: Upload coverage to Codecov
6544
uses: codecov/codecov-action@v1
@@ -77,28 +56,16 @@ jobs:
7756

7857
strategy:
7958
matrix:
80-
python-version: [3.8]
59+
python-version: ["3.10"]
8160
steps:
8261
- name: Checkout Code
83-
uses: actions/checkout@v2
62+
uses: actions/checkout@v3
8463

8564
- name: Setup Python
8665
uses: actions/setup-python@v2
8766
with:
8867
python-version: ${{ matrix.python-version }}
8968

90-
# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#caching-dependencies
91-
- name: Cache pip
92-
uses: actions/cache@v2
93-
with:
94-
# This path is specific to Ubuntu
95-
path: ~/.cache/pip
96-
# Look to see if there is a cache hit for the corresponding requirements file
97-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
98-
restore-keys: |
99-
${{ runner.os }}-pip-
100-
${{ runner.os }}-
101-
10269
- name: Install Packages
10370
shell: bash -l {0}
10471
run: pip install flake8
@@ -121,37 +88,21 @@ jobs:
12188

12289
strategy:
12390
matrix:
124-
python-version: [3.8]
91+
python-version: ["3.10"]
12592

12693
steps:
12794
- name: Checkout Code
128-
uses: actions/checkout@v2
95+
uses: actions/checkout@v3
12996

13097
- name: Setup Python
13198
uses: actions/setup-python@v2
13299
with:
133100
python-version: ${{ matrix.python-version }}
134101

135-
# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#caching-dependencies
136-
- name: Cache pip
137-
uses: actions/cache@v2
138-
with:
139-
# This path is specific to Ubuntu
140-
path: ~/.cache/pip
141-
# Look to see if there is a cache hit for the corresponding requirements file
142-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
143-
restore-keys: |
144-
${{ runner.os }}-pip-
145-
${{ runner.os }}-
146-
147102
- name: Install Packages
148103
shell: bash -l {0}
149104
run: |
150-
conda install scipy pandas matplotlib
151-
pip install palettable
152-
pip install -r requirements/doc.txt
153-
pip install -e .
154-
python setup.py install
105+
pip install -e ".[doc]"
155106
156107
- name: Environment Information
157108
shell: bash -l {0}
@@ -161,5 +112,5 @@ jobs:
161112
shell: bash -l {0}
162113
run: |
163114
pushd doc
164-
SPHINXOPTS=-W fails
115+
SPHINXOPTS=-W
165116
make html && popd

‎.readthedocs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sphinx:
2020
# Optionally set the version of Python and requirements required to build your docs
2121
# system_packages includes numpy, ...
2222
python:
23-
version: 3.7
23+
version: 3.8
2424
install:
2525
- requirements: requirements/rtd.txt
2626
- method: pip

‎pyproject.toml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Reference https://github.com/pydata/xarray/blob/main/pyproject.toml
2+
[build-system]
3+
requires = [
4+
"setuptools>=42",
5+
"wheel",
6+
]
7+
build-backend = "setuptools.build_meta"
8+
9+
# Coverage.py
10+
[tool.coverage.run]
11+
branch = true
12+
source = ["mizani"]
13+
include = [
14+
"mizani/*"
15+
]
16+
omit = [
17+
"setup.py",
18+
"mizani/_version.py",
19+
"mizani/external/*",
20+
"mizani/tests/*",
21+
]
22+
disable_warnings = ["include-ignored"]
23+
24+
[tool.coverage.report]
25+
exclude_lines = [
26+
"pragma: no cover",
27+
"^def test_",
28+
"if __name__ == .__main__.:",
29+
]
30+
precision = 1

‎requirements/dev.txt‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
sphinx
1+
notebook
2+
3+
# doc
4+
sphinx>=3.5.0
5+
numpydoc>=0.9.1
6+
7+
# testing
8+
flake8
29
pytest-cov
3-
tox
10+
11+
# release
12+
twine
413
wheel
5-
pep8
6-
flake8
7-
scipy

‎requirements/doc.txt‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎requirements/rtd.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
sphinx>=4.5.0
12
numpydoc>=0.9.1
23
palettable
3-
sphinx>=3.0.0

‎setup.cfg‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
[metadata]
2+
name = mizani
3+
description = Scales for Python
4+
url= https://github.com/has2k1/mizani
5+
license = BSD (3-clause)
6+
author = Hassan Kibirige
7+
author_email = [email protected]
8+
long_description = file: README.rst
9+
long_description_content_type = text/x-rst
10+
classifiers =
11+
Intended Audience :: Science/Research
12+
License :: OSI Approved :: BSD License
13+
Programming Language :: Python :: 3 :: Only
14+
Programming Language :: Python :: 3.8
15+
Programming Language :: Python :: 3.9
16+
Programming Language :: Python :: 3.10
17+
Topic :: Scientific/Engineering :: Visualization
18+
19+
project_urls =
20+
Documentation = https://mizani.readthedocs.io/en/stable
21+
Source = https://github.com/has2k1/mizani
22+
Bug Tracker = https://github.com/has2k1/mizani/issues
23+
CI = https://github.com/has2k1/mizani/actions
24+
25+
[options]
26+
packages = find:
27+
install_requires =
28+
numpy>=1.19.0
29+
scipy>=1.5.0
30+
pandas>=1.3.5
31+
matplotlib>=3.5.0
32+
palettable
33+
python_requires = >=3.8
34+
zip_safe = False
35+
36+
[options.extras_require]
37+
testing =
38+
flake8
39+
pytest-cov
40+
41+
doc =
42+
sphinx>=4.5.0
43+
numpydoc>=0.9.1
44+
145
[versioneer]
246
VCS = git
347
style = pep440

‎setup.py‎

Lines changed: 12 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,15 @@
1-
"""
2-
Mizani
1+
import sys
2+
from setuptools import setup
33

4-
Mizani is a scales package for graphics. It is based on Hadley
5-
Wickham's *Scales* package.
6-
"""
4+
# This appears to be necessary so that versioneer works
5+
# Ref: python-versioneer/python-versioneer/issues/193
6+
sys.path.insert(0, ".") # noqa
7+
import versioneer # noqa
78

8-
from setuptools import setup, find_packages
99

10-
import versioneer
11-
12-
13-
__author__ = 'Hassan Kibirige'
14-
__email__ = '[email protected]'
15-
__description__ = "Scales for Python"
16-
__license__ = 'BSD (3-clause)'
17-
__url__ = 'https://github.com/has2k1/mizani'
18-
__classifiers__ = [
19-
'Intended Audience :: Science/Research',
20-
'License :: OSI Approved :: BSD License',
21-
'Programming Language :: Python :: 3',
22-
'Topic :: Scientific/Engineering :: Visualization',
23-
]
24-
25-
26-
def check_dependencies():
27-
"""
28-
Check for system level dependencies
29-
"""
30-
pass
31-
32-
33-
def get_required_packages():
34-
"""
35-
Return required packages
36-
37-
Plus any version tests and warnings
38-
"""
39-
install_requires = ['numpy',
40-
'scipy >= 1.5.0',
41-
'pandas >= 1.1.0',
42-
'matplotlib >= 3.1.1',
43-
'palettable']
44-
return install_requires
45-
46-
47-
def get_package_data():
48-
"""
49-
Return package data
50-
51-
For example:
52-
53-
{'': ['*.txt', '*.rst'],
54-
'hello': ['*.msg']}
55-
56-
means:
57-
- If any package contains *.txt or *.rst files,
58-
include them
59-
- And include any *.msg files found in
60-
the 'hello' package, too:
61-
"""
62-
return {}
63-
64-
65-
if __name__ == '__main__':
66-
67-
check_dependencies()
68-
69-
setup(name='mizani',
70-
maintainer=__author__,
71-
maintainer_email=__email__,
72-
description=__description__,
73-
long_description=__doc__,
74-
license=__license__,
75-
version=versioneer.get_version(),
76-
cmdclass=versioneer.get_cmdclass(),
77-
url=__url__,
78-
python_requires='>=3.6',
79-
install_requires=get_required_packages(),
80-
packages=find_packages(),
81-
package_data=get_package_data(),
82-
classifiers=__classifiers__
83-
)
10+
setup(
11+
# Move these to setup.cfg or pyproject.toml
12+
# whenever it is possible to do so
13+
version=versioneer.get_version(),
14+
cmdclass=versioneer.get_cmdclass()
15+
)

0 commit comments

Comments
 (0)