Skip to content

Commit 71b8074

Browse files
authored
Merge pull request #129 from pysat/sty/pyproject
MAINT: pyproject.toml, docs
2 parents 13b12c4 + 2b41e01 commit 71b8074

14 files changed

+154
-116
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install -r test_requirements.txt
29-
pip install -r requirements.txt
28+
pip install .[doc]
3029
3130
- name: Set up pysat
3231
run: |

.github/workflows/main.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
14-
python-version: ["3.9", "3.10"]
14+
python-version: ["3.10", "3.11"]
1515
numpy_ver: ["latest"]
16+
test_config: ["latest"]
1617
include:
17-
- python-version: "3.8"
18+
- python-version: "3.9"
1819
numpy_ver: "1.21"
19-
os: "ubuntu-latest"
20+
os: ubuntu-latest
21+
test_config: "NEP29"
22+
- python-version: "3.6.8"
23+
numpy_ver: "1.19.5"
24+
os: "ubuntu-20.04"
25+
test_config: "Ops"
2026

2127
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
2228
runs-on: ${{ matrix.os }}
@@ -31,14 +37,24 @@ jobs:
3137
if: ${{ matrix.os == 'macos-latest' }}
3238
run: brew reinstall gcc
3339

40+
- name: Install Operational dependencies
41+
if: ${{ matrix.test_config == 'Ops'}}
42+
run: |
43+
pip install --no-cache-dir numpy==${{ matrix.numpy_ver }}
44+
pip install -r requirements.txt
45+
pip install -r test_requirements.txt
46+
pip install .
47+
3448
- name: Install NEP29 dependencies
35-
if: ${{ matrix.numpy_ver != 'latest'}}
36-
run: pip install numpy==${{ matrix.numpy_ver }}
49+
if: ${{ matrix.test_config == 'NEP29'}}
50+
run: |
51+
pip install numpy==${{ matrix.numpy_ver }}
52+
pip install --upgrade-strategy only-if-needed .[test]
3753
3854
- name: Install standard dependencies
55+
if: ${{ matrix.test_config == 'latest'}}
3956
run: |
40-
pip install -r requirements.txt
41-
pip install -r test_requirements.txt
57+
pip install .[test]
4258
4359
- name: Set up pysat
4460
run: |
@@ -52,9 +68,9 @@ jobs:
5268
run: flake8 . --count --exit-zero --max-complexity=10 --statistics
5369

5470
- name: Test with pytest
55-
run: pytest -vs --cov=pysatNASA/
71+
run: pytest
5672

5773
- name: Publish results to coveralls
5874
env:
5975
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
run: coveralls --rcfile=setup.cfg --service=github
76+
run: coveralls --rcfile=pyproject.toml --service=github

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
4949
* Update meta label type for instruments
5050
* Updated GitHub Actions workflows for improved compliance with pip>=23.0
5151
* Added .readthedocs.yml to configure settings there.
52+
* Use pyproject.toml to manage installation and metadata
5253

5354
## [0.0.4] - 2022-11-07
5455
* Update instrument tests with new test class

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="left">
22
<img height="0" width="0px">
3-
<img width="20%" src="https://raw.githubusercontent.com/pysat/pysatNASA/main/docs/figures/logo.png" alt="pysatNASA" title="pysatNASA" </img>
3+
<img width="20%" src="https://raw.githubusercontent.com/pysat/pysatNASA/main/docs/figures/pysatnasa_logo.png" alt="pysatNASA" title="pysatNASA" </img>
44
</div>
55

66
# pysatNASA: pysat support for NASA Space Science instruments
@@ -20,14 +20,14 @@ some examples on how to use the routines
2020

2121
pysatNASA uses common Python modules, as well as modules developed by
2222
and for the Space Physics community. This module officially supports
23-
Python 3.8+.
23+
Python 3.6+.
2424

2525
| Common modules | Community modules | Optional Modules |
2626
| ---------------- | ----------------- |------------------|
2727
| beautifulsoup4 | cdflib | pysatCDF |
2828
| lxml | pysat>=3.0.4 | |
2929
| netCDF4 | | |
30-
| numpy<1.24 | | |
30+
| numpy | | |
3131
| pandas | | |
3232
| requests | | |
3333
| xarray | | |
@@ -43,12 +43,12 @@ pip install pysatNASA
4343
git clone https://github.com/pysat/pysatNASA.git
4444
```
4545

46-
Change directories into the repository folder and run the setup.py file. For
46+
Change directories into the repository folder and build the project. For
4747
a local install use the "--user" flag after "install".
4848

4949
```
5050
cd pysatNASA/
51-
python setup.py install
51+
pip install .
5252
```
5353

5454
Note: pre-1.0.0 version

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import json
1212
import os
13+
import pkg_resources
1314
import sys
1415
sys.path.insert(0, os.path.abspath('..'))
1516

@@ -63,9 +64,7 @@
6364
# The version info for the project you're documenting, acts as replacement for
6465
# |version| and |release|, also used in various other places throughout the
6566
# built documents.
66-
doc_dir = os.path.abspath(os.path.dirname(__file__))
67-
with open(os.path.join(doc_dir, "..", project, "version.txt"), "r") as fin:
68-
version = fin.read().strip()
67+
version = pkg_resources.get_distribution('pysatNASA').version
6968
release = '{:s}-alpha'.format(version) # Include alpha/beta/rc tags.
7069

7170
# The language for content autogenerated by Sphinx. Refer to documentation
@@ -97,7 +96,7 @@
9796
# Theme options are theme-specific and customize the look and feel of a theme
9897
# further. For a list of options available for each theme, see the
9998
# documentation.
100-
html_logo = os.path.join(os.path.abspath('.'), 'figures', 'logo.png')
99+
html_logo = os.path.join(os.path.abspath('.'), 'figures', 'pysatnasa_logo.png')
101100
html_theme_options = {'logo_only': True}
102101

103102
# Add any paths that contain custom static files (such as style sheets) here,
File renamed without changes.

docs/installation.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,32 @@ Installation Options
4040

4141

4242
2. Install pysatNASA:
43-
Change directories into the repository folder and run the setup.py file.
43+
Change directories into the repository folder and build the project.
4444
There are a few ways you can do this:
4545

4646
A. Install on the system (root privileges required)::
4747

4848

49-
sudo python setup.py install
49+
sudo pip install .
50+
5051
B. Install at the user level::
5152

5253

53-
python setup.py install --user
54-
C. Install with the intent to develop locally::
54+
pip install --user .
55+
56+
C. Install with the intent to change the code::
57+
58+
59+
pip install --user -e .
5560

61+
.. extras-require:: pysatcdf
62+
:pyproject:
5663

57-
python setup.py develop --user
64+
.. extras-require:: test
65+
:pyproject:
5866

59-
.. extras-require:: all
60-
:setup.cfg:
67+
.. extras-require:: doc
68+
:pyproject:
6169

6270
.. _post-install:
6371

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a library of ``pysat`` instrument modules and methods designed to suppor
55
NASA instruments and missions archived at the Community Data Analysis Web
66
portal.
77

8-
.. image:: figures/logo.png
8+
.. image:: figures/pysatnasa_logo.png
99
:width: 400px
1010
:align: center
1111
:alt: pysatNASA Logo, a blue planet with red orbiting python and the module name superimposed

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[build-system]
2+
requires = ["setuptools", "pip >= 10"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pysatNASA"
7+
version = "0.0.5"
8+
description = "pysat support for NASA Instruments"
9+
readme = "README.md"
10+
requires-python = ">=3.6"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Jeff Klenzing, et al.", email = "[email protected]"},
14+
]
15+
classifiers = [
16+
"Development Status :: 3 - Alpha",
17+
"Topic :: Scientific/Engineering :: Astronomy",
18+
"Topic :: Scientific/Engineering :: Physics",
19+
"Topic :: Scientific/Engineering :: Atmospheric Science",
20+
"Intended Audience :: Science/Research",
21+
"License :: OSI Approved :: BSD License",
22+
"Natural Language :: English",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.6",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Operating System :: POSIX :: Linux",
29+
"Operating System :: MacOS :: MacOS X",
30+
"Operating System :: Microsoft :: Windows"
31+
]
32+
keywords = [
33+
"pysat",
34+
"ionosphere",
35+
"magnetosphere",
36+
"solar wind",
37+
"thermosphere"
38+
]
39+
dependencies = [
40+
"beautifulsoup4",
41+
"cdasws",
42+
"cdflib >= 0.4.4",
43+
"lxml",
44+
"netCDF4",
45+
"numpy",
46+
"pandas",
47+
"pysat >= 3.0.4",
48+
"requests",
49+
"xarray"
50+
]
51+
52+
[project.optional-dependencies]
53+
pysatcdf = ["pysatCDF"]
54+
test = [
55+
"coveralls < 3.3",
56+
"flake8",
57+
"flake8-docstrings",
58+
"hacking >= 1.0",
59+
"pytest",
60+
"pytest-cov",
61+
"pytest-ordering"
62+
]
63+
doc = [
64+
"extras_require",
65+
"ipython",
66+
"m2r2",
67+
"numpydoc",
68+
"sphinx",
69+
"sphinx_rtd_theme"
70+
]
71+
72+
[project.urls]
73+
Documentation = "https://pysatnasa.readthedocs.io/en/latest/"
74+
Source = "https://github.com/pysat/pysatNASA"
75+
76+
[tool.coverage.report]
77+
omit = ["*/instruments/templates/"]
78+
79+
[tool.pytest.ini_options]
80+
addopts = "-vs --cov=pysatNASA"
81+
markers = [
82+
"all_inst",
83+
"download",
84+
"no_download",
85+
"load_options",
86+
"first",
87+
"second"
88+
]

pysatNASA/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
77
"""
88

9-
import os
9+
import importlib
10+
import importlib_metadata
11+
1012
from pysatNASA import constellations # noqa F401
1113
from pysatNASA import instruments # noqa F401
1214

1315
# set version
14-
here = os.path.abspath(os.path.dirname(__file__))
15-
version_filename = os.path.join(here, 'version.txt')
16-
with open(version_filename, 'r') as version_file:
17-
__version__ = version_file.read().strip()
18-
del here, version_filename, version_file
16+
try:
17+
__version__ = importlib.metadata.version('pysatNASA')
18+
except AttributeError:
19+
# Python 3.6 requires a different version
20+
__version__ = importlib_metadata.version('pysatNASA')

pysatNASA/version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
netCDF4
2-
requests
31
beautifulsoup4
4-
lxml
2+
cdasws
53
cdflib>=0.4.4
4+
lxml
5+
netCDF4
66
numpy
77
pandas
88
pysat>=3.0.4
9-
cdasws
9+
requests
1010
xarray

setup.cfg

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,12 @@
1+
# name and version must be maintained here as well for python 3.6 compatibility
2+
13
[metadata]
24
name = pysatNASA
3-
version = file: pysatNASA/version.txt
4-
url = https://github.com/pysat/pysatNASA
5-
author = Jeff Klenzing
6-
author_email = [email protected]
7-
description = 'pysat support for NASA Instruments'
8-
keywords =
9-
pysat
10-
ionosphere
11-
classifiers =
12-
Development Status :: 3 - Alpha
13-
Topic :: Scientific/Engineering :: Physics
14-
Topic :: Scientific/Engineering :: Atmospheric Science
15-
Intended Audience :: Science/Research
16-
License :: OSI Approved :: BSD License
17-
Natural Language :: English
18-
Programming Language :: Python :: 3.5
19-
Programming Language :: Python :: 3.6
20-
Programming Language :: Python :: 3.7
21-
Operating System :: MacOS :: MacOS X
22-
Operating System :: POSIX :: Linux
23-
license_file = LICENSE
24-
long_description = file: README.md
25-
long_description_content_type = text/markdown
26-
27-
[options]
28-
python_requires = >= 3.5
29-
setup_requires =
30-
setuptools >= 38.6
31-
pip >= 10
32-
include_package_data = True
33-
zip_safe = False
34-
packages = find:
35-
install_requires =
36-
cdasws
37-
netCDF4
38-
requests
39-
beautifulsoup4
40-
lxml
41-
cdflib
42-
numpy
43-
pandas
44-
xarray
45-
pysat
46-
47-
[options.extras_require]
48-
all =
49-
pysatCDF
50-
51-
[coverage:report]
52-
omit =
53-
*/instruments/templates/
5+
version = 0.0.5
546

557
[flake8]
568
max-line-length = 80
579
ignore =
5810
D200
5911
D202
6012
W503
61-
62-
[tool:pytest]
63-
markers =
64-
all_inst: tests all instruments
65-
download: tests for downloadable instruments
66-
no_download: tests for instruments without download support
67-
load_options: tests for instruments with additional options
68-
first: first tests to run
69-
second: second tests to run

0 commit comments

Comments
 (0)