Skip to content

Commit 0933ea0

Browse files
committed
feat: add the template
1 parent 4386e71 commit 0933ea0

File tree

16 files changed

+450
-5
lines changed

16 files changed

+450
-5
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
.venv
3+
.mypy_cache
4+
.pytest_cache
5+
.ruff_cache

.github/workflows/cd.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CD
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.13"
15+
- uses: yezz123/setup-uv@v4
16+
17+
- name: build
18+
run: uv build
19+
20+
- name: upload build
21+
uses: actions/upload-artifact@v4
22+
with:
23+
name: build
24+
path: dist/
25+
26+
pypi-publish:
27+
runs-on: ubuntu-latest
28+
environment:
29+
name: pypi
30+
url: https://pypi.org/p/lib_dist_name
31+
needs:
32+
- build
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-python@v4
36+
with:
37+
python-version: "3.13"
38+
- uses: yezz123/setup-uv@v4
39+
40+
- name: retrieve build
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: build
44+
path: dist/
45+
46+
- name: publish
47+
run: uv publish
48+
env:
49+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ruff:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: ruff
11+
run: docker compose -f deployments/dev/docker-compose.yaml run lib-kebab-case ruff check src tests
12+
13+
mypy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: mypy
18+
run: docker compose -f deployments/dev/docker-compose.yaml run lib-kebab-case mypy src tests
19+
20+
pytest:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: pytest
25+
run: docker compose -f deployments/dev/docker-compose.yaml run lib-kebab-case pytest tests

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ cython_debug/
167167
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168168
#.idea/
169169

170-
# Ruff stuff:
171-
.ruff_cache/
172-
173170
# PyPI configuration file
174171
.pypirc
172+
173+
# Custom
174+
.python-version
175+
.ruff_cache
176+
.uv_cache

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1-
# library
2-
Template for libs with CI/CD using ruff, mypy, pytest, uv, pypi
1+
# lib-kebab-case
2+
[![CI](https://github.com/emptybutton/lib-kebab-case/actions/workflows/ci.yml/badge.svg)](https://github.com/emptybutton/lib-kebab-case/actions?query=workflow%3ACI)
3+
[![CD](https://github.com/emptybutton/lib-kebab-case/actions/workflows/cd.yml/badge.svg)](https://github.com/emptybutton/lib-kebab-case/actions/workflows/cd.yaml)
4+
[![GitHub Release](https://img.shields.io/github/v/release/emptybutton/lib-kebab-case?style=flat&logo=github&labelColor=%23282e33&color=%237c73ff)](https://github.com/emptybutton/lib-kebab-case/releases)
5+
[![Lines](https://img.shields.io/endpoint?url=https%3A%2F%2Fghloc.vercel.app%2Fapi%2Femptybutton%2Flib-kebab-case%2Fbadge%3Ffilter%3D.py&logo=python&label=lines&color=blue)](https://github.com/search?q=repo%3Aemptybutton%2lib-kebab-case+language%3APython+&type=code)
6+
7+
lib_description.
8+
9+
```bash
10+
pip install lib_dist_name
11+
```
12+
13+
## Шаги индивидуализации
14+
Заменить:
15+
1. `lib-kebab-case` - на название либы в kebab-case
16+
2. `lib_snake_case` - на название либы в snake_case
17+
3. `lib_description` - на описание
18+
4. `lib_dist_name` - на название либы для распространения
19+
20+
Добавить `secrets.PYPI_TOKEN` в окружение `pypi` для доставки.
21+
Удалить эту информацию.

deployments/dev/docker-compose.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: lib-kebab-case
2+
3+
services:
4+
lib-kebab-case:
5+
image: lib-kebab-case:dev
6+
container_name: lib-kebab-case
7+
build:
8+
context: ../../
9+
dockerfile: deployments/dev/lib_snake_case/Dockerfile
10+
tags:
11+
- "lib-kebab-case:dev"
12+
volumes:
13+
- ../..:/app
14+
- lib-kebab-case-data:/run/app
15+
command: bash
16+
17+
volumes:
18+
lib-kebab-case-data: null
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS app
2+
3+
WORKDIR /app
4+
5+
ENV UV_LINK_MODE copy
6+
ENV UV_PROJECT_ENVIRONMENT /run/app/.venv
7+
ENV UV_CACHE_DIR /run/app/uv
8+
9+
ENV PYTHONPATH /app/src:/app/tests
10+
ENV WATCHFILES_FORCE_POLLING true
11+
12+
ENTRYPOINT ["bash", "deployments/dev/lib_snake_case/entrypoint.sh"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
source ${UV_PROJECT_ENVIRONMENT}/bin/activate
4+
$@

pyproject.toml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[project]
2+
name = "lib_dist_name"
3+
version = "0.2.0"
4+
description = "lib_description"
5+
authors = [
6+
{name = "Alexander Smolin", email = "88573504+emptybutton@users.noreply.github.com"}
7+
]
8+
readme = "README.md"
9+
license = { file = "LICENSE" }
10+
requires-python = ">=3.13"
11+
dependencies = []
12+
13+
[project.urls]
14+
Repository = "https://github.com/emptybutton/lib-kebab-case"
15+
16+
[project.optional-dependencies]
17+
dev = [
18+
"mypy[faster-cache]==1.15.0",
19+
"ruff==0.9.7",
20+
"pytest==8.3.4",
21+
"pytest-asyncio==0.25.3",
22+
"pytest-cov==6.0.0",
23+
"dirty-equals==0.8.0",
24+
]
25+
26+
[build-system]
27+
requires = ["hatchling"]
28+
build-backend = "hatchling.build"
29+
30+
[tool.hatch.build.targets.wheel]
31+
packages = ["src/lib_snake_case"]
32+
33+
[tool.mypy]
34+
mypy_path = "$MYPY_CONFIG_FILE_DIR/src:$MYPY_CONFIG_FILE_DIR/tests"
35+
strict = true
36+
no_namespace_packages = true
37+
allow_redefinition = true
38+
39+
[tool.ruff]
40+
src = ["src"]
41+
preview = true
42+
line-length = 90
43+
indent-width = 4
44+
45+
[tool.ruff.lint]
46+
select = [
47+
"ANN", "F", "W", "E", "B", "C90", "N", "UP", "YTT", "ASYNC", "PL", "RUF",
48+
"Q", "RET", "SLF", "SLOT", "SIM", "TID252", "TCH", "ARG", "PTH", "ERA", "TRY",
49+
"PERF", "INP", "I", "S", "FAST", "TID", "TCH", "INT"
50+
]
51+
ignore = ["N818", "RUF009", "UP018", "PLR6301", "PLR0913", "PLW0108", "TC006", "UP049", "UP046"]
52+
53+
[tool.ruff.lint.isort]
54+
lines-after-imports = 2
55+
56+
[tool.ruff.lint.per-file-ignores]
57+
"src/*" = ["PLR2004"]
58+
"tests/*" = ["S101", "PLR0124", "PLR0917", "S106", "C901"]
59+
"__init__.py" = ["PLC0414"]
60+
61+
[tool.pytest.ini_options]
62+
pythonpath = ["src"]
63+
asyncio_mode = "auto"
64+
asyncio_default_fixture_loop_scope = "session"
65+
66+
[tool.coverage.run]
67+
branch = true
68+
source = ["src/"]

src/lib_snake_case/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from lib_snake_case.x import X as X

0 commit comments

Comments
 (0)