Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Package Template + Linting changes #347

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coverage:
status:
project:
default:
threshold: 1%
threshold: 0.2%

codecov:
require_ci_to_pass: false
Expand Down
14 changes: 14 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[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,
emiss
32 changes: 30 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
[run]
omit = *test_idl*
branch = True
omit =
aiapy/conftest.py
aiapy/*setup_package*
aiapy/extern/*
aiapy/version*
*/aiapy/conftest.py
*/aiapy/*setup_package*
*/aiapy/extern/*
*/aiapy/version*
*test_idl*

[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
38 changes: 38 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "5ff9d6c54fb7381e36ae5375a3ee4b1c2762f9b3",
"checkout": null,
"context": {
"cookiecutter": {
"package_name": "aiapy",
"module_name": "aiapy",
"short_description": "Python library for AIA data analysis",
"author_name": "AIA Instrument Team @ LMSAL",
"author_email": "[email protected]",
"project_url": "https://aia.lmsal.com/",
"github_repo": "LM-SAL/aiapy",
"sourcecode_url": "https://github.com/LM-SAL/aiapy",
"download_url": "https://pypi.org/project/aiapy",
"documentation_url": "https://aiapy.readthedocs.io/en/stable/",
"changelog_url": "https://aiapy.readthedocs.io/en/stable/changelog.html",
"issue_tracker_url": "https://github.com/LM-SAL/aiapy/issues/",
"license": "BSD 3-Clause",
"minimum_python_version": "3.10",
"use_compiled_extensions": "n",
"enable_dynamic_dev_versions": "y",
"include_example_code": "y",
"include_cruft_update_github_workflow": "y",
"use_extended_ruff_linting": "y",
"_sphinx_theme": "sunpy",
"_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
}
27 changes: 27 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -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
aiapy/__init__.py
rst-directives =
plot
98 changes: 65 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Main CI Workflow
name: CI

on:
push:
branches:
- "main"
- "*.*"
- "!*backport*"
- 'main'
- '*.*'
- '!*backport*'
tags:
- "v*"
- "!*dev*"
- "!*pre*"
- "!*post*"
- 'v*'
- '!*dev*'
- '!*pre*'
- '!*post*'
pull_request:
# Allow manual runs through the web UI
workflow_dispatch:
Expand All @@ -21,47 +22,57 @@ concurrency:

jobs:
core:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
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]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
needs: [core, sdist_verify]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n auto
envs: |
- windows: py310
- macos: py311
- linux: py312-devdeps
- windows: py311
- macos: py310-oldestdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
needs: [core]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
default_python: "3.12"
default_python: '3.12'
submodules: false
pytest: false
toxdeps: tox-pypi-filter
libraries: |
apt:
- graphviz
cache-path: |
docs/_build/
docs/generated/
.tox/sample_data/
libraries: |
apt:
- graphviz
cache-key: docs-${{ github.run_id }}
envs: |
- linux: build_docs

Expand All @@ -70,34 +81,55 @@ jobs:
needs: [docs]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.12'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n auto --dist loadgroup
envs: |
- linux: build_docs-gallery
pytest: false
cache-path: |
docs/_build/
docs/generated/
.tox/sample_data/
cache-key: docs-${{ github.run_id }}
libraries:
apt:
- graphviz
- linux: py312-online

cron:
if: |
github.event_name == 'workflow_dispatch' || (
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Run cron CI')
)
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
default_python: '3.12'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
envs: |
- linux: py313-devdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish:
# Build wheels when pushing to any branch except main
# publish.yml will only publish if tagged ^v.*
# 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' ||
github.event_name == 'workflow_dispatch'
)
) || (
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Run publish')
)
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
needs: [test, docs]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
with:
python-version: "3.12"
test_extras: "all,tests"
test_command: 'pytest -p no:warnings --doctest-rst -m "not mpl_image_compare" --pyargs aiapy'
python-version: '3.12'
test_extras: 'all,tests'
test_command: 'pytest -p no:warnings --doctest-rst --pyargs aiapy'
submodules: false
secrets:
pypi_token: ${{ secrets.pypi_token }}
23 changes: 23 additions & 0 deletions .github/workflows/label_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Label Sync
on:
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 0 * * *' # run every day at midnight UTC

# Give permissions to write issue labels
permissions:
issues: write

jobs:
label_sync:
runs-on: ubuntu-latest
name: Label Sync
steps:
- uses: srealmoreno/label-sync-action@850ba5cef2b25e56c6c420c4feed0319294682fd
with:
config-file: https://raw.githubusercontent.com/sunpy/.github/main/labels.yml
Loading
Loading