Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre commit #55

Merged
merged 19 commits into from
Apr 9, 2024
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 .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ updates:
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .github/workflows/envs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:

dependencies:
- pip:
- -r ../../../requirements/requirements-test.txt
- -r ../../../requirements/requirements-test.txt
3 changes: 1 addition & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.5.0'
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-yaml
- id: debug-statements
- id: requirements-txt-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.2
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
66 changes: 66 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
target-version = "py38"

[lint]
select = [
"A",
"B",
"D",
"E501",
"EM",
"E",
"F",
"I",
"ICN",
"ISC",
"N",
"NPY",
"PL",
"PT",
"RET",
"RUF",
"UP",
"W",
]

ignore = [
"D107", # Do not document __init__ separately from the class.
"D105",
"D103",
"D100",
"N806",
"N802",
"N813",
"PLR0913",
"PLR0912",
"PLR0915",
"PLR2004",
"ISC001",
"N803",
"D200",
"N999",
]

[lint.per-file-ignores]

"*/__init__.py" = ["F401", # __init__.py import submodules for use by the package importer.
"D104",
"N999",
"D205",
"D415",
"E501"
]

"tests/*.py" = ["PLR2004", # unit test value comparisons are not magic values
"N999",
"D104"
]

"docs/source/conf.py" = ["A001", # Allow copyright variable name
"D", # conf.py does not need documentation
]

[lint.pydocstyle]
convention = "google"

[format]
quote-style = "double"
3 changes: 1 addition & 2 deletions ConservedWaterSearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""
ConservedWaterSearch
"""ConservedWaterSearch
Module for identification of conserved waters from MD trajetory
"""
Loading