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

Rcv0 2 0 #30

Merged
merged 202 commits into from
Sep 1, 2022
Merged

Rcv0 2 0 #30

merged 202 commits into from
Sep 1, 2022

Conversation

rstoneback
Copy link
Collaborator

@rstoneback rstoneback commented Feb 18, 2022

Description

Addresses #3, #15, #28, #29

A large range of changes to get pysatSeasons generally up to the modern era.

  • Switched to workflows and pytest
  • Condensed testing
  • Added Consellation support to more functions, with testing
  • Added xarray support to functions, with testing
  • Removed deprecated library use
  • Improved docstrings and general style
  • Adopted updated setup.py and setup.cfg
  • Removed collections.deque use
  • computational_form -> to_xarray_dataset
  • Simplified code for seasonal averaging functions
  • Updated examples

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details for
your test configuration

  • Existing unit tests
  • Developed additional unit tests
  • Ran updated documentation examples

Test Configuration:

  • Operating system: MacOS
  • Version number: Python 3.9
  • Any details about your local setup that are relevant: pysat 'develop' branch and v3.0.1 release.

Checklist:

  • Update the version number
  • Verify and update Zenodo information in .zenodo.json
  • doc tests pass locally
  • activate this branch on readthedocs (https://pysatseasons.readthedocs.io/en/rcv0-2-0/)
  • Upload the test distribution to the testPyPi server
  • Contacted developers and users about the future release
  • Performed integration tests with downstream packages (include list of these packages)
  • Create a wiki page with the release text (https://github.com/pysat/pysat/wiki/pysatSeasonsv0.2.0-Release-Text)
  • After approval, confirm all changes from the RC pull are listed in the wiki release text.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes

Copy link
Member

@jklenzing jklenzing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some updates to the core documents. We should probably finalize this soon, as dependabot is getting cranky about the numpy version cap in main.

.github/workflows/main.yml Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
@@ -2,6 +2,31 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.2.0] - 2022-06-10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to update

README.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com>
@rstoneback
Copy link
Collaborator Author

hmm........ we broke something

mkdir pysatData
[3](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:3)
  python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'"
[4](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:4)
  shell: /usr/bin/bash -e {0}
[5](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:5)
  env:
[6](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:6)
    pythonLocation: /opt/hostedtoolcache/Python/3.8.13/x64
[7](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:7)
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.13/x64/lib
[8](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:9)
Traceback (most recent call last):
[9](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:10)
  File "<string>", line 1, in <module>
[10](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:11)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/pysat/__init__.py", line 49, in <module>
[11](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:12)
    from pysat import _params
[12](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:13)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/pysat/_params.py", line 13, in <module>
[13](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:14)
    import pysat.utils
[14](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:15)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/pysat/utils/__init__.py", line 9, in <module>
[15](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:16)
    from pysat.utils._core import available_instruments
[16](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:17)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/pysat/utils/_core.py", line 15, in <module>
[17](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:18)
    import xarray as xr
[18](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:19)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/xarray/__init__.py", line 1, in <module>
[19](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:20)
    from . import testing, tutorial
[20](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:21)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/xarray/testing.py", line 9, in <module>
[21](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:22)
    from xarray.core import duck_array_ops, formatting, utils
[22](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:23)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/xarray/core/duck_array_ops.py", line 26, in <module>
[23](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:24)
    from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
[24](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:25)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/xarray/core/npcompat.py", line 72, in <module>
[25](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:26)
    _SupportsDType[np.dtype],
[26](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:27)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/typing.py", line 261, in inner
[27](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:28)
    return func(*args, **kwds)
[28](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:29)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/typing.py", line 897, in __class_getitem__
[29](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:30)
    _check_generic(cls, params)
[30](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:31)
  File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/typing.py", line 211, in _check_generic
[31](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:32)
    raise TypeError(f"{cls} is not a generic class")
[32](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:33)
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
[33](https://github.com/pysat/pysatSeasons/runs/7635355776?check_suite_focus=true#step:7:34)
Error: Process completed with exit code 1.

@rstoneback
Copy link
Collaborator Author

Tests are passing with latest pysat.

Copy link
Member

@jklenzing jklenzing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I already approved, but this would reduce the meta deprecation warnings throughout.

pysatSeasons/tests/test_core.py Outdated Show resolved Hide resolved
pysatSeasons/tests/test_core.py Outdated Show resolved Hide resolved
Co-authored-by: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com>
README.md Outdated
The caps on numpy and python stem from compatibility with the maximum
supported pandas version. Version 0.2.0 will rewrite the routines to remove
`Panel`.
and for the Space Physics community.

| Common modules | Community modules |
| -------------- | ----------------- |
| matplotlib | pysat |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should pysat be version limited?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, after some digging I found the we need Constellation instantiation support given a list of instruments, which was added to pysat in v3.0.1. Tests were passing here with that pysat version. Added the req to requirements.txt and the readme.

demo/cosmic_and_ivm_demo.py Outdated Show resolved Hide resolved
pysatSeasons/avg.py Outdated Show resolved Hide resolved
pysatSeasons/avg.py Outdated Show resolved Hide resolved
rstoneback and others added 2 commits August 5, 2022 14:34
Co-authored-by: Angeline Burrell <aburrell@users.noreply.github.com>
README.md Outdated
| numpy<1.20 | |
| pandas<0.24 | |

| matplotlib | pysat >= 3.0.1 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| matplotlib | pysat >= 3.0.1 |
| matplotlib | pysat >= 3.0.2 |

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the safest thing? If not needed, that's fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for the unit tests since we added the use_header kwarg to those. I don't think it's needed in the core code.

requirements.txt Outdated
Comment on lines 4 to 5
pysat>=3.0.1
xarray<2022.06.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If going this direction, update the xarray limit in the README

setup.cfg Outdated
Comment on lines 47 to 50
numpy
pandas
pysat>=3.0.2
xarray<2022.06.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be any version caps here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the version limits aren't applied, or checked, during installation without specifying them here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From docs on install_requires, https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/,

Additionally, it’s best practice to indicate any known lower or upper bounds.

The root version requirement on xarray should be placed on pysat, and re-released, so that the environments here work more out of the box.

Copy link
Member

@aburrell aburrell Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From your link:

Lastly, it’s important to understand that install_requires is a listing of “Abstract” requirements, i.e just names and version restrictions that don’t determine where the dependencies will be fulfilled from (i.e. from what index or source). The where (i.e. how they are to be made “Concrete”) is to be determined at install time using pip options. 1

Requirements files
Requirements Files described most simply, are just a list of pip install arguments placed into a file.

Whereas install_requires defines the dependencies for a single project, Requirements Files are often used to define the requirements for a

While the limits don't appear to be breaking the setup the way that they used to, it still seems cleaner to use the requirements file for this. Might be best to discuss our standards at the next meeting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From your link:

Lastly, it’s important to understand that install_requires is a listing of “Abstract” requirements, i.e just names and version restrictions

While the limits don't appear to be breaking the setup the way that they used to, it still seems cleaner to use the requirements file for this. Might be best to discuss our standards at the next meeting.

I'll put it on the agenda for Wed. though it is possible I may not be available. Government depending.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the linked discussion from pysatSpaceWeather: pypa/setuptools#1951

This particular comment notes the anti-pattern is loading requirements.txt into install_requires. Further notes that the biggest issue with loading requirements.txt is the potential for pinned versions set with a ==. Notes a compromise would be to allow requirements.txt to be loaded into install_requires as long as pinned versions aren't used.
pypa/setuptools#1951 (comment)

The python docs https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/ say

install_requires is a [setuptools](https://packaging.python.org/en/latest/key_projects/#setuptools) setup.py keyword that should be used to specify what a project minimally needs to run correctly. When the project is installed by [pip](https://packaging.python.org/en/latest/key_projects/#pip), this is the specification that is used to install its dependencies.

I checked to see what was above this doc for greater context to see if this install_requires discussion was limited to a particular sub-situation but didn't see anything.

From what I've read setting minimal version requirements in install_requires in setup.cfg for pip installs is the correct thing to do. pip uses the information from setup to determine dependencies. For user pip installs of pysatPenumbra packages to work reliably we should specify a minimum pysat version in setup, 3.0.4, when that version is released. A similar condition would also be in requirements.txt, but strictly speaking the requirements and setup restrictions are there for different reasons thus may not always be the same. requirements.txt is not loaded into install_requires.

I'm not opposed to using a .toml file but I don't understand why that is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it comes down to the idea that the format of a cfg is loosely defined. See https://peps.python.org/pep-0518/#sticking-with-setup-cfg for why toml was recommended above cfg

@rstoneback
Copy link
Collaborator Author

check if matplotlib dependence is real

@rstoneback
Copy link
Collaborator Author

Tests stopped working due to some kind of numpy and xarray issue. Not knowing what is going on, I bumped the numpy version up to 1.21....
https://github.com/pysat/pysatSeasons/runs/8124117985?check_suite_focus=true

How is it that working software always breaks just before release? 🤷

@rstoneback
Copy link
Collaborator Author

Now a lone windows test failure from matplotlib with the suggestion that perhaps Tcl wasn't installed properly.

@rstoneback rstoneback merged commit bde709b into main Sep 1, 2022
@rstoneback rstoneback deleted the rcv0-2-0 branch October 28, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants