Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix
USER vscode
WORKDIR /home/vscode

RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
# numpy file format
*.npy filter=lfs diff=lfs merge=lfs -text
# GitHub syntax highlighting
pixi.lock linguist-language=YAML merge=ourslock
pixi.lock linguist-language=YAML merge=ourslock
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: pre-commit

on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
parse-changelog: true
parse-changelog: true
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args: ['--unsafe'] # Fixes errors parsing custom jinja templates
# - id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
# - id: trailing-whitespace
- id: fix-byte-order-marker

# Formatter for python
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"ryanluker.vscode-coverage-gutters",
"jjjermiah.pixi-vscode"
]
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"/home/vscode/.local/lib/python3.10/site-packages/python_template/**": true
},
"python.analysis.autoImportCompletions": false //vscode gets it wrong more than right and mostly gets in the way
}
}
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
## python_template

## [0.0.0]


3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,3 @@ There are two core tasks.
2. run \<cfg\>

This runs python with the file set in \<cfg\>



2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinxcontrib-napoleon
sphinx-rtd-theme
sphinx-autoapi
sphinx-autoapi
627 changes: 328 additions & 299 deletions pixi.lock

Large diffs are not rendered by default.

26 changes: 4 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ python_template = { path = ".", editable = true }

[project.optional-dependencies]
test = [
"black>=23,<=24.10.0",
"pylint>=3.2.5,<=3.3.1",
"pytest-cov>=4.1,<=6.0.0",
"pytest>=7.4,<=8.3.3",
"hypothesis>=6.104.2,<=6.116.0",
"ruff>=0.5.0,<=0.7.2",
"coverage>=7.5.4,<=7.6.4",
"pre-commit<=4.0.1"
]

[build-system]
Expand All @@ -60,7 +60,9 @@ py313 = ["py313","test"]


[tool.pixi.tasks]
format = "black ."
pre-commit = "pre-commit run -a"
pre-commit-update = "pre-commit autoupdate"
format = "ruff format ."
check-clean-workspace = "git diff --exit-code"
ruff-lint = "ruff check . --fix"
pylint = "pylint --version && echo 'running pylint...' && pylint $(git ls-files '*.py')"
Expand Down Expand Up @@ -90,26 +92,6 @@ jobs = 16 #detect number of cores
disable = "C,logging-fstring-interpolation,line-too-long,fixme,broad-exception-caught,missing-module-docstring,too-many-instance-attributes,too-few-public-methods,too-many-arguments,too-many-locals,too-many-branches,too-many-statements,use-dict-literal,cyclic-import,duplicate-code,too-many-public-methods"
enable = "no-else-return,consider-using-in"

[tool.black]
line-length = 100

[tool.ruff]
line-length = 100 # Same as Black.

target-version = "py310"

[tool.ruff.lint]
# Never enforce `E501` (line length violations).
#"F841" will auto remove unused variables which is annoying during development, pylint catches this anyway
ignore = ["E501", "E902", "F841"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]


[tool.coverage.run]
omit = ["*/test/*", "__init__.py"]

Expand Down
1 change: 1 addition & 0 deletions python_template.deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ apt_tools:
pip_language-toolchain:
- uv #use uv instead of pip
- pip #update to the latest pip
- pre-commit
16 changes: 16 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
line-length = 100

[lint]
# E501: Lines too long (maximum of 79 characters).
ignore = [
"E501", # Long line that exceeds maximum allowed length.
"F841", # Local variable referenced before assignment, this is annoying during development.
]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
[lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]
"**/{tests,docs,tools}/*" = ["E402"]
2 changes: 1 addition & 1 deletion scripts/setup_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ echo 'eval "$(pixi completion --shell bash)"' >> ~/.bashrc

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker || true
newgrp docker || true