Skip to content

Commit 1267042

Browse files
authored
Merge pull request #137 from pysat/maint/pyproject
MAINT: pyproject, pysat style updates
2 parents a77c2c9 + 4ce2fda commit 1267042

22 files changed

+205
-108
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: [3.9]
16+
python-version: ["3.11"] # Keep this version at the highest supported Python version
1717

1818
name: Documentation tests
1919
steps:
@@ -26,8 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install -r test_requirements.txt
30-
pip install -r requirements.txt
29+
pip install .[doc]
3130
3231
- name: Set up pysat
3332
run: |

.github/workflows/main.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.9", "3.10"]
17-
numpy_ver: [latest]
15+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
16+
python-version: ["3.10", "3.11"]
17+
numpy_ver: ["latest"]
18+
test_config: ["latest"]
1819
include:
19-
- python-version: "3.8"
20-
numpy_ver: "1.20.3"
21-
os: "ubuntu-latest"
20+
- python-version: "3.9"
21+
numpy_ver: "1.22"
22+
os: ubuntu-latest
23+
test_config: "NEP29"
24+
- python-version: "3.6.8"
25+
numpy_ver: "1.19.5"
26+
os: "ubuntu-20.04"
27+
test_config: "Ops"
2228

2329
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
2430
runs-on: ${{ matrix.os }}
@@ -29,15 +35,24 @@ jobs:
2935
with:
3036
python-version: ${{ matrix.python-version }}
3137

32-
- name: Install standard dependencies
38+
- name: Install Operational dependencies
39+
if: ${{ matrix.test_config == 'Ops'}}
3340
run: |
34-
pip install -r test_requirements.txt
41+
pip install --no-cache-dir numpy==${{ matrix.numpy_ver }}
42+
pip install "cdflib<1.0"
3543
pip install -r requirements.txt
44+
pip install -r test_requirements.txt
45+
pip install .
3646
3747
- name: Install NEP29 dependencies
38-
if: ${{ matrix.numpy_ver != 'latest'}}
48+
if: ${{ matrix.test_config == 'NEP29'}}
3949
run: |
4050
pip install numpy==${{ matrix.numpy_ver }}
51+
pip install --upgrade-strategy only-if-needed .[test]
52+
53+
- name: Install standard dependencies
54+
if: ${{ matrix.test_config == 'latest'}}
55+
run: pip install .[test]
4156

4257
- name: Set up pysat
4358
run: |
@@ -51,9 +66,22 @@ jobs:
5166
run: flake8 . --count --exit-zero --max-complexity=10 --statistics
5267

5368
- name: Run unit and integration tests
54-
run: pytest --cov=pysatModels/
69+
run: pytest
5570

5671
- name: Publish results to coveralls
5772
env:
5873
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
run: coveralls --rcfile=setup.cfg --service=github
74+
COVERALLS_PARALLEL: true
75+
run: coveralls --rcfile=pyproject.toml --service=github
76+
77+
finish:
78+
name: Finish Coverage Analysis
79+
needs: build
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Coveralls Finished
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
pip install --upgrade coveralls
87+
coveralls --service=github --finish

.github/workflows/pysat_rc.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
17-
python-version: ["3.10"]
17+
python-version: ["3.11"] # Keep this version at the highest supported Python version
1818
rc-package: ["pysat", "pysatNASA"]
1919

2020
name: ${{ matrix.os }} with ${{ matrix.rc-package }} RC
@@ -30,19 +30,30 @@ jobs:
3030
run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${{ matrix.rc-package }}
3131

3232
- name: Install standard dependencies
33-
run: |
34-
pip install -r test_requirements.txt
35-
pip install -r requirements.txt
33+
run: pip install .[test]
3634

3735
- name: Set up pysat
3836
run: |
3937
mkdir pysatData
4038
python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'"
4139
4240
- name: Run unit and integration tests
43-
run: pytest --cov=pysatModels/
41+
run: pytest
4442

4543
- name: Publish results to coveralls
4644
env:
4745
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
run: coveralls --rcfile=setup.cfg --service=github
46+
COVERALLS_PARALLEL: true
47+
run: coveralls --rcfile=pyproject.toml --service=github
48+
49+
finish:
50+
name: Finish Coverage Analysis
51+
needs: build
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Coveralls Finished
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
pip install --upgrade coveralls
59+
coveralls --service=github --finish

.readthedocs.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.10"
13+
14+
# Build documentation in the docs/ directory with Sphinx
15+
sphinx:
16+
configuration: docs/conf.py
17+
18+
19+
# Optionally declare the Python requirements required to build your docs
20+
python:
21+
install:
22+
- method: pip
23+
path: .
24+
extra_requirements:
25+
- doc

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1414
* Updated tests to new pysat and pytest standards
1515
* Added a cap for pysatNASA
1616
* Removed backwards-support for pysat pre-3.0.4 functions
17+
* Updated to use pyproject
18+
* Added yaml for readthedocs
1719
* Documentation
1820
* Added badges and instructions for PyPi and Zenodo
1921

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ the Space Physics community. This module officially supports Python 3.6+.
3030
| Common modules | Community modules |
3131
| ------------------ | ------------------ |
3232
| numpy | pyForecastTools |
33-
| pandas >= 1.4.0 | pysat >= 3.0.4 |
33+
| pandas | pysat >= 3.0.4 |
3434
| requests | pysatNASA <= 0.0.4 |
3535
| scipy | |
3636
| xarray | |

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import datetime as dt
1717
import json
1818
import os
19+
import pkg_resources
1920
import sys
2021

2122
sys.path.insert(0, os.path.abspath('..'))
@@ -72,9 +73,7 @@
7273
#
7374
# The short X.Y version.
7475
module_dir = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
75-
version_file = os.path.join(module_dir, project, 'version.txt')
76-
with open(version_file, 'r') as fin:
77-
version = fin.read().strip()
76+
version = pkg_resources.get_distribution('pysatModels').version
7877

7978
# The full version, including alpha/beta/rc tags.
8079
release = '{:s}-alpha'.format(version)
@@ -84,7 +83,7 @@
8483
#
8584
# This is also used if you do content translation via gettext catalogs.
8685
# Usually you set "language" from the command line for these cases.
87-
language = None
86+
language = 'en'
8887

8988
# List of patterns, relative to source directory, that match files and
9089
# directories to ignore when looking for source files.

docs/installation.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Prerequisites
2020
pysatModels uses common Python modules, as well as modules developed by and for
2121
the Space Physics community. This module officially supports Python 3.6+.
2222

23-
============== =================
23+
============== ==================
2424
Common modules Community modules
25-
============== =================
26-
numpy pysat
27-
pandas pysatNASA
25+
============== ==================
26+
numpy pysat >= 3.0.4
27+
pandas pysatNASA <= 0.0.4
2828
requests pyForecastTools
2929
scipy
3030
xarray
31-
============== =================
31+
============== ==================
3232

3333

3434
.. _install-opt:

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ output, and incorporating modelled data sets into general data analysis
1111
routines written to use data stored in
1212
`pysat.Instrument <https://pysat.readthedocs.io/en/latest/api.html#instrument>`_
1313
objects or
14-
`xarray.Datasets <https://xarray.pydata.org/en/stable/generated/xarray.Dataset.html>`_.
14+
`xarray.Datasets <https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html>`_.
1515

1616
.. image:: images/pysatModels.png
1717
:width: 400px

pyproject.toml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[build-system]
2+
requires = ["setuptools >= 38.6", "pip >= 10"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pysatModels"
7+
version = "0.1.0"
8+
description = "Supports model analysis and model-data comparisons"
9+
readme = "README.md"
10+
requires-python = ">=3.6"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Pysat Development Team", email = "pysat.developers@gmail.com"},
14+
]
15+
classifiers = [
16+
"Development Status :: 3 - Alpha",
17+
"Topic :: Scientific/Engineering :: Physics",
18+
"Intended Audience :: Science/Research",
19+
"License :: Freely Distributable",
20+
"Natural Language :: English",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.6",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Operating System :: MacOS :: MacOS X",
27+
"Operating System :: POSIX :: Linux",
28+
"Operating System :: Microsoft :: Windows"
29+
]
30+
dependencies = [
31+
"numpy",
32+
"packaging",
33+
"pandas",
34+
"pyForecastTools",
35+
"pysat >= 3.0.4",
36+
"pysatNASA <= 0.0.4",
37+
"requests",
38+
"scipy",
39+
"xarray"
40+
]
41+
42+
[project.optional-dependencies]
43+
test = [
44+
"coveralls < 3.3",
45+
"flake8",
46+
"flake8-docstrings",
47+
"hacking >= 1.0",
48+
"pytest-cov",
49+
"pytest-ordering"
50+
]
51+
doc = [
52+
"extras_require",
53+
"m2r2",
54+
"numpydoc",
55+
"sphinx",
56+
"sphinx_rtd_theme >= 1.2.2, < 2.0.0"
57+
]
58+
59+
[project.urls]
60+
Documentation = "https://pysatmodels.readthedocs.io/en/latest/"
61+
Source = "https://github.com/pysat/pysatModels"
62+
63+
[tool.coverage.report]
64+
65+
[tool.pytest.ini_options]
66+
addopts = "--cov=pysatModels"
67+
markers = [
68+
"all_inst",
69+
"download",
70+
"no_download",
71+
"load_options",
72+
"new_tests",
73+
"first",
74+
"second"
75+
]

0 commit comments

Comments
 (0)