From 42be7529db76f595394871a753a921abaa0db7e8 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Fri, 22 Mar 2024 10:33:36 +0000 Subject: [PATCH 1/2] Sunpy package template (#347) * Initial application of sunpy template * Some cleanup * Split astropy and sunpy isort sections * Apply codespell * Bump minimum python to 3.10 * Fix doc build * Seriously what's happening * Fix tests I guess * Drop 3.9 builds * Fix oldestdeps * Another template update * Small ci tweaks * cleanup * better colour --- .codecov.yaml | 11 ++ .codespellrc | 13 ++ .coveragerc | 34 ++++ .cruft.json | 31 ++++ .flake8 | 32 ++++ .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/workflows/main.yml | 29 ++- .github/workflows/sub_package_update.yml | 84 +++++++++ .gitignore | 109 ++++++++---- .isort.cfg | 15 ++ .pre-commit-config.yaml | 42 +++-- .readthedocs.yaml | 29 +++ .readthedocs.yml | 23 --- .rtd-environment.yml | 7 + .ruff.toml | 44 +++++ CHANGELOG.rst | 14 +- MANIFEST.in | 18 +- changelog/347.feature.rst | 1 + conftest.py | 1 - dkist/_dev/__init__.py | 6 + dkist/_dev/scm_version.py | 12 ++ dkist/conftest.py | 5 +- dkist/dataset/dataset.py | 3 +- dkist/dataset/utils.py | 2 +- dkist/io/file_manager.py | 4 +- dkist/io/loaders.py | 1 + dkist/logger.py | 2 +- dkist/net/__init__.py | 2 +- dkist/net/attr_walker.py | 1 + dkist/net/attrs.py | 1 + dkist/net/attrs_values.py | 2 +- dkist/net/client.py | 1 + dkist/net/helpers.py | 1 + dkist/net/tests/conftest.py | 2 +- dkist/net/tests/strategies.py | 1 + dkist/net/tests/test_attr_walker.py | 1 + dkist/tests/__init__.py | 1 - dkist/tests/coveragerc | 31 ---- dkist/tests/generate_aia_dataset.py | 8 +- dkist/tests/generate_eit_test_dataset.py | 10 +- dkist/tests/generate_eit_tiled_dataset.py | 14 +- dkist/tests/setup_package.py | 11 -- dkist/utils/_model_to_graphviz.py | 2 +- dkist/version.py | 17 ++ dkist/wcs/models.py | 2 +- docs/Makefile | 139 ++------------- docs/make.bat | 205 ++++------------------ docs/topic_guides/loading.rst | 2 +- docs/topic_guides/net.rst | 2 +- docs/tutorial/3_the_dataset.md | 4 +- docs/tutorial/3_the_dataset_NOTES.md | 2 +- docs/tutorial/4_more_dataset.md | 2 +- docs/tutorial/5_downloading_data.md | 8 +- pyproject.toml | 102 +++++++++-- pytest.ini | 79 +++++++++ setup.cfg | 193 -------------------- setup.py | 3 +- tox.ini | 87 ++++----- 58 files changed, 782 insertions(+), 728 deletions(-) create mode 100644 .codecov.yaml create mode 100644 .codespellrc create mode 100644 .coveragerc create mode 100644 .cruft.json create mode 100644 .flake8 create mode 100644 .github/workflows/sub_package_update.yml create mode 100644 .isort.cfg create mode 100644 .readthedocs.yaml delete mode 100644 .readthedocs.yml create mode 100644 .rtd-environment.yml create mode 100644 .ruff.toml create mode 100644 changelog/347.feature.rst create mode 100644 dkist/_dev/__init__.py create mode 100644 dkist/_dev/scm_version.py delete mode 100644 dkist/tests/coveragerc delete mode 100644 dkist/tests/setup_package.py create mode 100644 dkist/version.py create mode 100644 pytest.ini diff --git a/.codecov.yaml b/.codecov.yaml new file mode 100644 index 00000000..8fe09b73 --- /dev/null +++ b/.codecov.yaml @@ -0,0 +1,11 @@ +comment: off +coverage: + status: + project: + default: + threshold: 0.2% + +codecov: + require_ci_to_pass: false + notify: + wait_for_ci: true diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..dd4d6482 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,13 @@ +[codespell] +skip = *.asdf,*.fits,*.fts,*.header,*.json,*.xsh,*cache*,*egg*,*extern*,.git,.idea,.tox,_build,*truncated,*.svg,.asv_env,.history,*.hdr +ignore-words-list = + alog, + nd, + nin, + observ, + ot, + te, + upto, + afile, + precessed, + precess diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..aafb19d4 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,34 @@ +[run] +omit = + dkist/conftest.py + dkist/*setup_package* + dkist/extern/* + dkist/version* + dkist/__init__* + dkist/utils/_model_to_graphviz.py + */dkist/conftest.py + */dkist/*setup_package* + */dkist/extern/* + */dkist/version* + */dkist/__init__* + */dkist/utils/_model_to_graphviz.py + +[report] +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + # Don't complain about packages we have installed + except ImportError + # Don't complain if tests don't hit assertions + raise AssertionError + raise NotImplementedError + # Don't complain about script hooks + def main(.*): + # Ignore branches that don't pertain to this version of Python + pragma: py{ignore_python_version} + # Don't complain about IPython completion helper + def _ipython_key_completions_ + # typing.TYPE_CHECKING is False at runtime + if TYPE_CHECKING: + # Ignore typing overloads + @overload diff --git a/.cruft.json b/.cruft.json new file mode 100644 index 00000000..ffdf99c4 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,31 @@ +{ + "template": "https://github.com/sunpy/package-template", + "commit": "29a55419c27cd7a72bfd60fee7cd92fb59769425", + "checkout": null, + "context": { + "cookiecutter": { + "package_name": "dkist", + "module_name": "dkist", + "short_description": "DKIST User Tools", + "author_name": "NSO / AURA", + "author_email": "stuart@cadair.com", + "project_url": "https://github.com/DKISTDC/dkist", + "license": "BSD 3-Clause", + "minimum_python_version": "3.10", + "use_compiled_extensions": "n", + "enable_dynamic_dev_versions": "y", + "include_example_code": "n", + "include_cruft_update_github_workflow": "y", + "_sphinx_theme": "alabaster", + "_parent_project": "", + "_install_requires": "", + "_copy_without_render": [ + "docs/_templates", + "docs/_static", + ".github/workflows/sub_package_update.yml" + ], + "_template": "https://github.com/sunpy/package-template" + } + }, + "directory": null +} diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..047b6457 --- /dev/null +++ b/.flake8 @@ -0,0 +1,32 @@ +[flake8] +ignore = + # missing-whitespace-around-operator + E225 + # missing-whitespace-around-arithmetic-operator + E226 + # line-too-long + E501 + # unused-import + F401 + # undefined-local-with-import-star + F403 + # redefined-while-unused + F811 + # Line break occurred before a binary operator + W503, + # Line break occurred after a binary operator + W504 +max-line-length = 100 +exclude = + .git + __pycache__ + docs/conf.py + build + dkist/__init__.py + extern + sphinx + conftest.py + +rst-directives = + plot +docstring-convention = numpy diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 5bdce91c..e0e40286 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: true contact_links: - name: DKIST Help Desk url: https://nso.atlassian.net/servicedesk/customer/portals - about: The offical DKIST support help desk, the best place to ask questions on data access or products etc. + about: The official DKIST support help desk, the best place to ask questions on data access or products etc. - name: DKIST Community Chat url: https://openastronomy.element.io/#/room/#dki-solar-telescope:openastronomy.org about: A community support forum to help other community members. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1722feb2..01a6746f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,24 +33,47 @@ jobs: with: default_python: '3.10' coverage: 'codecov' + posargs: '--color=yes' envs: | - linux: py312 - linux: py311 - - windows: py310-online - - macos: py39 + - windows: py311-online + - macos: py310 + - linux: py310-oldestdeps + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + docs: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + default_python: '3.10' + coverage: 'codecov' + envs: | - linux: build_docs-notebooks pytest: false libraries: apt: - graphviz - - linux: py39-oldestdeps secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + sdist_verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - run: python -m pip install -U --user build + - run: python -m build . --sdist + - run: python -m pip install -U --user twine + - run: python -m twine check dist/* + allowed-fail-tests: uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main with: coverage: 'codecov' + posargs: '--color=yes' envs: | - linux: py311-devdeps secrets: diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml new file mode 100644 index 00000000..94a9e7e1 --- /dev/null +++ b/.github/workflows/sub_package_update.yml @@ -0,0 +1,84 @@ +# This template is taken from the cruft example code, for further information please see: +# https://cruft.github.io/cruft/#automating-updates-with-github-actions +name: Automatic Update from package template +permissions: + contents: write + pull-requests: write + +on: + # Allow manual runs through the web UI + workflow_dispatch: + schedule: + # ┌───────── minute (0 - 59) + # │ ┌───────── hour (0 - 23) + # │ │ ┌───────── day of the month (1 - 31) + # │ │ │ ┌───────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT) + - cron: '0 7 * * 1' # Every Monday at 7am UTC + +jobs: + update: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + include: + - add-paths: . + body: apply the changes to this repo. + branch: cruft/update + commit-message: "Automatic package template update" + title: Updates from the package template + - add-paths: .cruft.json + body: reject these changes for this repo. + branch: cruft/reject + commit-message: "Reject this package template update" + title: Reject new updates from package template + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Cruft + run: python -m pip install cruft + + - name: Check if update is available + continue-on-error: false + id: check + run: | + CHANGES=0 + if [ -f .cruft.json ]; then + if ! cruft check; then + CHANGES=1 + fi + else + echo "No .cruft.json file" + fi + + echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT" + + - name: Run update if available + if: steps.check.outputs.has_changes == '1' + run: | + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + git config --global user.name "${{ github.actor }}" + + cruft update --skip-apply-ask --refresh-private-variables + git restore --staged . + + - name: Create pull request + if: steps.check.outputs.has_changes == '1' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + add-paths: ${{ matrix.add-paths }} + commit-message: ${{ matrix.commit-message }} + branch: ${{ matrix.branch }} + delete-branch: true + branch-suffix: timestamp + title: ${{ matrix.title }} + body: | + This is an autogenerated PR, which will ${{ matrix.body }}. + [Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template diff --git a/.gitignore b/.gitignore index e5439b6b..60e2bd1a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ __pycache__/ *.py[cod] *$py.class +tmp/ # C extensions *.so @@ -23,11 +24,12 @@ parts/ sdist/ var/ wheels/ +share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST - +dkist/_version.py # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. @@ -41,15 +43,17 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ +.nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover +*.py,cover .hypothesis/ .pytest_cache/ -junit/ +cover/ # Translations *.mo @@ -59,6 +63,7 @@ junit/ *.log local_settings.py db.sqlite3 +db.sqlite3-journal # Flask stuff: instance/ @@ -69,20 +74,46 @@ instance/ # Sphinx documentation docs/_build/ -docs/.jupyter_cache/ -docs/jupyter_execute/ +# automodapi +docs/api # PyBuilder +.pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints -# pyenv -.python-version +# IPython +profile_default/ +ipython_config.py -# celery beat schedule file +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff celerybeat-schedule +celerybeat.pid # SageMath parsed files *.sage.py @@ -96,10 +127,6 @@ ENV/ env.bak/ venv.bak/ -# Spyder project settings -.spyderproject -.spyproject - # Rope project settings .ropeproject @@ -109,8 +136,22 @@ venv.bak/ # mypy .mypy_cache/ -### https://raw.github.com/github/gitignore/master/Global/OSX.gitignore +# Pyre type checker +.pyre/ + +# IDE +# PyCharm +.idea + +# Spyder project settings +.spyderproject +.spyproject + +### VScode: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore +.vscode/* +.vs/* +### https://raw.github.com/github/gitignore/master/Global/OSX.gitignore .DS_Store .AppleDouble .LSOverride @@ -118,7 +159,6 @@ venv.bak/ # Icon must ends with two \r. Icon - # Thumbnails ._* @@ -127,7 +167,6 @@ Icon .Trashes ### Linux: https://raw.githubusercontent.com/github/gitignore/master/Global/Linux.gitignore - *~ # temporary files which can be created if a process still has a handle open of a deleted file @@ -142,7 +181,8 @@ Icon # .nfs files are created when an open file is removed but is still being accessed .nfs* -### MacOS: https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore +# pytype static type analyzer +.pytype/ # General .DS_Store @@ -198,33 +238,24 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -### VSCode -.vscode/ - -# Local History for Visual Studio Code -.history/ - -# Built Visual Studio Code Extensions -*.vsix - ### Extra Python Items and SunPy Specific -.hypothesis -.pytest_cache -sunpydata.sqlite -sunpydata.sqlite-journal -sunpy/_compiler.c -sunpy/cython_version.py -docs/_build -docs/generated -docs/api/ docs/whatsnew/latest_changelog.txt -examples/**/*.asdf -# This is incase you run the figure tests +examples/**/*.csv figure_test_images* - -### Pycharm -.idea +tags +baseline # Release script .github_cache -requirements-min.txt + +# Misc Stuff +.history +*.orig +.tmp +node_modules/ +package-lock.json +package.json +.prettierrc + +# Log files generated by 'vagrant up' +*.log diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..49734bae --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,15 @@ +[settings] +balanced_wrapping = true +skip = + docs/conf.py + dkist/__init__.py +default_section = THIRDPARTY +include_trailing_comma = false +known_astropy = astropy, asdf, gwcs, asdf_astropy +known_sunpy = sunpy, ndcube +known_first_party = dkist, dkist_inventory +length_sort = false +length_sort_sections = stdlib +line_length = 99 +multi_line_output = 0 +sections = FUTURE,STDLIB,THIRDPARTY,ASTROPY,SUNPY,FIRSTPARTY,LOCALFOLDER diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae8c51a8..93fa42e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,35 @@ repos: + # This should be before any formatting hooks like isort + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.2.2" + hooks: + - id: ruff + args: ["--fix"] + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 + hooks: + - id: isort + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|dkist/extern)$" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - - id: check-yaml - id: check-ast - - id: debug-statements - - id: check-added-large-files - args: ['--maxkb=750'] - id: check-case-conflict - id: trailing-whitespace - exclude: ".*(.fits|.asdf)" - - id: mixed-line-ending - files: ".*.py" + exclude: ".*(.fits|.fts|.fit|.header|.txt|.hdr|.asdf)" + - id: check-yaml + - id: debug-statements + - id: check-added-large-files + args: ["--enforce-all", "--maxkb=1054"] - id: end-of-file-fixer - exclude: ".*(.fits|.asdf|.json)" - - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 - hooks: - - id: flake8 - additional_dependencies: [flake8-docstrings] - args: ['--select', 'E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902,F401'] - - repo: https://github.com/pycqa/isort - rev: 5.13.2 + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json|.asdf)$|^CITATION.rst$" + - id: mixed-line-ending + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.asdf|.json|.hdr)$" + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 hooks: - - id: isort - additional_dependencies: [toml] + - id: codespell + args: [ "--write-changes" ] ci: autofix_prs: false + autoupdate_schedule: "weekly" diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..790abab4 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,29 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "mambaforge-4.10" + jobs: + post_checkout: + - git fetch --unshallow || true + pre_install: + - git update-index --assume-unchanged .rtd-environment.yml docs/conf.py + +conda: + environment: .rtd-environment.yml + +sphinx: + builder: html + configuration: docs/conf.py + fail_on_warning: false + +formats: + - htmlzip + +python: + install: + - method: pip + extra_requirements: + - docs + path: . diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 5a7dfaee..00000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -# Optionally build your docs in additional formats such as PDF -formats: - - htmlzip - -build: - os: ubuntu-22.04 - apt_packages: - - graphviz - tools: - python: "3.10" - -python: - install: - - method: pip - path: . - extra_requirements: - - docs diff --git a/.rtd-environment.yml b/.rtd-environment.yml new file mode 100644 index 00000000..f3d2fdbe --- /dev/null +++ b/.rtd-environment.yml @@ -0,0 +1,7 @@ +name: dkist +channels: + - conda-forge +dependencies: + - python=3.10 + - pip + - graphviz!=2.42.*,!=2.43.* diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 00000000..54746ed9 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,44 @@ +target-version = "py310" +line-length = 110 +exclude = [ + ".git,", + "__pycache__", + "build", + "dkist/version.py", +] + +[lint] +select = ["E", "F"] +extend-ignore = [ + # pycodestyle (E, W) + "E501", # LineTooLong # TODO! fix + "E702", + "E711", + "E741", + "F405", + "F403", + "F821", + "F841", + # pytest (PT) + "PT001", # Always use pytest.fixture() + "PT004", # Fixtures which don't return anything should have leading _ + "PT007", # Parametrize should be lists of tuples # TODO! fix + "PT011", # Too broad exception assert # TODO! fix + "PT023", # Always use () on pytest decorators +] + +[lint.per-file-ignores] +# Part of configuration, not a package. +"setup.py" = ["INP001"] +"conftest.py" = ["INP001"] +"docs/conf.py" = [ + "E402" # Module imports not at top of file +] +"docs/*.py" = [ + "INP001", # Implicit-namespace-package. The examples are not a package. +] +"__init__.py" = ["E402", "F401", "F403"] +"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"] + +[lint.pydocstyle] +convention = "numpy" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d5f08466..ed131872 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -52,7 +52,7 @@ Bug Fixes --------- - Bump minimum version of asdf to 2.11.2 to pick up jsonschema bugfix. (`#313 `_) -- Change the ``appdirs`` dependancy for the maintained ``platformdirs`` package. (`#318 `_) +- Change the ``appdirs`` dependency for the maintained ``platformdirs`` package. (`#318 `_) - Fix an unpinned minimum version of ``asdf-wcs-schemas`` causing potential read errors on newest asdf files with dkist 1.1.0. (`#320 `_) @@ -222,7 +222,7 @@ Features -------- - Add ability to page through the DKIST results and affect the page size. (`#212 `_) -- Fix, and make requried, the unit property on a dataset in ASDF files. (`#221 `_) +- Fix, and make required, the unit property on a dataset in ASDF files. (`#221 `_) Bug Fixes @@ -320,7 +320,7 @@ Features -------- - Implement Astropy models to support spatial transforms which change with - a thrid pixel axis. (`#148 `_) + a third pixel axis. (`#148 `_) - Add ASDF serialization for `VaryingCelestialTransform` and `CoupledCompoundModel`. (`#156 `_) @@ -334,7 +334,7 @@ Trivial/Internal Changes ------------------------ - Migate to the asdf 2.8+ ``Converter`` interface, this bumps various - dependancies but should have no effect on reading or writing asdf files. (`#152 `_) + dependencies but should have no effect on reading or writing asdf files. (`#152 `_) v1.0.0b3 (2021-11-30) @@ -365,7 +365,7 @@ Features to the `.FileManager` which generated them, which means that the basepath can be dynamically generated by reference. (`#126 `_) - Modify the `dkist.io.FileManager` class so that most of the functionality - exists in the new base class and the dowload method is in the separate child + exists in the new base class and the download method is in the separate child class. In addition make more of the API private to not confuse end users. (`#130 `_) @@ -409,7 +409,7 @@ Trivial/Internal Changes ------------------------ - Support gwcs 0.14 and ndcube 2.0.0b1 (`#86 `_) -- Update Fido client for changes in sunpy 2.1; bump the sunpy dependancy to at least 2.1rc3. (`#89 `_) +- Update Fido client for changes in sunpy 2.1; bump the sunpy dependency to at least 2.1rc3. (`#89 `_) v0.1a2 (2020-04-29) @@ -481,7 +481,7 @@ Bug Fixes - Fix incorrect compound model tree splitting when the split needed to happen at the top layer (`#23 `_) - Fix a lot of bugs in dataset generation and wcs slicing. (`#24 `_) - Fix incorrect chunks when creating a dask array from a loader_array. (`#26 `_) -- Add support for dask 2+ and make that the minmum version (`#68 `_) +- Add support for dask 2+ and make that the minimum version (`#68 `_) Trivial/Internal Changes diff --git a/MANIFEST.in b/MANIFEST.in index 5fdf735a..274cf858 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,15 +1,11 @@ -include README.rst -include CHANGELOG.rst - -include setup.cfg -include pyproject.toml - -recursive-include dkist *.pyx *.c *.pxd -recursive-include docs * -recursive-include licenses * - +# Exclude specific files +# All files which are tracked by git and not explicitly excluded here are included by setuptools_scm +# Prune folders prune build prune docs/_build prune docs/api - global-exclude *.pyc *.o + +# This subpackage is only used in development checkouts +# and should not be included in built tarballs +prune dkist/_dev diff --git a/changelog/347.feature.rst b/changelog/347.feature.rst new file mode 100644 index 00000000..85888a33 --- /dev/null +++ b/changelog/347.feature.rst @@ -0,0 +1 @@ +Our minimum Python version is now 3.10 inline with `SPEC-0 `__. diff --git a/conftest.py b/conftest.py index d6c72fd5..6bbc74e6 100644 --- a/conftest.py +++ b/conftest.py @@ -1,5 +1,4 @@ import matplotlib -import pytest matplotlib.use("Agg") diff --git a/dkist/_dev/__init__.py b/dkist/_dev/__init__.py new file mode 100644 index 00000000..72583c08 --- /dev/null +++ b/dkist/_dev/__init__.py @@ -0,0 +1,6 @@ +""" +This package contains utilities that are only used when developing drms in a +copy of the source repository. +These files are not installed, and should not be assumed to exist at +runtime. +""" diff --git a/dkist/_dev/scm_version.py b/dkist/_dev/scm_version.py new file mode 100644 index 00000000..1bcf0dd9 --- /dev/null +++ b/dkist/_dev/scm_version.py @@ -0,0 +1,12 @@ +# Try to use setuptools_scm to get the current version; this is only used +# in development installations from the git repository. +import os.path + +try: + from setuptools_scm import get_version + + version = get_version(root=os.path.join('..', '..'), relative_to=__file__) +except ImportError: + raise +except Exception as e: + raise ValueError('setuptools_scm can not determine version.') from e diff --git a/dkist/conftest.py b/dkist/conftest.py index 03344457..48940e17 100644 --- a/dkist/conftest.py +++ b/dkist/conftest.py @@ -14,6 +14,7 @@ from astropy.modeling import Model, Parameter from astropy.table import Table from astropy.time import Time + from sunpy.coordinates.frames import Helioprojective from dkist import load_dataset, log @@ -27,7 +28,7 @@ @pytest.fixture def caplog_dkist(caplog): """ - A `dkist.log` specifc equivalent to caplog. + A `dkist.log` specific equivalent to caplog. """ log.addHandler(caplog.handler) return caplog @@ -287,7 +288,7 @@ def small_visp_dataset(): This fixture is used to test when the array in the FITS file has a length one NAXIS 3. """ - # This asdf file wont work with sunpy less than 4 + # This asdf file won't work with sunpy less than 4 pytest.importorskip("sunpy", "4.0.0") # This dataset was generated by the following code: diff --git a/dkist/dataset/dataset.py b/dkist/dataset/dataset.py index 9fe3f32c..fee5cf17 100644 --- a/dkist/dataset/dataset.py +++ b/dkist/dataset/dataset.py @@ -4,6 +4,7 @@ import gwcs from astropy.wcs.wcsapi.wrappers import SlicedLowLevelWCS + from ndcube.ndcube import NDCube, NDCubeLinkedDescriptor from dkist.io.file_manager import FileManager @@ -190,7 +191,7 @@ def files(self): @property def inventory(self): """ - Convenience attribute to acces the inventory metadata. + Convenience attribute to access the inventory metadata. """ return self.meta['inventory'] diff --git a/dkist/dataset/utils.py b/dkist/dataset/utils.py index b91252d1..8619370c 100644 --- a/dkist/dataset/utils.py +++ b/dkist/dataset/utils.py @@ -125,7 +125,7 @@ def pp_matrix(wcs): def extract_pc_matrix(headers, naxes=None): """ - Given an astropy table of headers extract one or more PC matricies. + Given an astropy table of headers extract one or more PC matrices. """ if naxes is None: naxes = headers[0]["NAXIS"] diff --git a/dkist/io/file_manager.py b/dkist/io/file_manager.py index fe05c581..59abaa00 100644 --- a/dkist/io/file_manager.py +++ b/dkist/io/file_manager.py @@ -336,7 +336,7 @@ def quality_report(self, path=None, overwrite=None): Returns ------- results: `parfive.Results` - A `~parfive.Results` obejct containing the filepath of the + A `~parfive.Results` object containing the filepath of the downloaded file if the download was successful, and any errors if it was not. """ @@ -364,7 +364,7 @@ def preview_movie(self, path=None, overwrite=None): Returns ------- results: `parfive.Results` - A `~parfive.Results` obejct containing the filepath of the + A `~parfive.Results` object containing the filepath of the downloaded file if the download was successful, and any errors if it was not. """ diff --git a/dkist/io/loaders.py b/dkist/io/loaders.py index 540ee310..d1a3b816 100644 --- a/dkist/io/loaders.py +++ b/dkist/io/loaders.py @@ -9,6 +9,7 @@ import numpy as np from astropy.io import fits + from sunpy.util.decorators import add_common_docstring from dkist import log diff --git a/dkist/logger.py b/dkist/logger.py index 1f90ac46..c8f526fb 100644 --- a/dkist/logger.py +++ b/dkist/logger.py @@ -1,7 +1,7 @@ """ This module contains helpers to use the Python logger to show messages to users. -It is heavily insipired by Astropy's logger, but implemented independantly +It is heavily insipired by Astropy's logger, but implemented independently because Astropy warn you against directly using theirs. This module sets up the following things: diff --git a/dkist/net/__init__.py b/dkist/net/__init__.py index 55058e8e..444118f1 100644 --- a/dkist/net/__init__.py +++ b/dkist/net/__init__.py @@ -30,6 +30,6 @@ class Conf(_config.ConfigNamespace): conf = Conf() -# Put imports after conf so that conf is initalized before import +# Put imports after conf so that conf is initialized before import from .client import DKISTClient # noqa from .helpers import transfer_complete_datasets # noqa diff --git a/dkist/net/attr_walker.py b/dkist/net/attr_walker.py index faa13681..2ace7f69 100644 --- a/dkist/net/attr_walker.py +++ b/dkist/net/attr_walker.py @@ -1,4 +1,5 @@ import astropy.units as u + from sunpy.net.attr import AttrAnd, AttrOr, AttrWalker, DataAttr from sunpy.net.attrs import Instrument, Level, Physobs, Provider, Time, Wavelength diff --git a/dkist/net/attrs.py b/dkist/net/attrs.py index 15986d7f..8aa9a4fe 100644 --- a/dkist/net/attrs.py +++ b/dkist/net/attrs.py @@ -4,6 +4,7 @@ Other attributes provided by `sunpy.net.attrs` are supported by the client. """ import astropy.units as _u + import sunpy.net._attrs as _sunpy_attrs from sunpy.coordinates.frames import Helioprojective as _Helioprojective from sunpy.coordinates.utils import get_rectangle_coordinates as _get_rectangle_coordinates diff --git a/dkist/net/attrs_values.py b/dkist/net/attrs_values.py index aa527d5d..7f0461f5 100644 --- a/dkist/net/attrs_values.py +++ b/dkist/net/attrs_values.py @@ -108,7 +108,7 @@ def attempt_local_update(*, timeout: int = 1, user_file: Path = None, silence_er except Exception as err: log.error("Failed to download new attrs values.") log.debug(str(err)) - # If an error has occured then remove the local file so it isn't + # If an error has occurred then remove the local file so it isn't # corrupted or invalid. user_file.unlink(missing_ok=True) if not silence_errors: diff --git a/dkist/net/client.py b/dkist/net/client.py index f1106575..fdb31950 100644 --- a/dkist/net/client.py +++ b/dkist/net/client.py @@ -14,6 +14,7 @@ import astropy.units as u from astropy.table import TableAttribute from astropy.time import Time + from sunpy.net import attr from sunpy.net import attrs as sattrs from sunpy.net.base_client import (BaseClient, QueryResponseRow, diff --git a/dkist/net/helpers.py b/dkist/net/helpers.py index fce4a2ad..512519aa 100644 --- a/dkist/net/helpers.py +++ b/dkist/net/helpers.py @@ -7,6 +7,7 @@ from pathlib import Path from astropy import table + from sunpy.net.attr import or_ from sunpy.net.base_client import QueryResponseRow from sunpy.net.fido_factory import UnifiedResponse diff --git a/dkist/net/tests/conftest.py b/dkist/net/tests/conftest.py index 38b01d9b..c56d1be4 100644 --- a/dkist/net/tests/conftest.py +++ b/dkist/net/tests/conftest.py @@ -25,7 +25,7 @@ def api_param_names(): """ A mapping of attrs to param names in the query string. - Excludes ones with input dependant query params + Excludes ones with input dependent query params """ return { a.Time: ('endTimeMin', 'startTimeMax'), diff --git a/dkist/net/tests/strategies.py b/dkist/net/tests/strategies.py index e02ba33a..27207dd8 100644 --- a/dkist/net/tests/strategies.py +++ b/dkist/net/tests/strategies.py @@ -9,6 +9,7 @@ import astropy.units as u from astropy.time import Time + from sunpy.net import attr from sunpy.net import attrs as a from sunpy.net.attr import AttrAnd diff --git a/dkist/net/tests/test_attr_walker.py b/dkist/net/tests/test_attr_walker.py index 467f670d..d21dc7bc 100644 --- a/dkist/net/tests/test_attr_walker.py +++ b/dkist/net/tests/test_attr_walker.py @@ -4,6 +4,7 @@ import astropy.units as u from astropy.coordinates import ICRS, SkyCoord + from sunpy.net import attr from sunpy.net import attrs as a diff --git a/dkist/tests/__init__.py b/dkist/tests/__init__.py index 838b4573..92ea7073 100644 --- a/dkist/tests/__init__.py +++ b/dkist/tests/__init__.py @@ -1,4 +1,3 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains package tests. """ diff --git a/dkist/tests/coveragerc b/dkist/tests/coveragerc deleted file mode 100644 index 313fbc44..00000000 --- a/dkist/tests/coveragerc +++ /dev/null @@ -1,31 +0,0 @@ -[run] -source = {packagename} -omit = - {packagename}/_dkist_init* - {packagename}/conftest* - {packagename}/cython_version* - {packagename}/setup_package* - {packagename}/*/setup_package* - {packagename}/*/*/setup_package* - {packagename}/tests/* - {packagename}/*/tests/* - {packagename}/*/*/tests/* - {packagename}/version* - -[report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain about packages we have installed - except ImportError - - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - - # Don't complain about script hooks - def main\(.*\): - - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} diff --git a/dkist/tests/generate_aia_dataset.py b/dkist/tests/generate_aia_dataset.py index f745edc5..4bc606a4 100644 --- a/dkist/tests/generate_aia_dataset.py +++ b/dkist/tests/generate_aia_dataset.py @@ -7,19 +7,19 @@ import asdf import astropy.units as u import gwcs -import sunpy.map from astropy.io import fits from astropy.modeling.models import (AffineTransformation2D, Multiply, Pix2Sky_TAN, RotateNative2Celestial, Shift) from astropy.time import Time from gwcs import coordinate_frames as cf + +import sunpy.map from sunpy.net import Fido from sunpy.net import attrs as a from sunpy.net.jsoc import JSOCClient from sunpy.time import parse_time from dkist import load_dataset -from dkist.asdf_maker.helpers import generate_lookup_table def map_to_transform(smap): @@ -92,6 +92,8 @@ def references_from_filenames(filename_array, relative_to=None): def main(): + from dkist_inventory.transforms import generate_lookup_table + path = Path('~/sunpy/data/jsocflare/').expanduser() files = glob.glob(str(path / '*.fits')) @@ -145,7 +147,7 @@ def main(): arr = np.array((inds, seconds, waves)).T sorter = np.lexsort((arr[:, 1], arr[:, 2])) - # Using this double-sorted array get the list indicies + # Using this double-sorted array get the list indices list_sorter = np.array(arr[sorter][:, 0], dtype=int) # Calculate the desired shape of the output array diff --git a/dkist/tests/generate_eit_test_dataset.py b/dkist/tests/generate_eit_test_dataset.py index dd1b9d90..12aa9e2c 100644 --- a/dkist/tests/generate_eit_test_dataset.py +++ b/dkist/tests/generate_eit_test_dataset.py @@ -3,18 +3,15 @@ import asdf import astropy.units as u import gwcs -import sunpy.map from astropy.io import fits from astropy.modeling.models import (AffineTransformation2D, Multiply, Pix2Sky_TAN, RotateNative2Celestial, Shift) from astropy.table import Table from astropy.time import Time from gwcs import coordinate_frames as cf -from sunpy.time import parse_time -from dkist_inventory.asdf_generator import references_from_filenames -from dkist_inventory.header_parsing import HeaderParser -from dkist_inventory.transforms import generate_lookup_table +import sunpy.map +from sunpy.time import parse_time def map_to_transform(smap): @@ -59,6 +56,9 @@ def map_to_transform(smap): def main(): from dkist.data.test import rootdir + from dkist_inventory.asdf_generator import references_from_filenames + from dkist_inventory.header_parsing import HeaderParser + from dkist_inventory.transforms import generate_lookup_table files = list((rootdir / "EIT").glob("*.fits")) files.sort() diff --git a/dkist/tests/generate_eit_tiled_dataset.py b/dkist/tests/generate_eit_tiled_dataset.py index 10f8b673..40e3b083 100644 --- a/dkist/tests/generate_eit_tiled_dataset.py +++ b/dkist/tests/generate_eit_tiled_dataset.py @@ -2,21 +2,21 @@ import tempfile import numpy as np -from dkist_data_simulator.spec214.vbi import MosaicedVBIBlueDataset import astropy.units as u from dkist.data.test import rootdir -from dkist_inventory.asdf_generator import dataset_from_fits +if __name__ == "__main__": + from dkist_data_simulator.spec214.vbi import MosaicedVBIBlueDataset -class DemoMosaicedVBIBlueDataset(MosaicedVBIBlueDataset): - @property - def data(self): - return np.zeros(self.array_shape) + (self.mosaic_keys("MINDEX1") * self.mosaic_keys("MINDEX2")) + from dkist_inventory.asdf_generator import dataset_from_fits + class DemoMosaicedVBIBlueDataset(MosaicedVBIBlueDataset): + @property + def data(self): + return np.zeros(self.array_shape) + (self.mosaic_keys("MINDEX1") * self.mosaic_keys("MINDEX2")) -if __name__ == "__main__": mosaic = MosaicedVBIBlueDataset(2, 1, linewave=500*u.nm, detector_shape=(2, 2)) with tempfile.TemporaryDirectory() as tempdir: diff --git a/dkist/tests/setup_package.py b/dkist/tests/setup_package.py deleted file mode 100644 index 118325c7..00000000 --- a/dkist/tests/setup_package.py +++ /dev/null @@ -1,11 +0,0 @@ -# import os - -# If this package has tests data in the tests/data directory, add them to -# the paths here, see commented example -paths = ['coveragerc', -# os.path.join('data', '*fits') - ] - -def get_package_data(): - return { - _ASTROPY_PACKAGE_NAME_ + '.tests': paths} diff --git a/dkist/utils/_model_to_graphviz.py b/dkist/utils/_model_to_graphviz.py index a7fc2195..989a7184 100644 --- a/dkist/utils/_model_to_graphviz.py +++ b/dkist/utils/_model_to_graphviz.py @@ -1,5 +1,5 @@ """ -This module vizualises compound models by rendering them as a graphviz graph. +This module visualises compound models by rendering them as a graphviz graph. It is provided as a helper module which is useful for debugging complex compound models. diff --git a/dkist/version.py b/dkist/version.py new file mode 100644 index 00000000..515c2f0a --- /dev/null +++ b/dkist/version.py @@ -0,0 +1,17 @@ +# NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed +# This file is not included in wheels/tarballs, so otherwise it will +# fall back on the generated _version module. +try: + try: + from ._dev.scm_version import version + except ImportError: + from ._version import version +except Exception: + import warnings + + warnings.warn( + f'could not determine {__name__.split(".")[0]} package version; this indicates a broken installation' + ) + del warnings + + version = '0.0.0' diff --git a/dkist/wcs/models.py b/dkist/wcs/models.py index 698d4ae1..bbb92d95 100755 --- a/dkist/wcs/models.py +++ b/dkist/wcs/models.py @@ -101,7 +101,7 @@ class BaseVaryingCelestialTransform(Model, ABC): Shared components between the forward and reverse varying celestial transforms. """ - # This prevents Model from broadcasting the paramters to the inputs + # This prevents Model from broadcasting the parameters to the inputs standard_broadcasting = False _separable = False _input_units_allow_dimensionless = True diff --git a/docs/Makefile b/docs/Makefile index fb03f26e..d4bb2cbb 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,133 +1,20 @@ -# Makefile for Sphinx documentation +# Minimal makefile for Sphinx documentation # -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . BUILDDIR = _build -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest - -#This is needed with git because git doesn't create a dir if it's empty -$(shell [ -d "_static" ] || mkdir -p _static) - +# Put it first so that "make" without argument is like "make help". help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - -clean: - -rm -rf $(BUILDDIR) - -rm -rf api - -rm -rf generated - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/Astropy" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - make -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." +.PHONY: help Makefile -doctest: - @echo "Run 'python setup.py test' in the root directory to run doctests " \ - @echo "in the documentation." +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat index 93dfe92b..2119f510 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,170 +1,35 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Astropy.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Astropy.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/topic_guides/loading.rst b/docs/topic_guides/loading.rst index 8c3bddc9..e5f304fa 100644 --- a/docs/topic_guides/loading.rst +++ b/docs/topic_guides/loading.rst @@ -6,7 +6,7 @@ Loading and Working with Level One Data As we saw in the :ref:`dkist:topic-guides:downloading-fits` section, once we have an ASDF file representing a DKIST dataset it can be loaded with `dkist.Dataset`. The `dkist.Dataset` class provides access to all the components of the dataset, and is a slightly customised `ndcube.NDCube` object, so all functionality provided by ndcube is applicable to the ``Dataset`` class. -This section of the guide will cover things specifc to the `~dkist.Dataset` class, but will not cover the basics which are in the `ndcube documentation `__. +This section of the guide will cover things specific to the `~dkist.Dataset` class, but will not cover the basics which are in the `ndcube documentation `__. In particular we recommend you read the following sections of the ``ndcube`` documentation: * :ref:`ndcube:ndcube` diff --git a/docs/topic_guides/net.rst b/docs/topic_guides/net.rst index 1ef5b8ef..15302111 100644 --- a/docs/topic_guides/net.rst +++ b/docs/topic_guides/net.rst @@ -17,7 +17,7 @@ Searching for DKIST Datasets with Fido Download of FITS files is not provided through the ``Fido`` interface. As is described below, FITS files can be downloaded for some or all of a dataset after reading the ASDF file. -As is descibed in :ref:`sunpy:sunpy-tutorial-acquiring-data-index`, searches through ``Fido`` use "attrs" which specify the search criteria. +As is described in :ref:`sunpy:sunpy-tutorial-acquiring-data-index`, searches through ``Fido`` use "attrs" which specify the search criteria. A single search can match one or more data providers, for example it is possible to search for DKIST data and data provided by the VSO simultaneously. In this guide we will focus on searches only for DKIST data through using the client provided in `dkist.net`. diff --git a/docs/tutorial/3_the_dataset.md b/docs/tutorial/3_the_dataset.md index 2c6c9dab..727fcb18 100644 --- a/docs/tutorial/3_the_dataset.md +++ b/docs/tutorial/3_the_dataset.md @@ -112,11 +112,11 @@ We can get the corresponding **pixel** axis names with: ds.wcs.pixel_axis_names ``` -Note that these are in reverse order compared to the `ds` output ealier. +Note that these are in reverse order compared to the `ds` output earlier. This is because they are in *pixel* order rather than *array* order. Next we see the description of the world coordinates. -This information is also accessable through the `wcs` attribute: +This information is also accessible through the `wcs` attribute: ```{code-cell} python ds.wcs.world_axis_names diff --git a/docs/tutorial/3_the_dataset_NOTES.md b/docs/tutorial/3_the_dataset_NOTES.md index fee80d1c..8ddfb8c5 100644 --- a/docs/tutorial/3_the_dataset_NOTES.md +++ b/docs/tutorial/3_the_dataset_NOTES.md @@ -162,7 +162,7 @@ ds ``` ```{error} -Due to a known issue with the VBI level 1 FITS headers, the ordering of these tiles in the array are likley incorrect. +Due to a known issue with the VBI level 1 FITS headers, the ordering of these tiles in the array are likely incorrect. ``` The `TiledDataset` stores the FITS headers for all the files of the individual `Dataset`s in the `combined_headers` attribute. diff --git a/docs/tutorial/4_more_dataset.md b/docs/tutorial/4_more_dataset.md index 3241dc99..d9da4a8a 100644 --- a/docs/tutorial/4_more_dataset.md +++ b/docs/tutorial/4_more_dataset.md @@ -84,7 +84,7 @@ plt.show() ## Tracking files -`Dataset` tracks information about the individual files that make up the datset in the `files` attribute. +`Dataset` tracks information about the individual files that make up the dataset in the `files` attribute. ```{code-cell} ipython ds.files diff --git a/docs/tutorial/5_downloading_data.md b/docs/tutorial/5_downloading_data.md index da063e3c..946aeb87 100644 --- a/docs/tutorial/5_downloading_data.md +++ b/docs/tutorial/5_downloading_data.md @@ -63,10 +63,10 @@ Select the preview movie, `BEOGN.mp4`, by clicking the checkbox next to it, then You can check the progress of your transfer by going to the "Activity" tab, which shows both active and previous transfers. Various useful information is displayed here but for now the most important is whether the transfer task has failed or succeeded. In either case Globus will also send an email to your registered email address when the task finishes. -Of course in this trivial example this is unneccessary, but if you're transfering a whole large dataset it will likely take some time to download and it may be useful to be notified when it's complete. +Of course in this trivial example this is unnecessary, but if you're transferring a whole large dataset it will likely take some time to download and it may be useful to be notified when it's complete. You do not need to leave the web app open for the transfer to continue, but remember that you do need to have GCP running - so if you stop it then your data download will stop as well. -If you try transfering the same file again to the same location, you will find that the task completes successfully but the file is not actually transferred. +If you try transferring the same file again to the same location, you will find that the task completes successfully but the file is not actually transferred. This is to save download time and avoid duplication. ## Dataset and downloading @@ -86,7 +86,7 @@ files = Fido.fetch(res) ds = dkist.load_dataset(files[0]) ``` -As we saw earlier, we can use the `files` attribute to access information about the number and names of files in the datset even before downloading any. +As we saw earlier, we can use the `files` attribute to access information about the number and names of files in the dataset even before downloading any. ```{code-cell} ipython print(ds.files) @@ -118,7 +118,7 @@ But remember that whatever path you specify must be accessible by Globus Connect --- tags: [skip-execution] --- -ds[0].files.download(path="~/somewhere/globus/cant/reach/") # will hang for a while and then fail +ds[0].files.download(path="~/somewhere/globus/can't/reach/") # will hang for a while and then fail ``` The `path` keyword will replace placeholders in the path in the same way as we saw with `Fido.fetch()`. diff --git a/pyproject.toml b/pyproject.toml index 2a0d230d..1d929aaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,91 @@ [build-system] -requires = ["setuptools>=30.3.0", "setuptools_scm", "wheel"] -build-backend = 'setuptools.build_meta' - -[tool.isort] -line_length = 99 -skip = "docs/conf.py,.tox" -sections = "FUTURE,STDLIB,THIRDPARTY,ASTRO,FIRSTPARTY,LOCALFOLDER" -default_section = "THIRDPARTY" -known_first_party = "dkist,dkist_inventory" -known_astro = "astropy,sunpy,gwcs,asdf,ndcube,asdf_astropy" -multi_line_output = 0 -balanced_wrapping = true -include_trailing_comma = false -length_sort = false -length_sort_sections = "stdlib" +requires = [ + "setuptools>=62.1", + "setuptools_scm[toml]>=6.2", + "wheel",] +build-backend = "setuptools.build_meta" + +[project] +name = "dkist" +description = "DKIST User Tools" +requires-python = ">=3.10" +readme = { file = "README.rst", content-type = "text/x-rst" } +license = { file = "licenses/LICENSE.rst", content-type = "text/plain" } +authors = [ + { name = "NSO / AURA", email = "stuart@cadair.com" }, +] +dependencies = [ + "aiohttp>=3.8", + # Provide minimum deps for all asdf packages used to generate or read asdf + # files so that we test with these minimums and also generate asdf's with + # them + # Some of these schema dependencies are minimums because we generated asdf + # files with them unpinned so they are now required to read generated asdf + # files. + "asdf>=2.11.2", # Pick up jsonschema bug fix + "asdf-astropy>=0.2.0", + "asdf-coordinates-schemas>=0.1.0", + "asdf-standard>=1.0.3", + "asdf-transform-schemas>=0.3.0", + "asdf-unit-schemas>=0.1.0", + "asdf-wcs-schemas>=0.3.0", + "astropy>=5.3", + "dask[array]>=2021.8.0", + "globus-sdk>=3.0", + "gwcs>=0.19.0", + "matplotlib>=3.5", + "ndcube[plotting,reproject]>=2.0", + "numpy>=1.22", + "parfive[ftp]>=1.5", + "platformdirs>=3.0", + "sunpy[net,asdf]>=4.0.7", + "tqdm>=4.63", +] +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-doctestplus", + "pytest-cov", + "pytest-remotedata", + "pytest-cov", + "pytest-mock", + "pytest-mpl", + "pytest-httpserver", + "hypothesis", + "tox", + "pydot", +] +docs = [ + "sphinx", + "sphinx-astropy", + "sphinx-gallery", + "sphinx-changelog", + "pytest", + "sphinx_autodoc_typehints", + "dkist-sphinx-theme>=1.1.2", + "sphinx-design", + "myst-nb", + "ipywidgets", + "accessible-pygments", +] + +[project.urls] +repository = "https://github.com/DKISTDC/dkist" + +[project.entry-points] +'asdf.extensions' = {dkist = 'dkist.io.asdf.entry_points:get_extensions'} +'asdf.resource_mappings' = {dkist = 'dkist.io.asdf.entry_points:get_resource_mappings'} + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages.find] + +[tool.setuptools_scm] +write_to = "dkist/_version.py" [tool.gilesbot] [ tool.gilesbot.pull_requests ] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..5b440f40 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,79 @@ +[pytest] +minversion = 7.0 +testpaths = + dkist + docs +norecursedirs = + .tox + build + docs/_build + docs/generated + *.egg-info + examples + dkist/_dev + .history + dkist/extern +doctest_plus = enabled +doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS +text_file_format = rst +addopts = --doctest-rst -p no:unraisableexception -p no:threadexception +markers = + online: marks this test function as needing online connectivity. + figure: marks this test function as using hash-based Matplotlib figure verification. This mark is not meant to be directly applied, but is instead automatically applied when a test function uses the @sunpy.tests.helpers.figure_test decorator. +# Disable internet access for tests not marked remote_data +remote_data_strict = True +asdf_schema_root = dkist/io/asdf/resources/ +asdf_schema_tests_enabled = true +filterwarnings = + # Turn all warnings into errors so they do not pass silently. + error + # Do not fail on pytest config issues (i.e. missing plugins) but do show them + always::pytest.PytestConfigWarning + # A list of warnings to ignore follows. If you add to this list, you MUST + # add a comment or ideally a link to an issue that explains why the warning + # is being ignored + # Some tests use data that have dates in the future and ERFA does not like. + ignore:ERFA function "d2dtf"* + ignore:ERFA function "dtf2d"* + ignore:ERFA function "utctai"* + ignore:ERFA function "taiutc"* + ignore:ERFA function "utcut1"* + ignore:Tried to get polar motions for times after IERS data is valid* + # Zeep deprecation warning + ignore:defusedxml.lxml is no longer supported and will be removed in a future release. + # This is due to dependencies building with a numpy version different from + # the local installed numpy version, but should be fine + # See https://github.com/numpy/numpy/issues/15748#issuecomment-598584838 + ignore:numpy.ufunc size changed:RuntimeWarning + ignore:numpy.ndarray size changed:RuntimeWarning + # This isn't really an issue it's an annoyance, it's triggered by printing + # an astropy table inside a test, which is generally only done when + # debugging. + ignore:the imp module is deprecated in favour of importlib:DeprecationWarning:ipykernel.iostream + # Ignore warnings about asdf versions + ignore:File.*asdf.extension.BuiltinExtension.*:asdf.exceptions.AsdfWarning + # pytest / asdf interaction + ignore:The .* argument to AsdfSchemaFile is deprecated + # gwcs main has the wrong version number: https://github.com/spacetelescope/gwcs/issues/399 + ignore:File.*from package gwcs\=\=0\.18\.0\), but older package \(gwcs.*\) is installed. + # Ignore asdf older version errors + ignore: File.* was created with extension.*but older package.*is installed. + ignore:The distutils.sysconfig module is deprecated, use sysconfig instead:DeprecationWarning + ignore:FLIP_TOP_BOTTOM is deprecated and will be removed in Pillow.* + ignore::ResourceWarning + # Zeep relies on deprecated cgi in Python 3.11 + ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning:zeep.utils + # Oldestdeps below here + ignore:`np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself.::dask.array + ignore:leap-second auto-update failed due to the following exception + ignore:"@coroutine" decorator is deprecated since Python 3.8, use "async def" instead + ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. + ignore:Subclassing validator classes is not intended to be part of their public API + # Ignore warning so gwcs 0.18.3 can load + ignore:Converter handles multiple tags for this extension:asdf.exceptions.AsdfWarning + # https://github.com/pandas-dev/pandas/issues/54466 + ignore:\nPyarrow will become a required dependency of pandas in the next major release of pandas:DeprecationWarning + # This seems to be coming out of pandas + ignore:datetime.datetime.utcfromtimestamp.*:DeprecationWarning + # The new way of doing it is 3.11 + ignore:datetime.datetime.utcnow.*:DeprecationWarning diff --git a/setup.cfg b/setup.cfg index 30efcfa6..44271006 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,160 +1,3 @@ -[metadata] -name = dkist -author = NSO / AURA -author_email = stuart@cadair.com -description = DKIST User Tools -long_description = file: README.rst -long_description_content_type = text/x-rst -license = BSD 3-Clause -url = http://dkist.nso.edu -edit_on_github = True -github_project = DKISTDC/dkist -classifiers = - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - -[options] -python_requires = >=3.9 -packages = find: -include_package_data = True -install_requires = - aiohttp>=3.6 - # Provide minimum deps for all asdf packages used to generate or read asdf - # files so that we test with these minimums and also generate asdf's with - # them - # Some of these schema dependancies are minimums because we generated asdf - # files with them unpinned so they are now required to read generated asdf - # files. - asdf>=2.11.2 # Pick up jsonschema bug fix - asdf-astropy>=0.2.0 - asdf-coordinates-schemas>=0.1.0 - asdf-standard>=1.0.3 - asdf-transform-schemas>=0.3.0 - asdf-unit-schemas>=0.1.0 - asdf-wcs-schemas>=0.3.0 - astropy>=5.3 - dask[array]>=2021.8.0 - globus-sdk>=3.0 - gwcs>=0.19.0 - matplotlib>=3.5 - ndcube[plotting,reproject]>=2.0 - numpy>=1.22 - parfive[ftp]>=1.5 - platformdirs>=3.0 - sunpy[net,asdf]>=4.0.7 - tqdm>=4.63 -setup_requires = setuptools_scm - -[options.extras_require] -tests = - pytest-astropy - pytest-cov - pytest-mock - pytest-mpl - pytest-httpserver - hypothesis - tox -docs = - sphinx - sphinx-astropy - sphinx-gallery - sphinx-changelog - pytest - sphinx_autodoc_typehints - dkist-sphinx-theme>=1.1.2 - sphinx-design - myst-nb - ipywidgets - accessible-pygments - -[options.entry_points] -asdf.resource_mappings = - dkist = dkist.io.asdf.entry_points:get_resource_mappings -asdf.extensions = - dkist = dkist.io.asdf.entry_points:get_extensions - -[build_docs] -source-dir = docs -build-dir = docs/_build -all_files = 1 - -[upload_docs] -upload_dir = docs/_build/html -show_response = 1 - -[tool:pytest] -minversion = 3.0 -testpaths = "dkist" "docs" -norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".history" -doctest_plus = enabled -doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS -addopts = --doctest-ignore-import-errors --doctest-rst -markers = - online: marks this test function as needing online connectivity. - figure: marks this test function as using hash-based Matplotlib figure verification. This mark is not meant to be directly applied, but is instead automatically applied when a test function uses the @sunpy.tests.helpers.figure_test decorator. -# Disable internet access for tests not marked remote_data -remote_data_strict = True -asdf_schema_root = dkist/io/asdf/resources/ -asdf_schema_tests_enabled = true -filterwarnings = - error - always::PendingDeprecationWarning - # Some tests use data that have dates in the future and ERFA does not like. - ignore:ERFA function "d2dtf"* - ignore:ERFA function "dtf2d"* - ignore:ERFA function "utctai"* - ignore:ERFA function "taiutc"* - ignore:ERFA function "utcut1"* - ignore:Tried to get polar motions for times after IERS data is valid* - # Zeep deprecation warning - ignore:defusedxml.lxml is no longer supported and will be removed in a future release. - # This is due to dependencies building with a numpy version different from - # the local installed numpy version, but should be fine - # See https://github.com/numpy/numpy/issues/15748#issuecomment-598584838 - ignore:numpy.ufunc size changed:RuntimeWarning - ignore:numpy.ndarray size changed:RuntimeWarning - # This isn't really an issue it's an annoyance, it's triggered by printing - # an astropy table inside a test, which is generally only done when - # debugging. - ignore:the imp module is deprecated in favour of importlib:DeprecationWarning:ipykernel.iostream - # Ignore warnings about asdf versions - ignore:File.*asdf.extension.BuiltinExtension.*:asdf.exceptions.AsdfWarning - # pytest / asdf interaction - ignore:The .* argument to AsdfSchemaFile is deprecated - # gwcs main has the wrong version number: https://github.com/spacetelescope/gwcs/issues/399 - ignore:File.*from package gwcs\=\=0\.18\.0\), but older package \(gwcs.*\) is installed. - # Ignore asdf older version errors - ignore: File.* was created with extension.*but older package.*is installed. - ignore:The distutils.sysconfig module is deprecated, use sysconfig instead:DeprecationWarning - ignore:FLIP_TOP_BOTTOM is deprecated and will be removed in Pillow.* - ignore::ResourceWarning - # Zeep relies on deprecated cgi in Python 3.11 - ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning:zeep.utils - # Oldestdeps below here - ignore:`np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself.::dask.array - ignore:leap-second auto-update failed due to the following exception - ignore:"@coroutine" decorator is deprecated since Python 3.8, use "async def" instead - ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. - ignore:Subclassing validator classes is not intended to be part of their public API - # Ignore warning so gwcs 0.18.3 can load - ignore:Converter handles multiple tags for this extension:asdf.exceptions.AsdfWarning - # https://github.com/pandas-dev/pandas/issues/54466 - ignore:\nPyarrow will become a required dependency of pandas in the next major release of pandas:DeprecationWarning - # This seems to be coming out of pandas - ignore:datetime.datetime.utcfromtimestamp.*:DeprecationWarning - # The new way of doing it is 3.11 - ignore:datetime.datetime.utcnow.*:DeprecationWarning - -[flake8] -exclude = extern,sphinx,*parsetab.py,conftest.py,docs/conf.py,setup.py,__init__.py -max-line-length = 100 -ignore = I1,D1,D200 -docstring-convention=numpy - [pylint] disable = W,R @@ -165,39 +8,3 @@ column_limit = 100 max_line_length = 100 select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902 exclude = extern,sphinx,*parsetab.py - -[coverage:run] -omit = - dkist/conftest.py - dkist/cython_version* - dkist/*setup* - dkist/extern/* - dkist/*/tests/* - dkist/*/*/tests/* - dkist/version* - dkist/__init__* - dkist/_sunpy_init* - dkist/utils/_model_to_graphviz.py - */dkist/conftest.py - */dkist/cython_version* - */dkist/*setup* - */dkist/extern/* - */dkist/*/tests/* - */dkist/*/*/tests/* - */dkist/version* - */dkist/__init__* - */dkist/utils/_model_to_graphviz.py - -[coverage:report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain about packages we have installed - except ImportError - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - # Don't complain about script hooks - def main\(.*\): - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} diff --git a/setup.py b/setup.py index d5d43d7c..c8233455 100755 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python from setuptools import setup -setup(use_scm_version=True) +setup() diff --git a/tox.ini b/tox.ini index 0d33230b..282c91f2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,25 @@ [tox] -envlist = py{39,310,311}{,-devdeps,-oldestdeps,-online},build_docs{,-notebooks},codestyle +min_version = 4.0 requires = setuptools >= 30.3.0 pip >= 21.0.1 - #tox-pypi-filter >= 0.12 + tox-pypi-filter >= 0.14 +envlist = + py{310,311,312} + py312-devdeps + py310-oldestdeps + build_docs{,-notebooks} + codestyle [testenv] -# Pass through the following environment variables which may be needed for the CI +pypi_filter = https://raw.githubusercontent.com/sunpy/sunpy/main/.test_package_pins.txt +# Run the tests in a temporary directory to make sure that we don't import +# the package from the source tree +change_dir = .tmp/{envname} +description = + run tests + oldestdeps: with the oldest supported version of key dependencies + devdeps: with the latest developer version of key dependencies pass_env = # A variable to tell tests we are on a CI system CI @@ -15,66 +28,60 @@ pass_env = # Location of locales (needed by sphinx on some systems) LOCALE_ARCHIVE # If the user has set a LC override we should follow it - # (note LANG is automatically passed through by tox) LC_ALL -setenv = +set_env = MPLBACKEND = agg COLUMNS = 180 - PYTEST_COMMAND = pytest {tty:--color=yes} --cov=dkist --cov-config={toxinidir}/setup.cfg --verbose - devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scipy-wheels-nightly/simple -extras = tests -commands = - !online: {env:PYTEST_COMMAND} {posargs} - online: {env:PYTEST_COMMAND} --remote-data=any {posargs} -description = - run tests - devdeps: with the latest developer version of key dependencies - oldestdeps: with the oldest supported version of all dependencies - online: that require remote data (as well as the offline ones) + devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + # Define the base test command here to allow us to add more flags for each tox factor + PYTEST_COMMAND = pytest -vvv -r fEs --pyargs dkist --cov-report=xml --cov=dkist --cov-config={toxinidir}/.coveragerc {toxinidir}/docs deps = - # Devdeps installs our key dependencies from git to ensure we catch future - # breaking changes before they make it to release + # For packages which publish nightly wheels this will pull the latest nightly devdeps: astropy>=0.0.dev0 devdeps: numpy>=0.0.dev0 devdeps: scipy>=0.0.dev0 devdeps: matplotlib>=0.0.dev0 - devdeps: git+https://github.com/sunpy/sunpy + devdeps: sunpy>=0.0.dev0 devdeps: git+https://github.com/sunpy/ndcube devdeps: git+https://github.com/spacetelescope/gwcs devdeps: git+https://github.com/asdf-format/asdf devdeps: git+https://github.com/astropy/asdf-astropy # Autogenerate oldest dependencies from info in setup.cfg oldestdeps: minimum_dependencies - -# The oldest deps build runs all our tests against the oldest supported -# versions +# The following indicates which extras_require will be installed +extras = + tests commands_pre = oldestdeps: minimum_dependencies dkist --filename requirements-min.txt - # Put the other requirements here to not have pip run more than once - # - # Very new versions of jsonschema raise warnings, but we don't want to - # depend on jsonschema as new asdf (3.0+) does not use it any more. - # - # The newest cryptography releases break globus oldestdeps: pip install -r requirements-min.txt cryptography<42 jsonschema==4.0.1 pip freeze --all --no-input - -[testenv:build_docs{,-notebooks}] -changedir = docs -extras = docs -description = Invoke sphinx-build to build the HTML docs commands = - pip freeze --all --no-input - # Disable parallel here due to https://github.com/astropy/astropy/issues/14916 - !notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html -D nb_execution_mode=off {posargs} - notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs} - python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))' + # To run different commands for different factors exclude the factor from the default command like this + # !online: {env:PYTEST_COMMAND} {posargs} + # Then specify a specific one like this + # online: {env:PYTEST_COMMAND} --remote-data=any {posargs} + !online: {env:PYTEST_COMMAND} {posargs} + online: {env:PYTEST_COMMAND} --remote-data=any {posargs} [testenv:codestyle] +pypi_filter = skip_install = true description = Run all style and file checks with pre-commit deps = pre-commit commands = - pre-commit install --install-hooks - pre-commit run --all-files {posargs} + pre-commit install-hooks + pre-commit run --color always --all-files --show-diff-on-failure + +[testenv:build_docs{,-notebooks}] +description = invoke sphinx-build to build the HTML docs +change_dir = + docs +extras = + docs +commands = + pip freeze --all --no-input + # Disable parallel here due to https://github.com/astropy/astropy/issues/14916 + !notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html -D nb_execution_mode=off {posargs} + notebooks: sphinx-build -j 1 --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs} + python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))' From c6dd4c2d832ae0b1147bbfedcb3a2132a8e2b4e9 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Fri, 22 Mar 2024 10:34:59 +0000 Subject: [PATCH 2/2] Delete codecov.yml --- codecov.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 2faf97e6..00000000 --- a/codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -codecov: - token: 73300de3-0fde-4f9f-80d1-3779c8a058dc