Skip to content

Commit

Permalink
Merge pull request #129 from pysat/sty/pyproject
Browse files Browse the repository at this point in the history
MAINT: pyproject.toml, docs
  • Loading branch information
jklenzing authored May 30, 2023
2 parents 13b12c4 + 2b41e01 commit 71b8074
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 116 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install -r requirements.txt
pip install .[doc]
- name: Set up pysat
run: |
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10"]
python-version: ["3.10", "3.11"]
numpy_ver: ["latest"]
test_config: ["latest"]
include:
- python-version: "3.8"
- python-version: "3.9"
numpy_ver: "1.21"
os: "ubuntu-latest"
os: ubuntu-latest
test_config: "NEP29"
- python-version: "3.6.8"
numpy_ver: "1.19.5"
os: "ubuntu-20.04"
test_config: "Ops"

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

- name: Install Operational dependencies
if: ${{ matrix.test_config == 'Ops'}}
run: |
pip install --no-cache-dir numpy==${{ matrix.numpy_ver }}
pip install -r requirements.txt
pip install -r test_requirements.txt
pip install .
- name: Install NEP29 dependencies
if: ${{ matrix.numpy_ver != 'latest'}}
run: pip install numpy==${{ matrix.numpy_ver }}
if: ${{ matrix.test_config == 'NEP29'}}
run: |
pip install numpy==${{ matrix.numpy_ver }}
pip install --upgrade-strategy only-if-needed .[test]
- name: Install standard dependencies
if: ${{ matrix.test_config == 'latest'}}
run: |
pip install -r requirements.txt
pip install -r test_requirements.txt
pip install .[test]
- name: Set up pysat
run: |
Expand All @@ -52,9 +68,9 @@ jobs:
run: flake8 . --count --exit-zero --max-complexity=10 --statistics

- name: Test with pytest
run: pytest -vs --cov=pysatNASA/
run: pytest

- name: Publish results to coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --rcfile=setup.cfg --service=github
run: coveralls --rcfile=pyproject.toml --service=github
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* Update meta label type for instruments
* Updated GitHub Actions workflows for improved compliance with pip>=23.0
* Added .readthedocs.yml to configure settings there.
* Use pyproject.toml to manage installation and metadata

## [0.0.4] - 2022-11-07
* Update instrument tests with new test class
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="left">
<img height="0" width="0px">
<img width="20%" src="https://raw.githubusercontent.com/pysat/pysatNASA/main/docs/figures/logo.png" alt="pysatNASA" title="pysatNASA" </img>
<img width="20%" src="https://raw.githubusercontent.com/pysat/pysatNASA/main/docs/figures/pysatnasa_logo.png" alt="pysatNASA" title="pysatNASA" </img>
</div>

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

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

| Common modules | Community modules | Optional Modules |
| ---------------- | ----------------- |------------------|
| beautifulsoup4 | cdflib | pysatCDF |
| lxml | pysat>=3.0.4 | |
| netCDF4 | | |
| numpy<1.24 | | |
| numpy | | |
| pandas | | |
| requests | | |
| xarray | | |
Expand All @@ -43,12 +43,12 @@ pip install pysatNASA
git clone https://github.com/pysat/pysatNASA.git
```

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

```
cd pysatNASA/
python setup.py install
pip install .
```

Note: pre-1.0.0 version
Expand Down
7 changes: 3 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import json
import os
import pkg_resources
import sys
sys.path.insert(0, os.path.abspath('..'))

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

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

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down
File renamed without changes
22 changes: 15 additions & 7 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,32 @@ Installation Options


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

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


sudo python setup.py install
sudo pip install .

B. Install at the user level::


python setup.py install --user
C. Install with the intent to develop locally::
pip install --user .

C. Install with the intent to change the code::


pip install --user -e .

.. extras-require:: pysatcdf
:pyproject:

python setup.py develop --user
.. extras-require:: test
:pyproject:

.. extras-require:: all
:setup.cfg:
.. extras-require:: doc
:pyproject:

.. _post-install:

Expand Down
2 changes: 1 addition & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a library of ``pysat`` instrument modules and methods designed to suppor
NASA instruments and missions archived at the Community Data Analysis Web
portal.

.. image:: figures/logo.png
.. image:: figures/pysatnasa_logo.png
:width: 400px
:align: center
:alt: pysatNASA Logo, a blue planet with red orbiting python and the module name superimposed
88 changes: 88 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[build-system]
requires = ["setuptools", "pip >= 10"]
build-backend = "setuptools.build_meta"

[project]
name = "pysatNASA"
version = "0.0.5"
description = "pysat support for NASA Instruments"
readme = "README.md"
requires-python = ">=3.6"
license = {file = "LICENSE"}
authors = [
{name = "Jeff Klenzing, et al.", email = "[email protected]"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows"
]
keywords = [
"pysat",
"ionosphere",
"magnetosphere",
"solar wind",
"thermosphere"
]
dependencies = [
"beautifulsoup4",
"cdasws",
"cdflib >= 0.4.4",
"lxml",
"netCDF4",
"numpy",
"pandas",
"pysat >= 3.0.4",
"requests",
"xarray"
]

[project.optional-dependencies]
pysatcdf = ["pysatCDF"]
test = [
"coveralls < 3.3",
"flake8",
"flake8-docstrings",
"hacking >= 1.0",
"pytest",
"pytest-cov",
"pytest-ordering"
]
doc = [
"extras_require",
"ipython",
"m2r2",
"numpydoc",
"sphinx",
"sphinx_rtd_theme"
]

[project.urls]
Documentation = "https://pysatnasa.readthedocs.io/en/latest/"
Source = "https://github.com/pysat/pysatNASA"

[tool.coverage.report]
omit = ["*/instruments/templates/"]

[tool.pytest.ini_options]
addopts = "-vs --cov=pysatNASA"
markers = [
"all_inst",
"download",
"no_download",
"load_options",
"first",
"second"
]
14 changes: 8 additions & 6 deletions pysatNASA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"""

import os
import importlib
import importlib_metadata

from pysatNASA import constellations # noqa F401
from pysatNASA import instruments # noqa F401

# set version
here = os.path.abspath(os.path.dirname(__file__))
version_filename = os.path.join(here, 'version.txt')
with open(version_filename, 'r') as version_file:
__version__ = version_file.read().strip()
del here, version_filename, version_file
try:
__version__ = importlib.metadata.version('pysatNASA')
except AttributeError:
# Python 3.6 requires a different version
__version__ = importlib_metadata.version('pysatNASA')
1 change: 0 additions & 1 deletion pysatNASA/version.txt

This file was deleted.

8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
netCDF4
requests
beautifulsoup4
lxml
cdasws
cdflib>=0.4.4
lxml
netCDF4
numpy
pandas
pysat>=3.0.4
cdasws
requests
xarray
63 changes: 3 additions & 60 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,69 +1,12 @@
# name and version must be maintained here as well for python 3.6 compatibility

[metadata]
name = pysatNASA
version = file: pysatNASA/version.txt
url = https://github.com/pysat/pysatNASA
author = Jeff Klenzing
author_email = [email protected]
description = 'pysat support for NASA Instruments'
keywords =
pysat
ionosphere
classifiers =
Development Status :: 3 - Alpha
Topic :: Scientific/Engineering :: Physics
Topic :: Scientific/Engineering :: Atmospheric Science
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Natural Language :: English
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Operating System :: MacOS :: MacOS X
Operating System :: POSIX :: Linux
license_file = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown

[options]
python_requires = >= 3.5
setup_requires =
setuptools >= 38.6
pip >= 10
include_package_data = True
zip_safe = False
packages = find:
install_requires =
cdasws
netCDF4
requests
beautifulsoup4
lxml
cdflib
numpy
pandas
xarray
pysat

[options.extras_require]
all =
pysatCDF

[coverage:report]
omit =
*/instruments/templates/
version = 0.0.5

[flake8]
max-line-length = 80
ignore =
D200
D202
W503

[tool:pytest]
markers =
all_inst: tests all instruments
download: tests for downloadable instruments
no_download: tests for instruments without download support
load_options: tests for instruments with additional options
first: first tests to run
second: second tests to run
Loading

0 comments on commit 71b8074

Please sign in to comment.