Skip to content

Commit

Permalink
Merge in sunpy package template
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Feb 9, 2024
1 parent 4b77706 commit 08d079f
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: true
matrix:
os: ['ubuntu-latest', 'macOS-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/sub_package_update.yml
Original file line number Diff line number Diff line change
@@ -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:
pull_request:
branches:
main
jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- add-paths: .
body: Use this to merge the changes to the repo
branch: cruft/update
commit-message: "Automate package template update"
title: Incoming updates from package template
- add-paths: .cruft.json
body: Use this to reject changes in the repo
branch: cruft/reject
commit-message: "Chore: reject this cruft update"
title: Reject new updates from package template

steps:
- uses: actions/checkout@v3

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

- name: Install Cruft
run: pip3 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 "[email protected]"
git config --global user.name "Gromit"
cruft update --skip-apply-ask --refresh-private-variables
git restore --staged
- name: Create pull request
if: steps.check.output.has_changes == '1'
uses: peter-evans/create-pull-request@v4
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. ${{ matrix.body }}
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
155 changes: 147 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,156 @@
build/*
*.ipynb_checkpoints*
*.DS_Store
streamtracer.egg-info*
dist/*
*.pyc
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
.coverage
*.so
.asv/*
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# 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.
*.manifest
*.spec

# Installer logs
pip-log.txt
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/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# 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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.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

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

doc/_build/*
doc/api/*
# Cython debug symbols
cython_debug/

target/*
Cargo.lock
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Exclude specific files
# Prune folders
prune build
prune docs/_build
prune docs/api
global-exclude *.pyc *.o
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 32 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
"oldest-supported-numpy",
"maturin>=0.13,<0.14"
"maturin>=0.13,<0.14",
]
build-backend = "maturin"

[tool.maturin]
python-source = "python"

[tool.setuptools_scm]

[project]
name = "streamtracer"
version = "2.0.1"
description = "Python wrapped fortran to calculate streamlines"
authors = [
{name = "The SunPy Developers", email="[email protected]"},
{name = "David Stansby", email="[email protected]"},
{name = "Lars Mejnertsen"}
]
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9"
license = {text = "GPL v3"}
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = ["numpy>=1.14.5",]
dependencies = [
"numpy>=1.14.5",
]

[project.urls]
homepage = "https://streamtracer.readthedocs.io/en/stable/"
documentation = "https://streamtracer.readthedocs.io/en/stable/"
repository = "https://github.com/dstansby/streamtracer"
repository = "https://github.com/sunpy/streamtracer"

[project.optional-dependencies]
tests = ["pytest", "pytest-cov"]
tests = [
"pytest",
"pytest-cov",
"pytest-doctestplus",
]
docs = [
"jupyter-sphinx",
"numpydoc",
Expand All @@ -45,5 +47,24 @@ docs = [
]

[tool.pytest.ini_options]
addopts = "-ra"
addopts = "-ra --doctest-rst"
testpaths = ["doc", "python"]
doctest_plus = "enabled"
text_file_format = "rst"

[tool.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_",
]
Loading

0 comments on commit 08d079f

Please sign in to comment.