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

Updates inline with SunPy package template #1

Merged
merged 4 commits into from
Feb 27, 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
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "2d45e572cdb08623eaab16e8da0a007f2f3f9e96",
"commit": "74b4ef6d57c2b3f0dac7e8230e918eac94f45403",
"checkout": null,
"context": {
"cookiecutter": {
"package_name": "sunkit-magex",
"module_name": "sunkit-magex",
"module_name": "sunkit_magex",
"short_description": "Potential field source surface modelling",
"author_name": "The SunPy Community",
"author_email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ publish_pure:
with:
python-version: '3.10'
test_extras: 'tests'
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunkit-magex'
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunkit_magex'
submodules: false
secrets:
pypi_token: ${{ secrets.pypi_token }}
51 changes: 28 additions & 23 deletions .github/workflows/sub_package_update.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"""
This template is taken from the cruft example code, for further information please see:
https://cruft.github.io/cruft/#automating-updates-with-github-actions
"""
# 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:
pull_request:
branches:
main
# 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
Expand All @@ -19,25 +24,25 @@ jobs:
matrix:
include:
- add-paths: .
body: Use this to merge the changes to the repo
body: apply the changes to this repo.
branch: cruft/update
commit-message: "Automate package template update"
title: Incoming updates from package template
commit-message: "Automatic package template update"
title: Updates from the package template
- add-paths: .cruft.json
body: Use this to reject changes in the repo
body: reject these changes for this repo.
branch: cruft/reject
commit-message: "Chore: reject this cruft update"
commit-message: "Reject this package template update"
title: Reject new updates from package template

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- name: Install Cruft
run: pip3 install cruft
run: python -m pip install cruft

- name: Check if update is available
continue-on-error: false
Expand All @@ -57,15 +62,15 @@ jobs:
- name: Run update if available
if: steps.check.outputs.has_changes == '1'
run: |
git config --global user.email "gromit@cruft.com"
git config --global user.name "Gromit"
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
git restore --staged .

- name: Create pull request
if: steps.check.output.has_changes == '1'
uses: peter-evans/create-pull-request@v4
if: steps.check.outputs.has_changes == '1'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: ${{ matrix.add-paths }}
Expand All @@ -75,5 +80,5 @@ jobs:
branch-suffix: timestamp
title: ${{ matrix.title }}
body: |
This is an autogenerated PR. ${{ matrix.body }}
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
This is an autogenerated PR, which will ${{ matrix.body }}.
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
sunkit-magex/_version.py
sunkit_magex/_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.
Expand Down Expand Up @@ -74,6 +74,8 @@ instance/

# Sphinx documentation
docs/_build/
# automodapi
docs/api

# PyBuilder
.pybuilder/
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ extend-ignore = [
"PT023", # Always use () on pytest decorators
]

[flake8-tidy-imports]
[flake8-tidy-imports.banned-api]
[lint.flake8-tidy-imports]
[lint.flake8-tidy-imports.banned-api]
"warnings.warn".msg = "Use sunpy specific warning helpers warn_* from sunpy.utils.exceptions"

[per-file-ignores]
[lint.per-file-ignores]
# Part of configuration, not a package.
"setup.py" = ["INP001"]
"conftest.py" = ["INP001"]
Expand All @@ -35,5 +35,5 @@ extend-ignore = [
# Need to import clients to register them, but don't use them in file
"sunkit-magex/net/__init__.py" = ["F811"]

[pydocstyle]
[lint.pydocstyle]
convention = "numpy"
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ global-exclude *.pyc *.o

# This subpackage is only used in development checkouts
# and should not be included in built tarballs
prune sunkit-magex/_dev
prune sunkit_magex/_dev
10 changes: 4 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
Expand All @@ -9,14 +7,14 @@

# -- Project information -----------------------------------------------------

# The full version, including alpha/beta/rc tags
from sunkit_magex import __version__
release = __version__

project = "sunkit-magex"
copyright = "2022, The SunPy Community"
author = "The SunPy Community"

# The full version, including alpha/beta/rc tags
from sunkit-magex import __version__
release = __version__

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down
36 changes: 18 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
build-backend = "setuptools.build_meta"

[project]
name = "sunkit-magex"
name = "sunkit_magex"
description = "Potential field source surface modelling"
readme = "README.rst"
requires-python = ">=3.9"
Expand All @@ -21,7 +21,7 @@ dynamic = ["version"]
tests = [
"pytest",
"pytest-doctestplus",
"pytest-cov",
"pytest-cov"
]
docs = [
"sphinx",
Expand All @@ -39,11 +39,11 @@ include-package-data = true
[tool.setuptools.packages.find]

[tool.setuptools_scm]
write_to = "sunkit-magex/_version.py"
write_to = "sunkit_magex/_version.py"

[tool.pytest.ini_options]
testpaths = [
"sunkit-magex",
"sunkit_magex",
"docs",
]
doctest_plus = "enabled"
Expand All @@ -52,20 +52,20 @@ addopts = "--doctest-rst"

[tool.coverage.run]
omit = [
"sunkit-magex/__init*",
"sunkit-magex/conftest.py",
"sunkit-magex/*setup_package*",
"sunkit-magex/tests/*",
"sunkit-magex/*/tests/*",
"sunkit-magex/extern/*",
"sunkit-magex/version*",
"*/sunkit-magex/__init*",
"*/sunkit-magex/conftest.py",
"*/sunkit-magex/*setup_package*",
"*/sunkit-magex/tests/*",
"*/sunkit-magex/*/tests/*",
"*/sunkit-magex/extern/*",
"*/sunkit-magex/version*",
"sunkit_magex/__init*",
"sunkit_magex/conftest.py",
"sunkit_magex/*setup_package*",
"sunkit_magex/tests/*",
"sunkit_magex/*/tests/*",
"sunkit_magex/extern/*",
"sunkit_magex/version*",
"*/sunkit_magex/__init*",
"*/sunkit_magex/conftest.py",
"*/sunkit_magex/*setup_package*",
"*/sunkit_magex/tests/*",
"*/sunkit_magex/*/tests/*",
"*/sunkit_magex/extern/*",
"*/sunkit_magex/version*",
]

[tool.coverage.report]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
except ImportError:
raise
except Exception as e:
raise ValueError(f'setuptools_scm can not determine version.') from e
raise ValueError('setuptools_scm can not determine version.') from e
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 13 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ envlist =
py{39,310,311,312}
py312-devdeps
py39-oldestdeps
codestyle
build_docs

[testenv]
Expand All @@ -30,21 +31,22 @@ set_env =
MPLBACKEND=agg
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 sunkit-magex --cov-report=xml --cov=sunkit-magex --cov-config={toxinidir}/pyproject.toml {toxinidir}/docs
PYTEST_COMMAND = pytest -vvv -r fEs --pyargs sunkit_magex --cov-report=xml --cov=sunkit_magex --cov-config={toxinidir}/pyproject.toml {toxinidir}/docs

deps =
# For packages which publish nightly wheels this will pull the latest nightly
devdeps: numpy>=0.0.dev0
# Packages without nightly wheels will be built from source like this
# devdeps: git+https://github.com/ndcube/ndcube
oldestdeps: minimum_dependencies
pytest-cov

# The following indicates which extras_require will be installed
extras =
tests

commands_pre =
oldestdeps: minimum_dependencies packagename --filename requirements-min.txt
oldestdeps: minimum_dependencies sunkit_magex --filename requirements-min.txt
oldestdeps: pip install -r requirements-min.txt
pip freeze --all --no-input

Expand All @@ -56,16 +58,15 @@ commands =
# If you have no factors which require different commands this is all you need:
{env:PYTEST_COMMAND} {posargs}

# Uncomment this once we add pre-commit
#[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 --color always --all-files --show-diff-on-failure
[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 --color always --all-files --show-diff-on-failure

[testenv:build_docs]
description = invoke sphinx-build to build the HTML docs
Expand Down