Skip to content

Commit 3be2eab

Browse files
authored
Refactor: use pyproject.toml for project metadata, requirements, build settings (#50)
2 parents 3650645 + 8013c56 commit 3be2eab

File tree

11 files changed

+71
-73
lines changed

11 files changed

+71
-73
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10
1+
FROM python:3.11
22

33
ENV PYTHONDONTWRITEBYTECODE=1 \
44
PYTHONUNBUFFERED=1 \
@@ -11,16 +11,11 @@ RUN useradd --create-home --shell /bin/bash $USER && \
1111
# switch to non-root $USER
1212
USER $USER
1313

14+
# enter src directory
15+
WORKDIR /home/$USER/src
16+
1417
# update PATH for local pip installs
1518
ENV PATH "$PATH:/home/$USER/.local/bin"
1619

1720
# update pip
1821
RUN python -m pip install --upgrade pip
19-
20-
# enter src directory
21-
WORKDIR /home/$USER/src
22-
23-
# copy and install packages
24-
COPY . .
25-
RUN pip install -r .devcontainer/requirements.txt
26-
RUN pip install -r tests/requirements.txt

.devcontainer/compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
name: compilerla/conventional-pre-commit
2-
31
services:
42
dev:
53
build:

.devcontainer/devcontainer.json

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@
44
"service": "dev",
55
"runServices": ["dev"],
66
"workspaceFolder": "/home/compiler/src",
7-
"postAttachCommand": "pip install -e .",
8-
// Set *default* container specific settings.json values on container create.
9-
"settings": {
10-
"terminal.integrated.defaultProfile.linux": "bash",
11-
"terminal.integrated.profiles.linux": {
12-
"bash": {
13-
"path": "/bin/bash"
14-
}
7+
"postCreateCommand": "pip install -e .[dev]",
8+
"customizations": {
9+
"vscode": {
10+
// Set *default* container specific settings.json values on container create.
11+
"settings": {
12+
"terminal.integrated.defaultProfile.linux": "bash",
13+
"terminal.integrated.profiles.linux": {
14+
"bash": {
15+
"path": "/bin/bash"
16+
}
17+
}
18+
},
19+
// Add the IDs of extensions you want installed when the container is created.
20+
"extensions": [
21+
"bungcip.better-toml",
22+
"eamodio.gitlens",
23+
"esbenp.prettier-vscode",
24+
"mhutchie.git-graph",
25+
"ms-python.python",
26+
"ms-python.vscode-pylance"
27+
]
1528
}
16-
},
17-
// Add the IDs of extensions you want installed when the container is created.
18-
"extensions": [
19-
"eamodio.gitlens",
20-
"esbenp.prettier-vscode",
21-
"mhutchie.git-graph",
22-
"ms-python.python",
23-
"ms-python.vscode-pylance"
24-
]
29+
}
2530
}

.devcontainer/requirements.txt

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

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.egg-info

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: ["3.7", "3.8", "3.9", "3.10"]
13+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1414

1515
steps:
1616
- uses: actions/checkout@v3
@@ -23,8 +23,7 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install -r tests/requirements.txt
27-
pip install -e .
26+
pip install -e .[dev]
2827
2928
- name: Run tests
3029
run: ./tests/run.sh

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"editor.formatOnSave": true,
3-
"editor.defaultFormatter": "esbenp.prettier-vscode",
43
"files.encoding": "utf8",
54
"files.eol": "\n",
65
"files.insertFinalNewline": true,

pyproject.toml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
1-
[build-system]
2-
requires = [
3-
"setuptools>=63",
4-
"wheel"
1+
[project]
2+
name = "conventional_pre_commit"
3+
version = "2.1.1"
4+
description = "A pre-commit hook that checks commit messages for Conventional Commits formatting."
5+
readme = "README.md"
6+
license = { file = "LICENSE" }
7+
classifiers = ["Programming Language :: Python :: 3 :: Only"]
8+
keywords = ["git", "pre-commit", "conventional-commits"]
9+
authors = [
10+
{ name = "Compiler LLC", email = "[email protected]" }
511
]
12+
requires-python = ">=3.7"
13+
dependencies = []
14+
15+
[project.urls]
16+
code = "https://github.com/compilerla/conventional-pre-commit"
17+
tracker = "https://github.com/compilerla/conventional-pre-commit/issues"
18+
19+
[project.optional-dependencies]
20+
dev = [
21+
"black",
22+
"build",
23+
"flake8",
24+
"pre-commit",
25+
"pytest",
26+
"pytest-cov"
27+
]
28+
29+
[project.scripts]
30+
conventional-pre-commit = "conventional_pre_commit.hook:main"
31+
32+
[build-system]
33+
requires = ["setuptools>=64", "wheel"]
634
build-backend = "setuptools.build_meta"
735

836
[tool.black]
937
line-length = 127
10-
target-version = ['py310']
38+
target-version = ['py311']
1139
include = '\.pyi?$'
40+
41+
[tool.pytest.ini_options]
42+
testpaths = ["tests"]
43+
norecursedirs = [
44+
"*.egg-info",
45+
".git",
46+
".pytest_cache",
47+
".vscode",
48+
]

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)