Skip to content

Commit 722a9b7

Browse files
authored
feat: upgrading python and structural integrity (#1)
1 parent 07d752a commit 722a9b7

21 files changed

Lines changed: 178 additions & 1382 deletions

File tree

.github/workflows/validate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Python
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: 3.9
17+
python-version: "3.10"
1818

1919
- name: Install pip
2020
run: |

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.mypy_cache
22
__pycache__
33
.pytest_cache
4-
.coverage
4+
.coverage
5+
.vscode
6+
7+
# poetry lock -- remove if desired to commit lock file
8+
poetry.lock

Makefile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
install:
2-
@poetry install --all-extras --with dev
3-
4-
lock:
5-
@poetry lock
2+
@poetry install --all-extras --with dev
3+
poetry lock
64

75
run:
8-
@poetry run python3 main.py
6+
poetry run python examples/main.py
97

10-
# Use --check to avoid auto format
118
fmt:
12-
@poetry run black $(FLAGS) .
9+
@poetry run black src tests
1310

1411
mypy:
15-
@poetry run mypy .
16-
17-
pylint:
18-
@poetry run pylint src
19-
20-
test:
21-
@poetry run pytest
12+
@poetry run mypy src tests
2213

2314
check: fmt mypy
2415
@poetry run prospector --profile prospector.yaml
2516

2617
validate: check
27-
@poetry run coverage run --source=lib -m pytest && \
18+
@poetry run coverage run --source=src -m pytest && \
2819
poetry run coverage report -m

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# End-to-End Python Template
1+
# End-to-End Python Template w/ Poetry
2+
[![v2.0.0](https://img.shields.io/badge/version-v2.0.0-blue.svg)](https://github.com/nachatz/python-template)
3+
[![Test](https://github.com/nachatz/python-template/actions/workflows/validate.yaml/badge.svg)](https://github.com/nachatz/python-template/actions/workflows/validate.yaml)
4+
[![License](https://img.shields.io/badge/license-Apache%202-brightgreen.svg)](https://github.com/nachatz/python-template/blob/master/LICENSE.txt)
5+
26

37
This is a Python project template that provides a starting point for building Python applications with essential development tools such as tests, linting, formatting, typing, coverage, and CI/CD setup using Poetry to manage dependencies.
48

@@ -90,7 +94,6 @@ To use this template for your Python project, follow these steps:
9094
Run
9195
```bash
9296
make install
93-
make lock`
9497
```
9598

9699
Ensure you have installed **Poetry & Python**
@@ -133,16 +136,12 @@ This project includes a set of make commands to help you manage your development
133136

134137
- `make install`: Install project dependencies, including development extras.
135138

136-
- `make lock`: Lock project dependencies using Poetry.
137-
138139
- `make fmt`: Format code using Black. Use the FLAGS variable to pass additional formatting options. Example: make fmt FLAGS="--exclude some_folder".
139140

140141
- `make mypy`: Run MyPy type checking.
141142

142143
- `make pylint`: Run pylint for code analysis.
143144

144-
- `make test`: Run pytest for testing.
145-
146145
- `make check`: Run formatting and type checking (fmt and mypy).
147146

148147
- `make validate`: Run full validation, including checks, tests, and coverage.

examples/main.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Python Template Code
3+
~~~~~~~~~~~~~~~~~~~~~
4+
5+
Sample starter code for enabling immediate development of Python applications
6+
utilizing pytest, pylint, black, mypy, and poetry for a sustainable e2e solution.
7+
8+
This showcases working with a Python built library
9+
"""
10+
11+
from project_template.engine import Serializer
12+
from project_template.models import PostModel
13+
14+
15+
def main():
16+
""" Application to fetch a PostModel, update it, and pretty-print the result using
17+
the 'project_template' library.
18+
"""
19+
20+
post: PostModel = Serializer.make_request()
21+
Serializer.update_post(post=post)
22+
Serializer.pretty_print(post=post)
23+
24+
if __name__ == "__main__":
25+
main()

lib/engine/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/engine/serializer.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

lib/models/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

main.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)