Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
branchvincent committed Oct 28, 2023
1 parent 821d306 commit 883f68e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 33 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ A [Copier](https://github.com/copier-org/copier) template for a Python package b
> **Requires**: copier>=6.0.0a7
```sh
copier gh:branchvincent/python-template <dest>
copier copy --trust gh:branchvincent/python-template <dest>
```

## Features

- Package manager: [Poetry](https://python-poetry.org/)
- Formatting: [Black](https://black.readthedocs.io/en/stable/) and [isort](https://isort.readthedocs.io/en/latest/)
- Formatting: [Ruff](https://docs.astral.sh/ruff/formatter/)
- Testing: [pytest](https://docs.pytest.org/en/latest/)
- Linting: [flake8](https://flake8.pycqa.org/) and [pre-commit](https://pre-commit.com/)
- Linting: [Ruff](https://docs.astral.sh/ruff/linter/) and [pre-commit](https://pre-commit.com/)
- Typing: [mypy](https://mypy.readthedocs.io/en/stable/)
- Task runner: [taskipy](https://github.com/illBeRoy/taskipy)
- CI/CD: [Github Actions](https://docs.github.com/en/actions)
Expand Down
21 changes: 7 additions & 14 deletions src/.github/workflows/ci.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/checkout@v4
- name: Set up Poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
run: pipx install poetry
- uses: actions/setup-python@v4
with:
path: .venv
key: {% raw %}${{ runner.os }}-venv-py3.9-${{ hashFiles('**/poetry.lock') }}{% endraw %}
python-version: 3.12
cache: poetry
- name: Install package
run: poetry install
- name: Run linters
Expand All @@ -36,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'cd skip')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Bump version
uses: TriPSs/conventional-changelog-action@v3
id: version
Expand All @@ -58,7 +51,7 @@ jobs:
{% if not private -%}
- name: Publish to PyPI
if: steps.version.outputs.skipped == 'false'
run: pip install poetry && poetry publish --build
run: pipx run poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: {% raw %}${{ secrets.PYPI_TOKEN }}{% endraw %}
{% endif -%}
Expand Down
18 changes: 6 additions & 12 deletions src/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ classifiers = ["Private :: Do Not Upload"]
{%- endif %}

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.12"

[tool.poetry.dev-dependencies]
black = "*"
flake8 = "*"
isort = "*"
[tool.poetry.group.dev.dependencies]
{% if docs -%}
mkdocs = "*"
mkdocs-material = "*"
{% endif -%}
mypy = "*"
pre-commit = "*"
pyproject-flake8 = "*"
pytest = "*"
ruff = "*"
taskipy = "*"

[tool.taskipy.tasks]
Expand All @@ -35,12 +32,9 @@ docs = { cmd = "mkdocs serve -f docs/mkdocs.yaml", help = "Serve documentation"}
lint = { cmd = "pre-commit run --all-files", help = "Run linters and formatters" }
test = { cmd = "pytest", help = "Run tests" }

[tool.flake8]
max-line-length = 88
extend-ignore = "E203"

[tool.isort]
profile = "black"
[tool.ruff]
fix = true
select = ["B", "E", "F", "I", "SIM", "UP"]

[tool.mypy]
strict = true
Expand Down
8 changes: 4 additions & 4 deletions src/{% if docker %}Dockerfile{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM python:3.9-alpine AS base
FROM python:3.12-alpine AS base
WORKDIR /app

### Builder ###
FROM base AS builder

# Install poetry
RUN pip install --no-cache-dir poetry~=1.1 \
RUN pip install --no-cache-dir poetry~=1.6 \
&& poetry config virtualenvs.in-project true

# Install deps
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root --no-dev
RUN poetry install --no-root --only=main

# Add source
COPY . .
RUN poetry install --no-dev
RUN poetry install --only=main

### Runner ###
FROM base AS runner
Expand Down

0 comments on commit 883f68e

Please sign in to comment.