Skip to content

Commit 2e51452

Browse files
committed
alternative project setup files
1 parent 0a9bb45 commit 2e51452

3 files changed

Lines changed: 181 additions & 0 deletions

File tree

alt_files/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ubuntu:focal
2+
3+
RUN apt-get update
4+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common
5+
RUN add-apt-repository -y 'ppa:deadsnakes/ppa'
6+
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends python3.8 python3.8-venv
7+
RUN rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /src
10+
11+
ENV PATH=/venv/bin:$PATH
12+
RUN python3.8 -m venv /venv
13+
14+
COPY . /src
15+
RUN python3.8 -m pip install . --no-cache-dir
16+
17+
CMD ["tox", "-r"]

alt_files/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: install-dev
2+
install-dev:
3+
python -m pip install --upgrade --editable .[dev,test]
4+
pre-commit install
5+
6+
.PHONY: coverage
7+
coverage:
8+
coverage run -m pytest tests/
9+
coverage report -m
10+
11+
.PHONY: docker-test
12+
docker-test:
13+
docker build -t pydocker-test .
14+
docker run --rm pydocker-test
15+
16+
.PHONY: build-dist
17+
build-dist:
18+
python -m pip install --upgrade build
19+
python -m build
20+
21+
.PHONY: clean
22+
clean:
23+
find . -name '*.pyc' -exec rm -f {} +
24+
find . -name '*.pyo' -exec rm -f {} +
25+
find . -name '__pycache__' -exec rm -rf {} +
26+
find . -name '.mypy_cache' -exec rm -rf {} +
27+
rm -rf .tox
28+
rm -f coverage.xml
29+
rm -f coverage.json
30+
rm -rf htmlcov
31+
rm -rf .coverage
32+
rm -rf .coverage.*
33+
find . -name '.pytest_cache' -exec rm -rf {} +
34+
rm -rf dist
35+
rm -rf build

alt_files/pyproject.toml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "module-name"
7+
version = "0.1.0"
8+
requires-python = ">=3.7"
9+
description = "Module Description"
10+
readme = "README.md"
11+
license = { file = "LICENSE" }
12+
authors = [
13+
{ email = "yourname@email.invalid", name = "[YOUR NAME]" }
14+
]
15+
maintainers = []
16+
keywords = []
17+
classifiers = [
18+
"License :: OSI Approved :: MIT License",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3 :: Only",
21+
"Programming Language :: Python :: Implementation :: CPython"
22+
]
23+
24+
dependencies = []
25+
26+
[project.optional-dependencies]
27+
dev = [
28+
"pre-commit",
29+
"black",
30+
"mypy",
31+
"flake8",
32+
"flake8-builtins",
33+
"flake8-pep585",
34+
]
35+
test = [
36+
"pytest",
37+
"pytest-randomly",
38+
"coverage",
39+
"tox"
40+
]
41+
42+
[project.urls]
43+
homepage = "https://github.com/[ORG NAME]/[REPO NAME]"
44+
# documentation = ""
45+
# repository = ""
46+
# changelog = ""
47+
48+
# CLI scripts if needed
49+
# [project.scripts]
50+
# python-src-example = "module_name.sample:main"
51+
52+
[tool.setuptools.package-data]
53+
"module_name" = ["py.typed"]
54+
55+
[tool.mypy]
56+
check_untyped_defs = true
57+
disallow_any_generics = true
58+
disallow_incomplete_defs = true
59+
disallow_untyped_defs = true
60+
no_implicit_optional = true
61+
warn_redundant_casts = true
62+
warn_unused_ignores = true
63+
64+
[[tool.mypy.overrides]]
65+
module = "tests.*"
66+
disallow_incomplete_defs = false
67+
disallow_untyped_defs = false
68+
warn_unused_ignores = false
69+
70+
[tool.coverage.run]
71+
branch = true
72+
source = [
73+
"tests",
74+
]
75+
source_pkgs = [
76+
"module_name",
77+
]
78+
79+
[tool.coverage.paths]
80+
source = [
81+
"src/",
82+
"*/site-packages",
83+
]
84+
test = [
85+
"tests/",
86+
"*/tests",
87+
]
88+
89+
[tool.coverage.report]
90+
exclude_lines =[
91+
"pragma: no cover",
92+
"raise NotImplementedError",
93+
"if __name__ == .__main__.:",
94+
"\\.\\.\\.",
95+
"if TYPE_CHECKING:",
96+
]
97+
98+
# This is ignored by flake8, here in case they decide to add it in the future
99+
[tool.flake8]
100+
ignore = "W503,E203"
101+
max-line-length = 88
102+
103+
[tool.tox]
104+
legacy_tox_ini = """
105+
[tox]
106+
envlist = py37,py38,py39,py310,py311,py312,coverage,mypy
107+
skip_missing_interpreters = true
108+
isolated_build = True
109+
110+
[testenv]
111+
deps =
112+
.[test]
113+
commands =
114+
coverage run -p -m pytest tests/
115+
116+
[testenv:coverage]
117+
depends = py37,py38,py39,py310,py311,py312
118+
parallel_show_output = true
119+
commands =
120+
python -m coverage combine
121+
python -m coverage report -m --fail-under=50
122+
python -m coverage json
123+
124+
[testenv:mypy]
125+
deps =
126+
mypy
127+
commands =
128+
mypy -p module_name --no-incremental
129+
"""

0 commit comments

Comments
 (0)