diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b178a061..fe6d6ca4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3bbe6f57..74b02c5f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} @@ -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: | @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 866e864b..6c86b9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 34a9e84a..c0235964 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
- pysatNASA + pysatNASA
# pysatNASA: pysat support for NASA Space Science instruments @@ -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 | | | @@ -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 diff --git a/docs/conf.py b/docs/conf.py index 2a4a7a62..43245c9d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,6 +10,7 @@ import json import os +import pkg_resources import sys sys.path.insert(0, os.path.abspath('..')) @@ -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 @@ -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, diff --git a/docs/figures/logo.png b/docs/figures/pysatnasa_logo.png similarity index 100% rename from docs/figures/logo.png rename to docs/figures/pysatnasa_logo.png diff --git a/docs/installation.rst b/docs/installation.rst index 82f840fa..f74c7e4b 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -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: diff --git a/docs/overview.rst b/docs/overview.rst index c103d568..4c8a8d4e 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0f5cc26f --- /dev/null +++ b/pyproject.toml @@ -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 = "pysat.developers@gmail.com"}, +] +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" +] diff --git a/pysatNASA/__init__.py b/pysatNASA/__init__.py index 1df92789..ea9f8ff2 100644 --- a/pysatNASA/__init__.py +++ b/pysatNASA/__init__.py @@ -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') diff --git a/pysatNASA/version.txt b/pysatNASA/version.txt deleted file mode 100644 index 81340c7e..00000000 --- a/pysatNASA/version.txt +++ /dev/null @@ -1 +0,0 @@ -0.0.4 diff --git a/requirements.txt b/requirements.txt index a1dafc41..6aedff4e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -netCDF4 -requests beautifulsoup4 -lxml +cdasws cdflib>=0.4.4 +lxml +netCDF4 numpy pandas pysat>=3.0.4 -cdasws +requests xarray diff --git a/setup.cfg b/setup.cfg index 6cf21798..08661e10 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,56 +1,8 @@ +# 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 = jeffrey.klenzing@nasa.gov -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 @@ -58,12 +10,3 @@ 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 diff --git a/setup.py b/setup.py deleted file mode 100644 index 4c0bbd8e..00000000 --- a/setup.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2020, Authors -# Full license can be found in License.md and AUTHORS.md -# ----------------------------------------------------------------------------- -"""Setup routines for pysatNASA. - -Note ----- -Package metadata stored in setup.cfg - -""" - -from setuptools import setup - -# Run setup -setup()