Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: pysat deprecations #40

Merged
merged 23 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,31 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
python-version: ["3.11"]

name: Documentation tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- 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: |
mkdir pysatData
python -c "import pysat; pysat.params['data_dirs'] = './pysatData'"

- name: Check documentation build
run: sphinx-build -E -b html docs dist/docs

- name: Check documentation links
run: sphinx-build -b linkcheck docs dist/docs

- name: Load .zenodo.json to check for errors
run: python -c "import json; json.loads(open('.zenodo.json').read())"
75 changes: 54 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,35 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
numpy_ver: [latest]
python-version: ["3.11", "3.12"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
numpy_ver: ["latest"]
test_config: ["latest"]
include:
- python-version: "3.8"
numpy_ver: "1.20"
- python-version: "3.10"
numpy_ver: "1.24"
os: "ubuntu-latest"
test_config: "NEP29"

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements for testing setup
run: |
pip install -r test_requirements.txt

- name: Install NEP29 dependencies
if: ${{ matrix.numpy_ver != 'latest'}}
if: ${{ matrix.test_config == 'NEP29'}}
run: |
pip install --no-binary :numpy: numpy==${{ matrix.numpy_ver }}
# Need to force a version of pandas compliant with NEP29
pip install "pandas<1.5"
pip install numpy==${{ matrix.numpy_ver }}
pip install --upgrade-strategy only-if-needed .[test]

- name: Install dependencies
- name: Install standard dependencies
if: ${{ matrix.test_config == 'latest'}}
run: |
pip install -r requirements.txt
pip install .[test]

- name: Set up pysat
run: |
Expand All @@ -54,9 +52,44 @@ jobs:
run: flake8 . --count --exit-zero --max-complexity=10 --statistics

- name: Test with pytest
run: pytest --cov=pysatSeasons/
run: pytest

- name: Coveralls Parallel (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz
./coveralls report --parallel --repo-token=${{ secrets.COVERALLS_REPO_TOKEN }} --build-number ${{ github.run_number }}

- name: Publish results to coveralls
- name: Coveralls Parallel (Windows)
if: startsWith(matrix.os, 'windows')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --rcfile=setup.cfg --service=github
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -L https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe -o coveralls.exe
./coveralls.exe report --parallel --repo-token=${{ secrets.COVERALLS_REPO_TOKEN }} --build-number ${{ github.run_number }}

- name: Coveralls Parallel (MacOS)
if: startsWith(matrix.os, 'macos')
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
coveralls --rcfile=pyproject.toml --service=github

finish:
name: Finish Coverage Analysis
needs: build
if: always()
runs-on: "ubuntu-latest"
steps:
- name: Coveralls Finish
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz
./coveralls done --build-number ${{ github.run_number }}
8 changes: 4 additions & 4 deletions .github/workflows/pip_rc_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

name: Test install of latest RC from pip

on: [push]
on: [workflow_dispatch]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10"] # Keep this version at the highest supported Python version
python-version: ["3.12"] # Keep this version at the highest supported Python version

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/pysat_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,22 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
python-version: ["3.11"]

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pysat RC
run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysat

- name: Install standard dependencies
run: |
pip install -r requirements.txt
pip install -r test_requirements.txt
- name: Install with standard dependencies
run: pip install .[test]

- name: Set up pysat
run: |
Expand All @@ -41,4 +39,17 @@ jobs:
- name: Publish results to coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
run: coveralls --rcfile=setup.cfg --service=github

finish:
name: Finish Coverage Analysis
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install --upgrade coveralls
coveralls --service=github --finish
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.X.X] - 202X-XX-XX
## [0.2.1] - 202X-XX-XX
- Maintenance
- Update pytest syntax
- Update Github Actions workflows
- Add workflow for testing with pysat RC
- Add workflow for testing the install of pysatSeasons RC from pip
- Dropped tests for deprecated pysat instruments
- Implement pyproject.toml

## [0.2.0] - 2022-08-12
- New Features
Expand Down
2 changes: 1 addition & 1 deletion demo/cosmic_and_ivm_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'the currently installed version. Please see the demo ',
'code in pysatSeasons v0.1.3 for COSMIC support when in ',
'pandas data format.'])
raise(ValueError, estr)
raise (ValueError, estr)


def add_magnetic_coordinates(inst):
Expand Down
91 changes: 91 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[build-system]
requires = ["setuptools >= 38.6", "pip >= 10"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["pysatSeasons"]

[project]
name = "pysatSeasons"
version = "0.2.0"
description = "Seasonal analysis routines for pysat"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "Russell Stoneback, 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.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows"
]
keywords = [
"pysat",
"ionosphere",
"magnetosphere",
"solar wind",
"thermosphere",
"average",
"analysis",
"season",
"climatology"
]
dependencies = [
"matplotlib",
"numpy",
"pandas",
"pysat >= 3.0.4",
"xarray"
]

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

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

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

[tool.pytest.ini_options]
addopts = "--cov=pysatSeasons --cov-report xml"
markers = [
"all_inst",
"download",
"no_download",
"load_options",
"new_tests",
"first",
"second"
]
9 changes: 5 additions & 4 deletions pysatSeasons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

"""

import os
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata

# Import key modules and skip F401 testing in flake8
from pysatSeasons._core import to_xarray_dataset # noqa: F401
Expand All @@ -27,6 +30,4 @@
from pysatSeasons import plot # noqa: F401

# set version
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'version.txt')) as version_file:
__version__ = version_file.read().strip()
__version__ = metadata.version('pysatSeasons')
4 changes: 2 additions & 2 deletions pysatSeasons/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def to_xarray_dataset(data):
Parameters
----------
data : list-like
List-like (including ndarray, Series, DataFrames, Datasets or list-like of these object) to be converted
or combined into a single Dataset.
List-like (including ndarray, Series, DataFrames, Datasets or list-like
of these object) to be converted or combined into a single Dataset.

Returns
-------
Expand Down
Loading