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

Bump python 3.12 and maintenance updates #258

Merged
merged 5 commits into from
Jun 12, 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
35 changes: 13 additions & 22 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
### What does this PR do?

Describe the overall purpose of the PR changes. Doesn't need to be as specific as the
individual commits.

### Helpful background context

Describe any additional context beyond what the PR accomplishes if it is likely to be
useful to a reviewer.

Delete this section if it isn't applicable to the PR.
### Purpose and background context
Describe the overall purpose of the PR changes and any useful background context.

### How can a reviewer manually see the effects of these changes?

Explain how to see the proposed changes in the application if possible.

Delete this section if it isn't applicable to the PR.

### Includes new or updated dependencies?
YES | NO

### Changes expectations for external applications?
YES | NO

### What are the relevant tickets?

Include links to Jira Software and/or Jira Service Management tickets here.
- Include links to Jira Software and/or Jira Service Management tickets here.

### Developer

- [ ] All new ENV is documented in README (or there is none)
- [ ] All new ENV is documented in README
- [ ] All new ENV has been added to staging and production environments
- [ ] All related Jira tickets are linked in commit message(s)
- [ ] Stakeholder approval has been confirmed (or is not needed)

### Code Reviewer

- [ ] The commit message is clear and follows our guidelines
(not just this pull request message)
### Code Reviewer(s)
- [ ] The commit message is clear and follows our guidelines (not just this PR message)
- [ ] There are appropriate tests covering any new functionality
- [ ] The documentation has been updated or is unnecessary
- [ ] The changes have been verified
- [ ] The provided documentation is sufficient for understanding any new functionality introduced
- [ ] Any manual tests have been performed **or** provided examples verified
- [ ] New dependencies are appropriate or there were no changes

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@ cython_debug/
.DS_Store
output/
.vscode/
.idea/
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
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.2
3.12
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim as build
FROM python:3.12-slim as build
WORKDIR /app
COPY . .

Expand Down
56 changes: 36 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,63 @@ ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/alma-sapinvoices-dev
SHELL=/bin/bash
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)

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

install: ## Install dependencies and CLI app
#######################
# Dependency commands
#######################

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

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

### Test commands ###
######################
# Unit test commands
######################

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

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

### Code quality and safety commands ###

lint: bandit black mypy pylama pydocstyle safety ## Run linting, code quality, and safety checks
####################################
# Code quality and safety commands
####################################

bandit:
pipenv run bandit -r sapinvoices
lint: black mypy ruff safety # run linters

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

mypy:
pipenv run mypy sapinvoices

pylama:
pipenv run pylama --options setup.cfg
mypy: # run 'mypy' linter
pipenv run mypy .

pydocstyle:
pipenv run pydocstyle sapinvoices
ruff: # run 'ruff' linter and print a preview of errors
pipenv run ruff check .

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

lint-apply: black-apply ruff-apply # apply changes to resolve any linting errors

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

ruff-apply: # resolve 'fixable errors' with 'ruff'
pipenv run ruff check --fix .

####################################
# Docker and Terraform commands
####################################

### Terraform-generated Developer Deploy Commands for Dev environment ###
dist-dev: ## Build docker container (intended for developer-based manual build)
Expand Down
8 changes: 3 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ decorator = "*"
click = "==8.1.3"

[dev-packages]
bandit = "*"
black = "*"
boto3-stubs = "*"
coverage = "*"
coveralls = "*"
mock-ssh-server = "*"
moto = "*"
mypy = "*"
pylama = {extras = ["all"], version = "*"}
pytest = "*"
pydocstyle = "*"
pre-commit = "*"
requests-mock = "*"
ruff = "*"
types-requests = "*"
types-paramiko = "*"

[requires]
python_version = "3.11"
python_version = "3.12"

[scripts]
sap = "python -c \"from sapinvoices.cli import main; main()\""
Loading
Loading