-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IN-894 Update project configuration and linting defaults
Why these changes are being introduced: * Simplify and harmonize project configuration and linting methods with modern and active libraries that augment one another. How this addresses that need: * Add new files based on our Python project templates: * Makefile * pyproject.toml * .pre-commit-config.yaml * Update Pipfile to include default depdendencies for 'dev-packages' * Update Pipfile to install 'psycopg2-binary' * Update dependencies Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-894
- Loading branch information
1 parent
b34f77b
commit d82ebb8
Showing
5 changed files
with
1,138 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
default_language_version: | ||
python: python3.11 | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: black-apply | ||
name: black-apply | ||
entry: pipenv run black | ||
language: system | ||
pass_filenames: true | ||
types: ["python"] | ||
- id: mypy | ||
name: mypy | ||
entry: pipenv run mypy | ||
language: system | ||
pass_filenames: true | ||
types: ["python"] | ||
exclude: "tests/" | ||
- id: ruff-apply | ||
name: ruff-apply | ||
entry: pipenv run ruff check --fix | ||
language: system | ||
pass_filenames: true | ||
types: ["python"] | ||
- id: safety | ||
name: safety | ||
entry: pipenv check | ||
language: system | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
SHELL=/bin/bash | ||
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ) | ||
|
||
## ---- Dependency commands ---- ## | ||
|
||
install: # install dependencies | ||
pipenv install --dev | ||
pipenv run pre-commit install | ||
|
||
update: install # update all Python dependencies | ||
pipenv clean | ||
pipenv update --dev | ||
|
||
## ---- Unit test commands ---- ## | ||
|
||
test: # run tests and print a coverage report | ||
pipenv run coverage run --source=my_app -m pytest -vv | ||
pipenv run coverage report -m | ||
|
||
coveralls: test | ||
pipenv run coverage lcov -o ./coverage/lcov.info | ||
|
||
|
||
## ---- Code quality and safety commands ---- ## | ||
|
||
# linting commands | ||
lint: black mypy ruff safety | ||
|
||
black: | ||
pipenv run black --check --diff . | ||
|
||
mypy: | ||
pipenv run mypy . | ||
|
||
ruff: | ||
pipenv run ruff check . | ||
|
||
safety: | ||
pipenv check | ||
pipenv verify | ||
|
||
# apply changes to resolve any linting errors | ||
lint-apply: black-apply ruff-apply | ||
|
||
black-apply: | ||
pipenv run black . | ||
|
||
ruff-apply: | ||
pipenv run ruff check --fix . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.