Skip to content

Commit 229c300

Browse files
Merge pull request #39 from WilliamJamieson/testing/pre-commit
Enable pre-commit
1 parent 01c387b commit 229c300

25 files changed

+270
-68
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text eol=lf
2+
3+
# Don't mess with these files
4+
*.asdf binary
5+
*.png binary

.github/workflows/changelog.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Changelog
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, synchronize, reopened]
6+
7+
jobs:
8+
changelog:
9+
name: Confirm changelog entry
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
submodules: true
17+
- name: Grep for PR number in CHANGES.rst
18+
run: grep -P '\[[^\]]*#${{github.event.number}}[,\]]' CHANGES.rst
19+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog-entry-needed') }}

.github/workflows/ci.yml

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,45 @@ jobs:
1616
strategy:
1717
matrix:
1818
include:
19-
- name: Schema validation tests
19+
- name: Python 3.10 Schema validation tests
20+
python-version: '3.10'
21+
os: ubuntu-latest
22+
toxenv: py310
23+
24+
- name: Python 3.9 Schema validation tests
2025
python-version: 3.9
2126
os: ubuntu-latest
2227
toxenv: py39
2328

24-
- name: Check Python files with black autoformatter
29+
- name: Python 3.8 Schema validation tests
30+
python-version: 3.8
31+
os: ubuntu-latest
32+
toxenv: py38
33+
34+
- name: Python 3.7 Schema validation tests
35+
python-version: 3.7
36+
os: ubuntu-latest
37+
toxenv: py37
38+
39+
- name: Twine check
2540
python-version: 3.9
2641
os: ubuntu-latest
27-
toxenv: black
42+
toxenv: twine
2843

29-
- name: Check Python files with flake8
44+
- name: Code style checks
3045
python-version: 3.9
3146
os: ubuntu-latest
32-
toxenv: flake8
47+
toxenv: codestyle
48+
49+
- name: macOS
50+
python-version: 3.9
51+
os: macos-latest
52+
toxenv: py39
53+
54+
- name: Windows
55+
python-version: 3.9
56+
os: windows-latest
57+
toxenv: py39
3358

3459
steps:
3560
- name: Checkout code
@@ -46,3 +71,61 @@ jobs:
4671
python -m pip install tox
4772
- name: Run tox
4873
run: tox -e ${{ matrix.toxenv }}
74+
75+
asdf-astropy-dev:
76+
name: Run asdf-astropy development tests
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout asdf-transform-schemas
80+
uses: actions/checkout@v2
81+
with:
82+
fetch-depth: 0
83+
path: asdf-transform-schemas
84+
- name: Checkout asdf-astropy dev
85+
uses: actions/checkout@v2
86+
with:
87+
fetch-depth: 0
88+
repository: astropy/asdf-astropy
89+
ref: main
90+
path: asdf-astropy
91+
- name: Set up Python 3.9
92+
uses: actions/setup-python@v2
93+
with:
94+
python-version: 3.9
95+
- name: Install asdf-transform-schemas
96+
run: cd asdf-transform-schemas && pip install .
97+
- name: Install asdf-astropy
98+
run: cd asdf-astropy && pip install -e .[test]
99+
- name: Pip Freeze
100+
run: pip freeze
101+
- name: Run asdf-astropy development tests
102+
run: cd asdf-astropy && pytest
103+
104+
astropy-dev:
105+
name: Run astropy development tests
106+
runs-on: ubuntu-latest
107+
steps:
108+
- name: Checkout asdf-transform-schemas
109+
uses: actions/checkout@v2
110+
with:
111+
fetch-depth: 0
112+
path: asdf-transform-schemas
113+
- name: Checkout astropy dev
114+
uses: actions/checkout@v2
115+
with:
116+
fetch-depth: 0
117+
repository: astropy/astropy
118+
ref: main
119+
path: astropy
120+
- name: Set up Python 3.9
121+
uses: actions/setup-python@v2
122+
with:
123+
python-version: 3.9
124+
- name: Install asdf-transform-schemas
125+
run: cd asdf-transform-schemas && pip install .
126+
- name: Install astropy
127+
run: cd astropy && pip install -e .[test]
128+
- name: Pip Freeze
129+
run: pip freeze
130+
- name: Run astropy development tests
131+
run: cd astropy && pytest astropy/io/misc/asdf

.github/workflows/publish-to-pypi.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
uses: spacetelescope/action-publish_to_pypi/.github/workflows/workflow.yml@master
10+
with:
11+
test: false
12+
build_platform_wheels: false # Set to true if your package contains a C extension
13+
secrets:
14+
user: ${{ secrets.PYPI_USERNAME_ASDF_MAINTAINER }}
15+
password: ${{ secrets.PYPI_PASSWORD_ASDF_MAINTAINER }} # WARNING: Do not hardcode secret values here! If you want to use a different user or password, you can override this secret by creating one with the same name in your Github repository settings.
16+
test_password: ${{ secrets.PYPI_PASSWORD_ASDF_MAINTAINER_TEST }}

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.1.0
5+
hooks:
6+
- id: check-added-large-files
7+
- id: check-case-conflict
8+
- id: check-yaml
9+
args: ["--unsafe"]
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
14+
- repo: https://github.com/pycqa/isort
15+
rev: 5.10.1
16+
hooks:
17+
- id: isort
18+
19+
- repo: https://github.com/psf/black
20+
rev: 22.1.0
21+
hooks:
22+
- id: black
23+
24+
- repo: https://gitlab.com/pycqa/flake8
25+
rev: 4.0.1
26+
hooks:
27+
- id: flake8
28+
29+
- repo: https://github.com/PyCQA/bandit
30+
rev: 1.7.2
31+
hooks:
32+
- id: bandit
33+
args: ["-c", "bandit.yaml"]

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# asdf-transform-schemas
2+
![CI](https://github.com/asdf-format/asdf-transform-schemas/workflows/CI/badge.svg)
3+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
4+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
5+
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
26

37
This package provides ASDF schemas for validating transform tags. Users should not
48
need to install this directly; instead, install an implementation package such
59
as asdf-astropy, which includes asdf-transform-schemas as a dependency.
6-
7-
![CI](https://github.com/asdf-format/asdf-transform-schemas/workflows/CI/badge.svg)

bandit.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
exclude_dirs:
2+
- .eggs
3+
- .git
4+
- .pytest_cache
5+
- .tox
6+
- reference_files
7+
- tests
8+
- build
9+
- dist
10+
- docs
11+
- __pycache__

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
[build-system]
22
requires = ["setuptools", "wheel", "setuptools_scm"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.black]
6+
line-length = 120
7+
force-exclude = '''
8+
^/(
9+
(
10+
\.eggs
11+
| \.git
12+
| \.pytest_cache
13+
| \.tox
14+
| build
15+
| dist
16+
)/
17+
)
18+
'''
19+
20+
[tool.isort]
21+
profile = "black"
22+
filter_files = true

resources/stsci.edu/schemas/airy_disk2d-1.0.0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: >
1111
1212
examples:
1313
-
14-
- $f(r)=43.8[\frac{2J_1(\frac{\pi\sqrt{(x-0.5)^2+(y-1.5)^2}}{10.2/R_z})}{\frac{\pi\sqrt{(x-0.5)^2+(y-1.5)^2}}{10.2/R_z}}]^2$, where $J_1$ is the first order Bessel function and $R_z=1.2196698912665045$
14+
- $f(r)=43.8[\frac{2J_1(\frac{\pi\sqrt{(x-0.5)^2+(y-1.5)^2}}{10.2/R_z})}{\frac{\pi\sqrt{(x-0.5)^2+(y-1.5)^2}}{10.2/R_z}}]^2$, where $J_1$ is the first order Bessel function and $R_z=1.2196698912665045$
1515
- |
1616
!transform/airy_disk2d-1.0.0 {amplitude: 43.8, radius: 10.2, x_0: 0.5, y_0: 1.5}
1717

resources/stsci.edu/schemas/blackbody-1.0.0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ allOf:
3030
description: Scale factor.
3131
temperature:
3232
$ref: "../unit/quantity-1.1.0"
33-
description: Blackbody temperature.
33+
description: Blackbody temperature.
3434

3535
required: ['scale', 'temperature']
3636
...

0 commit comments

Comments
 (0)