Skip to content

Commit

Permalink
Merge pull request #474 from MITLibraries/maintenance-11-2024
Browse files Browse the repository at this point in the history
Maintenance 11 2024
  • Loading branch information
ehanson8 authored Nov 20, 2024
2 parents a75a408 + affbc33 commit 53dbd85
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 205 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ target/
.ipynb_checkpoints

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# asdf
.tool-versions
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
default_language_version:
python: python3.12 # set for project python version
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
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
35 changes: 23 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,51 @@
SHELL=/bin/bash
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)

help: # preview Makefile commands
help: # Preview Makefile commands
@awk 'BEGIN { FS = ":.*#"; print "Usage: make <target>\n\nTargets:" } \
/^[-_[:alpha:]]+:.?*#/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)
/^[-_[:alpha:]]+:.?*#/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)

install: # install Python dependencies
#######################
# Dependency commands
#######################

install: # Install Python dependencies
pipenv install --dev
pipenv run pre-commit install

update: install # update Python dependencies
update: install # Update Python dependencies
pipenv clean
pipenv update --dev

######################
# Unit test commands
######################
test: # run tests and print a coverage report

test: # Run tests and print a coverage report
pipenv run coverage run --source=solenoid -m pytest -vv
pipenv run coverage report -m

coveralls: test # write coverage data to an LCOV report
coveralls: test # Write coverage data to an LCOV report
pipenv run coverage lcov -o ./coverage/lcov.info

####################################
# Code quality and safety commands
####################################

lint: black mypy # run linters
lint: black mypy safety # Run linters

black: # run 'black' linter and print a review of suggested changes
black: # Run 'black' linter and print a preview of suggested changes
pipenv run black --check --diff .

mypy: # run 'mypy' linter
pipenv run mypy .
mypy: # Run 'mypy' linter
pipenv run mypy .

safety: # Check for security vulnerabilities and verify Pipfile.lock is up-to-date
pipenv check
pipenv verify

lint-apply: black-apply # apply changes with 'black'
lint-apply: # Apply changes with 'black' and resolve 'fixable errors' with 'ruff'
black-apply ruff-apply

black-apply: # apply changes with 'black'
black-apply: # Apply changes with 'black'
pipenv run black .
Loading

0 comments on commit 53dbd85

Please sign in to comment.