From c6d35c26dcb0edd259c834d5833d10ff003bd26b Mon Sep 17 00:00:00 2001 From: CyclingNinja Date: Wed, 16 Oct 2024 11:16:01 +0100 Subject: [PATCH] Registers package with the SunPy template --- .codecov.yaml | 7 +- .codespellrc | 13 ++ .coveragerc | 30 ++++ .cruft.json | 31 ++++ .flake8 | 27 ++++ .github/workflows/ci.yml | 26 +++- .github/workflows/sub_package_update.yml | 79 +++++++++++ .gitignore | 86 ++++++++--- .isort.cfg | 16 +++ .pre-commit-config.yaml | 11 ++ .readthedocs.yaml | 29 ++++ .rtd-environment.yml | 7 + .ruff.toml | 37 +++++ MANIFEST.in | 13 +- README.rst | 51 +++++-- docs/conf.py | 65 +++++---- docs/index.rst | 7 +- docs/make.bat | 70 ++++----- licenses/LICENSE.rst | 22 +++ licenses/README.rst | 9 ++ licenses/TEMPLATE_LICENSE.rst | 31 ++++ pyproject.toml | 93 ++++++++---- pytest.ini | 33 +++++ setup.cfg | 150 -------------------- setup.py | 30 +--- sunraster/_dev/__init__.py | 1 - sunraster/_dev/scm_version.py | 8 +- sunraster/data/README.rst | 6 + sunraster/instr/spice.py | 4 +- sunraster/instr/tests/test_spice.py | 4 +- sunraster/spectrogram.py | 6 +- sunraster/spectrogram_sequence.py | 4 +- sunraster/tests/__init__.py | 10 +- sunraster/tests/test_spectrogram.py | 4 +- sunraster/tests/test_spectrogramsequence.py | 4 +- sunraster/version.py | 25 +--- tox.ini | 70 ++++++--- 37 files changed, 753 insertions(+), 366 deletions(-) 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 create mode 100644 .rtd-environment.yml create mode 100644 .ruff.toml create mode 100644 licenses/LICENSE.rst create mode 100644 licenses/README.rst create mode 100644 licenses/TEMPLATE_LICENSE.rst create mode 100644 pytest.ini delete mode 100644 setup.cfg create mode 100644 sunraster/data/README.rst diff --git a/.codecov.yaml b/.codecov.yaml index 3d0bda65..8fe09b73 100644 --- a/.codecov.yaml +++ b/.codecov.yaml @@ -1,8 +1,11 @@ -codecov: - token: 1c407e87-035c-4a1b-8ef4-223f3e3848ab 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..042a14ed --- /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 +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..6b8f4698 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,30 @@ +[run] +omit = + sunraster/conftest.py + sunraster/*setup_package* + sunraster/extern/* + sunraster/version* + */sunraster/conftest.py + */sunraster/*setup_package* + */sunraster/extern/* + */sunraster/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} + # 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..6fb22175 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,31 @@ +{ + "template": "https://github.com/sunpy/package-template", + "commit": "dd830771f0bb01d5313912e0082f3434715e474a", + "checkout": null, + "context": { + "cookiecutter": { + "package_name": "sunraster", + "module_name": "sunraster", + "short_description": "sunraster is an open-source Python library that provides the tools to read in and analyze spectrogram data.", + "author_name": "The SunPy Community", + "author_email": "sunpy@googlegroups.com", + "project_url": "https://sunpy.org", + "license": "BSD 2-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..b21303ae --- /dev/null +++ b/.flake8 @@ -0,0 +1,27 @@ +[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 = 110 +exclude = + .git + __pycache__ + docs/conf.py + build + sunraster/__init__.py +rst-directives = + plot diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5fc893d..ce7dc6f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ on: - '!*pre*' - '!*post*' pull_request: + # Allow manual runs through the web UI workflow_dispatch: concurrency: @@ -28,6 +29,20 @@ jobs: posargs: -n auto envs: | - linux: py312 + 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.12' + - 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/* test: needs: [core] @@ -38,13 +53,17 @@ jobs: toxdeps: tox-pypi-filter posargs: -n auto envs: | - - windows: py310 - - macos: py311 + - windows: py311 + - macos: py310 + - linux: py310-oldestdeps + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} docs: needs: [core] uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main with: + default_python: '3.12' submodules: false pytest: false toxdeps: tox-pypi-filter @@ -86,7 +105,10 @@ jobs: - linux: py312-online publish: + # Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.* + # see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi if: | + github.event_name != 'pull_request' || ( github.event_name != 'pull_request' && ( github.ref_name != 'main' || diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml new file mode 100644 index 00000000..74558476 --- /dev/null +++ b/.github/workflows/sub_package_update.yml @@ -0,0 +1,79 @@ +# 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 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Cruft + run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1 + + - 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@v7 + 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 73080093..31090474 100644 --- a/.gitignore +++ b/.gitignore @@ -24,11 +24,12 @@ parts/ sdist/ var/ wheels/ +share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST - +sunraster/_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. @@ -42,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 @@ -60,6 +63,7 @@ junit/ *.log local_settings.py db.sqlite3 +db.sqlite3-journal # Flask stuff: instance/ @@ -70,18 +74,47 @@ instance/ # Sphinx documentation docs/_build/ +# automodapi +docs/api +docs/sg_execution_times.rst # 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 @@ -95,10 +128,6 @@ ENV/ env.bak/ venv.bak/ -# Spyder project settings -.spyderproject -.spyproject - # Rope project settings .ropeproject @@ -108,8 +137,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 @@ -117,7 +160,6 @@ venv.bak/ # Icon must ends with two \r. Icon - # Thumbnails ._* @@ -126,7 +168,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 @@ -141,7 +182,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 @@ -197,10 +239,6 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -### VScode: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore -.vscode/* -.vs/* - ### Extra Python Items and sunraster Specific .hypothesis .pytest_cache @@ -210,13 +248,11 @@ docs/_build docs/generated docs/api/ docs/whatsnew/latest_changelog.txt +examples/**/*.csv examples/**/*.asdf figure_test_images* tags -sunraster/_version.py - -### Pycharm(?) -.idea +baseline # Release script .github_cache @@ -224,3 +260,11 @@ sunraster/_version.py # 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..4ff73193 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,16 @@ +[settings] +balanced_wrapping = true +skip = + docs/conf.py + sunraster/__init__.py +default_section = THIRDPARTY +include_trailing_comma = true +known_astropy = astropy, asdf +known_sunpy = sunpy, ndcube +known_first_party = sunraster +length_sort = false +length_sort_sections = stdlib +line_length = 110 +multi_line_output = 3 +no_lines_before = LOCALFOLDER +sections = STDLIB, THIRDPARTY, ASTROPY, SUNPY, FIRSTPARTY, LOCALFOLDER diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c56f19c..fe91ee00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,17 @@ repos: exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" - id: check-yaml - id: debug-statements + - id: check-added-large-files + args: ["--enforce-all", "--maxkb=1054"] + - id: end-of-file-fixer + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$" + - id: mixed-line-ending + exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$" + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: [ "--write-changes" ] ci: autofix_prs: false autoupdate_schedule: "quarterly" diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..3d9312da --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,29 @@ +version: 2 + +build: + os: ubuntu-lts-latest + tools: + python: "mambaforge-latest" + 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/.rtd-environment.yml b/.rtd-environment.yml new file mode 100644 index 00000000..c38b27c2 --- /dev/null +++ b/.rtd-environment.yml @@ -0,0 +1,7 @@ +name: sunraster +channels: + - conda-forge +dependencies: + - python=3.12 + - pip + - graphviz!=2.42.*,!=2.43.* diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 00000000..b7350f70 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,37 @@ +target-version = "py310" +line-length = 110 +exclude = [ + ".git,", + "__pycache__", + "build", + "sunraster/version.py", +] + +[lint] +select = ["E", "F", "W", "UP", "PT"] +extend-ignore = [ + # pycodestyle (E, W) + "E501", # LineTooLong # TODO! fix + # 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/MANIFEST.in b/MANIFEST.in index 94d83b7b..bcf2de30 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,12 @@ -# This subpackage is only used in development checkouts and should not be -# included in built tarballs +# Exclude specific files +# All files which are tracked by git and not explicitly excluded here are included by setuptools_scm +# Prune folders +prune sunraster/_dev +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 sunraster/_dev diff --git a/README.rst b/README.rst index 0c3c795f..34b05c39 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,9 @@ -********* +========= sunraster -********* +========= + +sunraster is an open-source Python library that provides the tools to read in and analyze spectrogram data. +----------------------------------------------------------------------------------------------------------- |Latest Version| |codecov| |matrix| |DOI| |Powered by NumFOCUS| |Powered by SunPy| @@ -63,11 +66,41 @@ For more information or to ask questions about ``sunraster``, check out: .. _sunpy Matrix Channel: https://chat.openastronomy.org/#/room/#sunpy:openastronomy.org .. _sunpy Mailing List: https://groups.google.com/forum/#!forum/sunpy + +License +======= + +This project is Copyright (c) The SunPy Community and licensed under +the terms of the BSD 2-Clause license. This package is based upon +the `Openastronomy packaging guide `_ +which is licensed under the BSD 3-clause licence. See the licenses folder for +more information. + Contributing ============ -If you would like to get involved, start by joining the `SunPy mailing list`_ and check out the `Developers Guide`_ section of the SunPy docs. -Help is always welcome so let us know what you like to work on, or check out the `issues page`_ for the list of known outstanding items. +We love contributions! sunraster is open source, +built on open source, and we'd love to have you hang out in our community. + +**Imposter syndrome disclaimer**: We want your help. No, really. + +There may be a little voice inside your head that is telling you that you're not +ready to be an open source contributor; that your skills aren't nearly good +enough to contribute. What could you possibly offer a project like this one? + +We assure you - the little voice in your head is wrong. If you can write code at +all, you can contribute code to open source. Contributing to open source +projects is a fantastic way to advance one's coding skills. Writing perfect code +isn't the measure of a good developer (that would disqualify all of us!); it's +trying to create something, making mistakes, and learning from those +mistakes. That's how we all improve, and we are happy to help others learn. + +Being an open source contributor doesn't just mean writing code, either. You can +help out by writing documentation, tests, or even giving feedback about the +project (and yes - that includes giving feedback about the contribution +process). Some of these contributions may be the most valuable to the project as +a whole, because you're coming to the project with fresh eyes, so you can see +the errors and assumptions that seasoned contributors have glossed over. For more information on contributing to sunraster, please read SunPy's `Newcomers' guide`_. @@ -77,9 +110,9 @@ For more information on contributing to sunraster, please read SunPy's `Newcomer .. _issues page: https://github.com/sunpy/sunraster/issues .. _Newcomers' guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html -Code of Conduct -=============== - -When you are interacting with the SunPy community you are asked to follow our `Code of Conduct`_. -.. _Code of Conduct: https://sunpy.org/coc +Note: This disclaimer was originally written by +`Adrienne Lowe `_ for a +`PyCon talk `_, and was adapted by +sunraster based on its use in the README file for the +`MetPy project `_. diff --git a/docs/conf.py b/docs/conf.py index 6b55bc2c..da5576c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,23 +4,35 @@ # full list see the documentation: # http://www.sphinx-doc.org/en/master/config -# -- Project information ----------------------------------------------------- +import datetime + +from packaging.version import Version -import os +# -- Project information ----------------------------------------------------- +# The full version, including alpha/beta/rc tags from sunraster import __version__ +_version = Version(__version__) +version = release = str(_version) +# Avoid "post" appearing in version string in rendered docs +if _version.is_postrelease: + version = release = _version.base_version +# Avoid long githashes in rendered Sphinx docs +elif _version.is_devrelease: + version = release = f"{_version.base_version}.dev{_version.dev}" +is_development = _version.is_devrelease +is_release = not (_version.is_prerelease or _version.is_devrelease) + project = "sunraster" -copyright = "2021, The SunPy Community" author = "The SunPy Community" -# The full version, including alpha/beta/rc tags -release = __version__ -is_development = ".dev" in __version__ +copyright = f"{datetime.datetime.now().year}, {author}" # noqa: A001 + # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# extensions coming with Sphinx (named "sphinx.ext.*") or your custom # ones. extensions = [ "sphinx.ext.autodoc", @@ -41,7 +53,7 @@ automodapi_toctreedirnm = "generated/api" # Add any paths that contain templates here, relative to this directory. -# templates_path = ['_templates'] +# templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -55,9 +67,8 @@ # The master toctree document. master_doc = "index" -# The reST default role (used for this markup: `text`) to use for all -# documents. Set to the "smart" one. -default_role = "obj" +# Treat everything in single ` as a Python reference. +default_role = "py:obj" # -- Options for intersphinx extension --------------------------------------- @@ -72,27 +83,23 @@ } # -- Options for HTML output ------------------------------------------------- + # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. - -try: - from sunpy_sphinx_theme.conf import * -except ImportError: - html_theme = "default" +html_theme = "alabaster" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] - -# Render inheritance diagrams in SVG -graphviz_output_format = "svg" - -graphviz_dot_args = [ - "-Nfontsize=10", - "-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif", - "-Efontsize=10", - "-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif", - "-Gfontsize=10", - "-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif", -] +# html_static_path = ["_static"] + +# By default, when rendering docstrings for classes, sphinx.ext.autodoc will +# make docs with the class-level docstring and the class-method docstrings, +# but not the __init__ docstring, which often contains the parameters to +# class constructors across the scientific Python ecosystem. The option below +# will append the __init__ docstring to the class-level docstring when rendering +# the docs. For more options, see: +# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content +autoclass_content = "both" + +# -- Other options ---------------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 7bd4b57f..5ecd9c00 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ -******************** -Welcome to sunraster -******************** +*********************** +sunraster Documentation +*********************** Welcome to the ``sunraster`` User Guide. @@ -30,6 +30,7 @@ Contents .. toctree:: :maxdepth: 2 + :caption: Contents: installation data_types/index diff --git a/docs/make.bat b/docs/make.bat index 922152e9..2119f510 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,35 +1,35 @@ -@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 +@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/licenses/LICENSE.rst b/licenses/LICENSE.rst new file mode 100644 index 00000000..8fcd3990 --- /dev/null +++ b/licenses/LICENSE.rst @@ -0,0 +1,22 @@ +Copyright (c) 2024, The SunPy Community + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/README.rst b/licenses/README.rst new file mode 100644 index 00000000..67b82f69 --- /dev/null +++ b/licenses/README.rst @@ -0,0 +1,9 @@ +Licenses +======== + +This directory holds license and credit information for the package, +works the package is derived from, and/or datasets. + +Ensure that you pick a package licence which is in this folder and it matches +the one mentioned in the top level README.rst file. If you are using the +pre-rendered version of this template check for the word 'Other' in the README. diff --git a/licenses/TEMPLATE_LICENSE.rst b/licenses/TEMPLATE_LICENSE.rst new file mode 100644 index 00000000..544a2dba --- /dev/null +++ b/licenses/TEMPLATE_LICENSE.rst @@ -0,0 +1,31 @@ +This project is based upon the OpenAstronomy package template +(https://github.com/OpenAstronomy/package-template/) which is licensed under the terms +of the following licence. + +--- + +Copyright (c) 2018, OpenAstronomy Developers +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the Astropy Team nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pyproject.toml b/pyproject.toml index 72ecb2c1..0a7bfb96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,33 +1,55 @@ [build-system] requires = [ - "extension-helpers", - "oldest-supported-numpy", - "setuptools_scm[toml]", - "setuptools", + "setuptools>=62.1", + "setuptools_scm[toml]>=6.2", "wheel", ] -build-backend = 'setuptools.build_meta' +build-backend = "setuptools.build_meta" -[tool.black] -line-length = 120 -include = '\.pyi?$' -exclude = ''' -( - /( - \.eggs - | \.git - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - | docs - | .history - )/ -) -''' +[project] +name = "sunraster" +description = "sunraster is an open-source Python library that provides the tools to read in and analyze spectrogram data." +requires-python = ">=3.10" +readme = { file = "README.rst", content-type = "text/x-rst" } +license = { file = "licenses/LICENSE.rst" } +authors = [ + { name = "The SunPy Community", email = "sunpy@googlegroups.com" }, +] +dependencies = [ + "numpy", + "astropy", + "ndcube[plotting]>=2.1.2" +] +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-doctestplus", + "pytest-cov", + "pytest-astropy", + "pytest-xdist", +] +docs = [ + "sphinx", + "sphinx_automodapi", + "sphinx-changelog", + "sphinx-gallery", + "sunpy-sphinx-theme" +] +[project.urls] +repository = "https://sunpy.org" + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages.find] +include = ["sunraster*"] +exclude = ["sunraster._dev*"] + +[tool.setuptools_scm] +write_to = "sunraster/_version.py" [ tool.gilesbot ] [ tool.gilesbot.pull_requests ] @@ -82,3 +104,24 @@ exclude = ''' directory = "trivial" name = "Internal Changes" showcontent = true + +[tool.black] +line-length = 120 +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs + | \.git + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + | docs + | .history + )/ +) +''' diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..930fce9b --- /dev/null +++ b/pytest.ini @@ -0,0 +1,33 @@ +[pytest] +minversion = 7.0 +testpaths = + sunraster + docs +norecursedirs = + .tox + build + docs/_build + docs/generated + *.egg-info + examples + sunraster/_dev + .history + sunraster/extern +doctest_plus = enabled +doctest_optionflags = + NORMALIZE_WHITESPACE + FLOAT_CMP + ELLIPSIS +text_file_format = rst +addopts = + --doctest-rst + -p no:unraisableexception + -p no:threadexception +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 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f59bac7f..00000000 --- a/setup.cfg +++ /dev/null @@ -1,150 +0,0 @@ -[metadata] -name = sunraster -provides = sunraster -description = sunraster is an open-source Python library that provides the tools to read in and analyze spectrogram data. -long_description = file: README.rst -long_description_content_type = text/x-rst -author = The SunPy Community -author_email = sunpy@googlegroups.com -license = BSD 2-Clause -license_file = LICENSE.rst -url = https://docs.sunpy.org/projects/sunraster/en/stable/ -edit_on_github = True -github_project = sunpy/sunraster -platform = any -keywords = solar physics, solar, science, sun, wcs, coordinates, spectra, raster -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Scientific/Engineering :: Physics - -[options] -zip_safe = False -python_requires = >=3.10 -packages = find: -include_package_data = True -setup_requires = - setuptools_scm -install_requires = - numpy - astropy - ndcube[plotting]>=2.1.2 - -[options.extras_require] -instr = - sunpy>=5.0.0 -tests = - pytest-astropy -docs = - sphinx - sphinx_automodapi - sphinx-changelog - sphinx-gallery - sunpy-sphinx-theme - -[options.packages.find] -exclude = sunraster._dev - -[tool:pytest] -testpaths = "sunraster" "docs" -norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".history" "sunraster[\/]_dev" -doctest_plus = enabled -doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS -text_file_format = rst -addopts = --doctest-rst --doctest-ignore-import-errors -p no:unraisableexception -p no:threadexception -markers = - online: marks this test function as needing online connectivity. -remote_data_strict = True -filterwarnings = - 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 - # - # - # 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 - ignore:invalid value encountered in sqrt:RuntimeWarning - # FITS header issues - ignore::astropy.wcs.wcs.FITSFixedWarning - ignore::astropy.io.fits.verify.VerifyWarning - # https://github.com/astropy/astropy/issues/11309 - ignore:target cannot be converted to ICRS, so will not be set on SpectralCoord - # test_ndcube_components_after_slicing raises this and it is unclear if its a problem. - ignore: invalid value encountered in true_divide - # https://github.com/pytest-dev/pytest-cov/issues/557 - ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning -doctest_subpackage_requires = - docs/* = ndcube<2.3.0 - -[pycodestyle] -max_line_length = 120 - -[flake8] -max-line-length = 120 -exclude = - .git, - __pycache__, - docs/conf.py, - build, -rst-directives = - plot - -[isort] -balanced_wrapping = True -default_section = THIRDPARTY -include_trailing_comma = True -known_sunraster = sunraster -length_sort = False -length_sort_sections=stdlib -line_length = 120 -multi_line_output = 3 -no_lines_before = LOCALFOLDER -sections = FUTURE, STDLIB, THIRDPARTY, SUNRASTER, FIRSTPARTY, LOCALFOLDER - -[coverage:run] -omit = - sunraster/conftest.py - sunraster/cython_version* - sunraster/*setup* - sunraster/extern/* - sunraster/*/tests/* - sunraster/version* - sunraster/__init__* - */sunraster/conftest.py - */sunraster/cython_version* - */sunraster/*setup* - */sunraster/extern/* - */sunraster/*/tests/* - */sunraster/version* - */sunraster/__init__* - -[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} - # Don't complain about IPython completion helper - def _ipython_key_completions_ diff --git a/setup.py b/setup.py index 0abaf4b0..c8233455 100755 --- a/setup.py +++ b/setup.py @@ -1,30 +1,4 @@ #!/usr/bin/env python -from setuptools import setup # isort:skip -import os -from itertools import chain +from setuptools import setup -try: - # Recommended for setuptools 61.0.0+ - # (though may disappear in the future) - from setuptools.config.setupcfg import read_configuration -except ImportError: - from setuptools.config import read_configuration - -################################################################################ -# Programmatically generate some extras combos. -################################################################################ -extras = read_configuration("setup.cfg")["options"]["extras_require"] - -# Dev is everything -extras["dev"] = list(chain(*extras.values())) - -# All is everything but tests and docs -exclude_keys = ("tests", "docs", "dev") -ex_extras = dict(filter(lambda i: i[0] not in exclude_keys, extras.items())) -# Concatenate all the values together for 'all' -extras["all"] = list(chain.from_iterable(ex_extras.values())) - -setup( - extras_require=extras, - use_scm_version={"write_to": os.path.join("sunraster", "_version.py")}, -) +setup() diff --git a/sunraster/_dev/__init__.py b/sunraster/_dev/__init__.py index 6415980f..72583c08 100644 --- a/sunraster/_dev/__init__.py +++ b/sunraster/_dev/__init__.py @@ -1,7 +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/sunraster/_dev/scm_version.py b/sunraster/_dev/scm_version.py index 572f8663..b9afb1d9 100644 --- a/sunraster/_dev/scm_version.py +++ b/sunraster/_dev/scm_version.py @@ -1,10 +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 as pth +import os.path try: from setuptools_scm import get_version - version = get_version(root=pth.join("..", ".."), relative_to=__file__) + version = get_version(root=os.path.join("..", ".."), relative_to=__file__) +except ImportError: + raise except Exception as e: - raise ImportError(f"setuptools_scm broken or not installed, {e}") from e + raise ValueError("setuptools_scm can not determine version.") from e diff --git a/sunraster/data/README.rst b/sunraster/data/README.rst new file mode 100644 index 00000000..382f6e76 --- /dev/null +++ b/sunraster/data/README.rst @@ -0,0 +1,6 @@ +Data directory +============== + +This directory contains data files included with the package source +code distribution. Note that this is intended only for relatively small files +- large files should be externally hosted and downloaded as needed. diff --git a/sunraster/instr/spice.py b/sunraster/instr/spice.py index 48108ea2..b974592a 100644 --- a/sunraster/instr/spice.py +++ b/sunraster/instr/spice.py @@ -2,12 +2,14 @@ import numbers import textwrap -import astropy.units as u import numpy as np + +import astropy.units as u from astropy.coordinates import SkyCoord from astropy.io import fits from astropy.time import Time from astropy.wcs import WCS + from ndcube import NDCollection from sunraster import RasterSequence, SpectrogramCube, SpectrogramSequence diff --git a/sunraster/instr/tests/test_spice.py b/sunraster/instr/tests/test_spice.py index e03ec13d..e8d740a8 100644 --- a/sunraster/instr/tests/test_spice.py +++ b/sunraster/instr/tests/test_spice.py @@ -1,11 +1,13 @@ import os.path -import astropy.units as u import numpy as np import pytest + +import astropy.units as u from astropy.coordinates import SkyCoord from astropy.io import fits from astropy.time import Time + from ndcube import NDCollection from sunpy.coordinates import HeliographicStonyhurst diff --git a/sunraster/spectrogram.py b/sunraster/spectrogram.py index 8900afc7..d7e5d373 100644 --- a/sunraster/spectrogram.py +++ b/sunraster/spectrogram.py @@ -3,10 +3,12 @@ import textwrap from copy import deepcopy -import astropy.units as u -import ndcube.utils.wcs as nuw import numpy as np + +import astropy.units as u from astropy.time import Time + +import ndcube.utils.wcs as nuw from ndcube.ndcube import NDCube from sunraster.meta import Meta diff --git a/sunraster/spectrogram_sequence.py b/sunraster/spectrogram_sequence.py index d6931b87..5c08a42d 100644 --- a/sunraster/spectrogram_sequence.py +++ b/sunraster/spectrogram_sequence.py @@ -1,10 +1,12 @@ import numbers import textwrap -import astropy.units as u import numpy as np + +import astropy.units as u from astropy.coordinates import SkyCoord from astropy.time import Time + from ndcube import NDCubeSequence from sunraster.spectrogram import ( diff --git a/sunraster/tests/__init__.py b/sunraster/tests/__init__.py index 84e1769b..92ea7073 100644 --- a/sunraster/tests/__init__.py +++ b/sunraster/tests/__init__.py @@ -1,7 +1,3 @@ -import os.path - -import sunraster - -__all__ = ["test_data_path"] - -test_data_dir = os.path.join(os.path.dirname(sunraster.__file__), "tests", "data") +""" +This module contains package tests. +""" diff --git a/sunraster/tests/test_spectrogram.py b/sunraster/tests/test_spectrogram.py index 4ddb0346..f9e29d4e 100644 --- a/sunraster/tests/test_spectrogram.py +++ b/sunraster/tests/test_spectrogram.py @@ -1,8 +1,10 @@ -import astropy.units as u import numpy as np import pytest + +import astropy.units as u from astropy.time import Time, TimeDelta from astropy.wcs import WCS + from ndcube.tests.helpers import assert_cubes_equal import sunraster.spectrogram diff --git a/sunraster/tests/test_spectrogramsequence.py b/sunraster/tests/test_spectrogramsequence.py index 2cfa62f4..21ddaae3 100644 --- a/sunraster/tests/test_spectrogramsequence.py +++ b/sunraster/tests/test_spectrogramsequence.py @@ -1,8 +1,10 @@ -import astropy.units as u import numpy as np import pytest + +import astropy.units as u from astropy.time import Time, TimeDelta from astropy.wcs import WCS + from ndcube.tests.helpers import assert_cubesequences_equal from sunraster import RasterSequence, SpectrogramCube, SpectrogramSequence diff --git a/sunraster/version.py b/sunraster/version.py index bf0f9144..523a97ab 100644 --- a/sunraster/version.py +++ b/sunraster/version.py @@ -1,5 +1,5 @@ # NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed -# This file is not included in sunpy wheels/tarballs, so otherwise it will +# This file is not included in wheels/tarballs, so otherwise it will # fall back on the generated _version module. try: try: @@ -13,26 +13,3 @@ del warnings version = "0.0.0" - - -# We use LooseVersion to define major, minor, micro, but ignore any suffixes. -def split_version(version): - pieces = [0, 0, 0] - - try: - from distutils.version import LooseVersion - - for j, piece in enumerate(LooseVersion(version).version[:3]): - pieces[j] = int(piece) - - except Exception: - pass - - return pieces - - -major, minor, bugfix = split_version(version) - -del split_version # clean up namespace. - -release = "dev" not in version diff --git a/tox.ini b/tox.ini index d37f3557..d7a38616 100644 --- a/tox.ini +++ b/tox.ini @@ -1,53 +1,87 @@ [tox] min_version = 4.0 +requires = + tox-pypi-filter>=0.14 envlist = - py{310,311,312}{,-oldestdeps,-devdeps,-online} - build_docs + py{310,311,312} + py312-devdeps + py310-oldestdeps codestyle + build_docs [testenv] pypi_filter = https://raw.githubusercontent.com/sunpy/sunpy/main/.test_package_pins.txt -changedir = .tmp/{envname} +# 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 - devdeps: with the latest developer version of key dependencies oldestdeps: with the oldest supported version of key dependencies -setenv = + devdeps: with the latest developer version of key dependencies +pass_env = + # A variable to tell tests we are on a CI system + CI + # Custom compiler locations (such as ccache) + CC + # Location of locales (needed by sphinx on some systems) + LOCALE_ARCHIVE + # If the user has set a LC override we should follow it + LC_ALL +set_env = MPLBACKEND = agg COLUMNS = 180 - PYTEST_COMMAND = pytest -vvv --pyargs sunraster --cov=sunraster --cov-report=xml --cov-config={toxinidir}/setup.cfg {toxinidir}/docs build_docs,online: HOME = {envtmpdir} devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple deps = + # For packages which publish nightly wheels this will pull the latest nightly devdeps: astropy>=0.0.dev0 devdeps: git+https://github.com/sunpy/ndcube devdeps: git+https://github.com/sunpy/sunpy devdeps: numpy>=0.0.dev0 - oldestdeps: ndcube<2.2 + # Packages without nightly wheels will be built from source like this + # devdeps: git+https://github.com/ndcube/ndcube + oldestdeps: minimum_dependencies online: pytest-rerunfailures online: pytest-timeout pytest-cov pytest-xdist +# The following indicates which extras_require will be installed extras = all tests +commands_pre = + oldestdeps: minimum_dependencies sunraster --filename requirements-min.txt + oldestdeps: pip install -r requirements-min.txt + pip freeze --all --no-input commands = - !online: {env:PYTEST_COMMAND} {posargs} - online: {env:PYTEST_COMMAND} --reruns 2 --timeout=180 --remote-data=any {posargs} - -[testenv:build_docs] -changedir = docs -description = Invoke sphinx-build to build the HTML docs -extras = docs -commands = - sphinx-build --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 amend the pytest command for different factors you can add a line + # which starts with a factor like `online: --remote-data=any \` + # If you have no factors which require different commands this is all you need: + pytest \ + -vvv \ + -r fEs \ + --pyargs sunraster \ + --cov-report=xml \ + --cov=sunraster \ + --cov-config={toxinidir}/.coveragerc \ + {toxinidir}/docs \ + {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-hooks - pre-commit run --all-files + pre-commit run --color always --all-files --show-diff-on-failure + +[testenv:build_docs] +description = invoke sphinx-build to build the HTML docs +change_dir = + docs +extras = + docs +commands = + sphinx-build -j auto --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs}