Skip to content

Commit bcbabbd

Browse files
authored
Configure python, CI, and pre-commit via PR#1
- Increase python version to 3.13 and lowered minimum supported version to 3.11. - Add dependency groups for: - dev - test (no tests are set up yet) - docs (no docs are set up yet) - Add `uv.lock` - After we accept this pull request, run `uv sync` to get the environment - Configured pre-commit - I have pre-commit flag all print statements so that we don't accidentally push debugging code onto main. Do we want to require this and use some other logging solution for the code, or do we want to allow print statements? - Added CI formatting for pull requests and pushes to main - Add `dependabot.yml` to keep actions up to date
2 parents fc768fa + 836150c commit bcbabbd

File tree

13 files changed

+1049
-6
lines changed

13 files changed

+1049
-6
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
10+
11+
jobs:
12+
format:
13+
name: Format code
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v5
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: "3.13"
23+
24+
- name: Download pre-commit
25+
uses: pre-commit/[email protected]

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v6.0.0"
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: check-yaml
10+
- id: check-toml
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: requirements-txt-fixer
15+
- id: trailing-whitespace
16+
17+
# Ruff configured in pyproject.toml
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: "v0.14.0"
20+
hooks:
21+
- id: ruff-check
22+
args: ["--fix", "--show-fixes"]
23+
- id: ruff-format
24+
25+
- repo: https://github.com/kynan/nbstripout
26+
rev: "0.8.1"
27+
hooks:
28+
- id: nbstripout

.python-version

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

pyproject.toml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,74 @@
11
[project]
22
name = "test-particle-sim-1d"
33
version = "0.1.0"
4-
description = "Add your description here"
4+
description = "A 1D test particle tool for plasma applications"
5+
authors = [
6+
{ name = "budjensen", email = "[email protected]" },
7+
{ name = "lkadz", email = "[email protected]" },
8+
{ name = "SunnyNyhus" },
9+
]
510
readme = "README.md"
6-
requires-python = ">=3.12"
7-
dependencies = []
11+
requires-python = ">=3.11,<3.14"
12+
dependencies = [
13+
"numpy",
14+
"scipy",
15+
]
16+
17+
[dependency-groups]
18+
test = [
19+
"pytest",
20+
]
21+
dev = [
22+
{ include-group = "test" },
23+
"pre-commit",
24+
"ruff",
25+
"nox",
26+
]
27+
docs = [
28+
"furo",
29+
"myst_parser",
30+
"sphinx",
31+
"sphinx-markdown-builder",
32+
"sphinx_copybutton",
33+
]
34+
35+
[build-system]
36+
requires = ["hatchling"]
37+
build-backend = "hatchling.build"
38+
39+
[tool.ruff.lint]
40+
extend-select = [
41+
"ARG", # flake8-unused-arguments
42+
"B", # flake8-bugbear
43+
"C4", # flake8-comprehensions
44+
"EM", # flake8-errmsg
45+
"EXE", # flake8-executable
46+
"FURB", # refurb
47+
"G", # flake8-logging-format
48+
"I", # isort
49+
"ICN", # flake8-import-conventions
50+
"NPY", # NumPy specific rules
51+
"PD", # pandas-vet
52+
"PGH", # pygrep-hooks
53+
"PIE", # flake8-pie
54+
"PL", # pylint
55+
"PT", # flake8-pytest-style
56+
"PTH", # flake8-use-pathlib
57+
"PYI", # flake8-pyi
58+
"RET", # flake8-return
59+
"RUF", # Ruff-specific
60+
"SIM", # flake8-simplify
61+
"T20", # flake8-print
62+
"UP", # pyupgrade
63+
"YTT", # flake8-2020
64+
]
65+
ignore = [
66+
"PLR09", # Too many <...>
67+
"PLR2004", # Magic value used in comparison
68+
]
69+
typing-modules = ["mypackage._compat.typing"]
70+
isort.required-imports = ["from __future__ import annotations"]
71+
72+
[tool.ruff.lint.per-file-ignores]
73+
"tests/**" = ["T20"]
74+
"src/test_particle_sim_1d/__init__.py" = ["T201"]

src/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from __future__ import annotations
2+
3+
4+
def main() -> None:
5+
print("Hello from test-particle-sim-1D!")
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)