Skip to content

Commit c2c433d

Browse files
authored
Merge pull request #1 from namurphy/initial-setup
Initialize package infrastructure
2 parents b63fdb0 + cc7740e commit c2c433d

File tree

10 files changed

+552
-40
lines changed

10 files changed

+552
-40
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This file invokes Nox sessions to run tests, build documentation, and
2+
# perform other continuous integration (CI) checks. The Nox sessions are
3+
# defined in noxfile.py.
4+
5+
name: CI
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
workflow_dispatch:
13+
14+
permissions: {} # disables all GitHub permissions for the workflow
15+
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
jobs:
20+
21+
tests:
22+
name: ${{ matrix.name }}
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 30
25+
26+
strategy:
27+
fail-fast: false
28+
29+
matrix:
30+
include:
31+
32+
- name: Run plasmapy-calculator
33+
os: ubuntu-latest
34+
python: '3.11'
35+
nox_session: smoke_test
36+
37+
- name: Check consistency of pinned & project requirements
38+
os: ubuntu-latest
39+
python: '3.13'
40+
nox_session: validate_requirements
41+
42+
steps:
43+
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
with:
47+
persist-credentials: false
48+
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v6
51+
with:
52+
python-version: ${{ matrix.python }}
53+
enable-cache: true
54+
cache-suffix: ${{ matrix.nox_session }}-${{ matrix.python }}-${{ runner.os }}
55+
56+
- name: Run the check
57+
run: uvx nox -s '${{ matrix.nox_session }}'
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Update pinned requirements
2+
3+
on:
4+
schedule:
5+
- cron: 37 11 1 * *
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-requirements:
10+
name: Regenerate requirements
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'PlasmaPy/PlasmaPy'
13+
14+
steps:
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
python: 3.13
25+
26+
- name: Run Nox session to regenerate requirements
27+
run: uvx nox -s requirements
28+
29+
# When a PR is created by a GitHub Action, normally the checks will
30+
# not be run. While the simplest workaround would have been to open
31+
# and close the PR, an alternative is to authenticate with GitHub
32+
# App generated tokens (as done below). The instructions for how to
33+
# do this are in the documentation for the create-pull-request
34+
# action.
35+
36+
- name: Generate token
37+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
38+
id: generate_token
39+
with:
40+
app_id: ${{ secrets.APP_ID }}
41+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
42+
43+
- name: Create pull request
44+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
45+
with:
46+
title: Update pinned requirements 📍
47+
add-paths: uv.lock
48+
commit-message: Update requirements with 'nox -s requirements'
49+
# The PR body message is generated dynamically via `nox -s requirements` in CI
50+
body-path: .github/content/update-requirements-pr-body.md
51+
labels: no changelog entry needed, requirements
52+
base: main
53+
delete-branch: true
54+
token: ${{ steps.generate_token.outputs.token }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,4 @@ __marimo__/
205205
# Miscellaneous
206206

207207
\#*
208-
.idea
208+
.idea

.pre-commit-config.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
ci:
2+
autofix_prs: false
3+
autoupdate_schedule: quarterly
4+
5+
repos:
6+
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0
9+
hooks:
10+
- id: check-ast
11+
name: validate Python code
12+
- id: check-merge-conflict
13+
name: check for git merge conflicts
14+
exclude: .*\.rst
15+
- id: check-case-conflict
16+
name: check for filename case conflicts
17+
- id: name-tests-test
18+
args: [--pytest-test-first]
19+
exclude: src/plasmapy/tests/_helpers/.*
20+
- id: trailing-whitespace
21+
- id: end-of-file-fixer
22+
- id: check-json
23+
- id: check-toml
24+
- id: check-yaml
25+
26+
- repo: https://github.com/python-jsonschema/check-jsonschema
27+
rev: 0.33.2
28+
hooks:
29+
- id: check-github-workflows
30+
31+
- repo: https://github.com/sirosen/texthooks
32+
rev: 0.6.8
33+
hooks:
34+
- id: fix-smartquotes
35+
- id: fix-spaces
36+
- id: fix-ligatures
37+
- id: forbid-bidi-controls
38+
39+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
40+
rev: v2.15.0
41+
hooks:
42+
- id: pretty-format-ini
43+
args: [--autofix]
44+
- id: pretty-format-yaml
45+
args: [--autofix]
46+
# For the labeler GitHub Action, labels with spaces in them must
47+
# be put in quotes. However, the pretty-format-yaml hook will
48+
# remove the quotes which will break that action, so we should not
49+
# run this hook on `labeler.yml` (or certain other files).
50+
exclude: .github/labeler.yml|.pre-commit-search-and-replace.yaml
51+
52+
- repo: https://github.com/pre-commit/pygrep-hooks
53+
rev: v1.10.0
54+
hooks:
55+
- id: python-check-blanket-noqa
56+
name: noqa comments have an error code
57+
exclude: ^docs/plasmapy_sphinx/
58+
- id: rst-directive-colons
59+
- id: rst-inline-touching-normal
60+
- id: text-unicode-replacement-char
61+
62+
- repo: https://github.com/codespell-project/codespell
63+
rev: v2.4.1
64+
hooks:
65+
- id: codespell
66+
name: codespell (add false positives to pyproject.toml)
67+
args: [--write-changes]
68+
additional_dependencies:
69+
- tomli
70+
71+
- repo: https://github.com/crate-ci/typos
72+
rev: v1.34.0
73+
hooks:
74+
- id: typos
75+
name: typos (add false positives to _typos.toml)
76+
77+
- repo: https://github.com/astral-sh/ruff-pre-commit
78+
rev: v0.12.3
79+
hooks:
80+
- id: ruff
81+
name: ruff (see https://docs.astral.sh/ruff/rules)
82+
args: [--fix]
83+
- id: ruff-format
84+
name: autoformat source code with ruff-format
85+
86+
- repo: https://github.com/abravalheri/validate-pyproject
87+
rev: v0.24.1
88+
hooks:
89+
- id: validate-pyproject
90+
additional_dependencies: ['validate-pyproject-schema-store[all]']
91+
92+
- repo: https://github.com/tox-dev/pyproject-fmt
93+
rev: v2.6.0
94+
hooks:
95+
- id: pyproject-fmt
96+
97+
- repo: https://github.com/hukkin/mdformat
98+
rev: 0.7.22
99+
hooks:
100+
- id: mdformat
101+
name: Format .md files
102+
# Skip wrapping line length because doing so can mess up
103+
# formatting of GitHub issues created from files in
104+
# .github/content, and some files use semantic line breaks.
105+
exclude: licenses/.*|LICENSE.md|PATENT.md
106+
additional_dependencies:
107+
- mdformat-black
108+
- mdformat-footnote
109+
- mdformat-frontmatter
110+
- mdformat-gfm
111+
- mdformat-gfm-alerts

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.13
1+
3.11

LICENSE

Lines changed: 0 additions & 28 deletions
This file was deleted.

LICENSE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2015–2025, PlasmaPy Developers.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of PlasmaPy nor the names of its contributors may be used
16+
to endorse or promote products derived from this software without specific
17+
prior written permission.
18+
19+
This software is provided by the copyright holders and contributors "as is"
20+
and any express or implied warranties, including, but not limited to, the
21+
implied warranties of merchantability and fitness for a particular purpose are
22+
disclaimed. In no event shall the copyright holder or contributors be liable
23+
for any direct, indirect, incidental, special, exemplary, or consequential
24+
damages (including, but not limited to, procurement of substitute goods or
25+
services; loss of use, data, or profits; or business interruption) however
26+
caused and on any theory of liability, whether in contract, strict liability,
27+
or tort (including negligence or otherwise) arising in any way out of the use
28+
of this software, even if advised of the possibility of such damage.

0 commit comments

Comments
 (0)