https://github.com/niqzart/python-template
A template repository for python projects with poetry, flake8, mypy, black, pre-commit and pytest
https://github.com/niqzart/python-template
black flake8 mypy poetry pre-commit pytest python template wemake-python-styleguide
Last synced: 12 months ago
JSON representation
A template repository for python projects with poetry, flake8, mypy, black, pre-commit and pytest
- Host: GitHub
- URL: https://github.com/niqzart/python-template
- Owner: niqzart
- Created: 2023-05-06T10:02:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T17:51:33.000Z (over 1 year ago)
- Last Synced: 2025-02-01T20:24:36.837Z (over 1 year ago)
- Topics: black, flake8, mypy, poetry, pre-commit, pytest, python, template, wemake-python-styleguide
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Template
## Basics
A template repository for python projects with:
- Poetry
- Linters (flake8, wemake-style-guide, mypy)
- Formatters (black, autoflake)
- Pre-commit
- Pytest
### How to use
Click "use this template" on the top right of the main repository page and create a new repository from this one. After that you can work on your new repository as usual. I'd recommend searching all `TODO` comments in the resulting repository and completing them
### Install
```
# TODO set to your poetry version
pip install poetry==2.1.3
poetry install
pre-commit install
```
## Additions
### Docker
Here is a template dockerfile for python /w poetry:
```dockerfile
FROM python:3.13-alpine
# TODO change to any directory
WORKDIR /app
RUN pip install --upgrade pip
# TODO set to your poetry version
RUN pip install poetry==2.1.3
RUN poetry config virtualenvs.create false
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-interaction --no-ansi --only main
# TODO `COPY` your project files
# TODO set the ENTRYPOINT and/or CMD
```
### Docker Compose
And a template docker-compose file:
```yaml
services:
app:
# depends_on:
# database:
# condition: service_healthy
build:
context: .
dockerfile: Dockerfile
# image:
restart: always
# command: ...
# ports:
# - target: 8000
# host_ip: 127.0.0.1
# published: 8000
# volumes:
# - type: bind # TODO you can pass source files for hot-reloading
# source:
# target: /
# environment:
# SECRET: local
```