Skip to content

Commit

Permalink
Update template
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Feb 16, 2024
1 parent dfac827 commit 9c6f81c
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "013e2e3a2a1fd703718f77afdc3fd851699cae40",
"commit": "c26a53f1c7e99ec96ba4016f48752293b1d21dca",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
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
streamtracer/__init__.py,
rst-directives =
plot
137 changes: 122 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
### Python: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
tmp/

# C extensions
.coverage
*.so
.asv/*
# Distribution / packaging
.Python
pip-wheel-metadata/
build/
develop-eggs/
dist/
Expand Down Expand Up @@ -94,13 +98,6 @@ ipython_config.py
# 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
Expand Down Expand Up @@ -128,10 +125,6 @@ ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

Expand All @@ -140,17 +133,131 @@ venv.bak/

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

# 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

# Icon must ends with two \r.
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.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
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows: https://raw.githubusercontent.com/github/gitignore/master/Global/Windows.gitignore

# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Extra Python Items and SunPy Specific
docs/whatsnew/latest_changelog.txt
examples/**/*.csv
figure_test_images*
tags
baseline

# Release script
.github_cache

# Misc Stuff
.history
*.orig
.tmp
node_modules/
package-lock.json
package.json
.prettierrc

# Log files generated by 'vagrant up'
*.log

# Rust specific stuff
target/*
Cargo.lock
59 changes: 36 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@

repos:
# Sort order of Python imports
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
# Python code formatting
- repo: https://github.com/psf/black
rev: 24.2.0
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
- 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.*)$"
# Run mypy type validation
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
hooks:
- id: black
# Remove unused Python imports
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports", "--ignore-init-module-imports"]
# Run mypy type validation
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
hooks:
- id: mypy
additional_dependencies: [types-setuptools]

- id: mypy
additional_dependencies: [types-setuptools]
# Sort order of Python imports
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
# Python code formatting
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black

ci:
autofix_prs: false
29 changes: 29 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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: .
7 changes: 7 additions & 0 deletions .rtd-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: streamtracer
channels:
- conda-forge
dependencies:
- python=3.10
- pip
- graphviz!=2.42.*,!=2.43.*
39 changes: 39 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
target-version = "py310"
line-length = 110
exclude = [
".git,",
"__pycache__",
"build",
"streamtracer/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
]

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

[per-file-ignores]
# Part of configuration, not a package.
"setup.py" = ["INP001"]
"conftest.py" = ["INP001"]
# Implicit-namespace-package. The examples are not a package.
"docs/*.py" = ["INP001"]
"__init__.py" = ["E402", "F401", "F403"]
"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"]
# Need to import clients to register them, but don't use them in file
"streamtracer/net/__init__.py" = ["F811"]

[pydocstyle]
convention = "numpy"
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ description =
oldestdeps: with the oldest supported version of key dependencies
devdeps: with the latest developer version of key dependencies

pass_env =
# 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
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
Expand Down

0 comments on commit 9c6f81c

Please sign in to comment.