Skip to content

Commit 15fa93c

Browse files
update build pipeline
1 parent 622c0a8 commit 15fa93c

File tree

7 files changed

+134
-55
lines changed

7 files changed

+134
-55
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,51 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
1315
- name: Update version.py
1416
run: |
1517
echo "__version__ = '${GITHUB_REF#refs/tags/v}'" > bacs/version.py
18+
1619
- name: set up Python
17-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v5
1821
with:
1922
python-version: "3.x"
23+
2024
- name: set up Poetry
21-
uses: abatilo/actions-poetry@v2.0.0
22-
with:
23-
poetry-version: "1.3.1"
25+
uses: abatilo/actions-poetry@v2
26+
2427
- name: get version
2528
id: get_version
2629
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
30+
2731
- name: set version
2832
run: poetry version ${{ steps.get_version.outputs.VERSION }}
33+
2934
- name: publish
3035
env:
3136
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
3237
run: poetry publish --build
38+
39+
- name: Create GitHub release entry
40+
uses: softprops/action-gh-release@v1
41+
id: create_release
42+
with:
43+
draft: true
44+
prerelease: false
45+
name: ${{ env.VERSION }}
46+
tag_name: ${{ env.VERSION }}
47+
env:
48+
GITHUB_TOKEN: ${{ github.token }}
49+
50+
- name: Update version in pyproject.toml
51+
run: python .github/workflows/update_pyproject.py $(echo ${GITHUB_REF/refs\/tags\//})
52+
53+
- name: Commit and push changes
54+
run: |
55+
git config --global user.name "github-actions[bot]"
56+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
57+
git add pyproject.toml
58+
git commit -m "Update pyproject.toml"
59+
git push origin HEAD:main

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
default_language_version:
2+
python: python3.11
3+
default_install_hook_types: [pre-commit, pre-push]
4+
default_stages: [commit]
5+
6+
repos:
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.5.2
9+
hooks:
10+
- id: ruff
11+
args: [--fix]
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.6.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: double-quote-string-fixer

.vscode/settings.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22
"autopep8.args": ["--max-line-length=120"],
33
"editor.defaultFormatter": "esbenp.prettier-vscode",
44
"editor.formatOnSave": true,
5-
"isort.args": ["--line-length", "120"],
65
"prettier.printWidth": 120,
7-
"pylint.args": [
8-
"--disable=C0103", // Invalid name (e.g., variable/function/class naming conventions)
9-
"--disable=C0111", // Missing docstring (in function/class/method)
10-
"--disable=C0301", // Line too long (exceeds character limit)
11-
"--disable=R0912", // Too many branches
12-
"--disable=R0913", // Too many arguments
13-
"--disable=R0914", // Too many local variables
14-
"--disable=R0915" // Too many statements
15-
],
16-
"python.testing.pytestEnabled": false,
17-
"python.testing.unittestEnabled": false,
186
"[python]": {
197
"editor.defaultFormatter": "ms-python.autopep8",
208
"editor.codeActionsOnSave": {
21-
"source.organizeImports": "explicit"
9+
"source.fixAll.ruff": "always"
2210
}
2311
}
2412
}

bacs.code-workspace

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"recommendations": [
1010
"esbenp.prettier-vscode",
1111
"ms-python.autopep8",
12-
"ms-python.isort",
1312
"ms-python.mypy-type-checker",
1413
"ms-python.pylint",
1514
"ms-python.python",
16-
"ms-python.vscode-pylance"
15+
"ms-python.vscode-pylance",
16+
"charliermarsh.ruff"
1717
]
1818
}
1919
}

bacs/version.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__version__ = "0.1.0"
1+
import importlib.metadata
2+
3+
__version__: str = importlib.metadata.version('bacs')

poetry.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "bacs"
3-
version = "0.1.0"
3+
version = "0.1.8-dev"
44
description = "Bundle Adjustment For Camera Systems"
55
authors = ["Zauberzeug GmbH <info@zauberzeug.com>"]
66
license = "MIT"
@@ -23,4 +23,49 @@ requires = ["poetry-core>=1.0.0"]
2323
build-backend = "poetry.core.masonry.api"
2424

2525
[tool.mypy]
26-
ignore_missing_imports = true
26+
python_version = "3.11"
27+
install_types = true
28+
29+
[[tool.mypy.overrides]]
30+
module = [
31+
"scipy.*",
32+
]
33+
ignore_missing_imports = true
34+
35+
[tool.pylint]
36+
disable = [
37+
"C0103", # invalid variable name
38+
"C0301", # line too long
39+
"C0114", # missing module docstring
40+
"R0912", # too many branches
41+
"R0913", # too many arguments
42+
"R0914", # too many local variables
43+
"R0915", # too many statements
44+
]
45+
46+
[tool.ruff]
47+
indent-width = 4
48+
line-length = 120
49+
50+
[tool.ruff.lint]
51+
select = [
52+
"I", # isort
53+
"E", # pycodestyle
54+
"W", # pycodestyle
55+
"B", # bugbear
56+
"F", # pyflakes
57+
"UP", # pyupgrade
58+
"RUF", # ruff
59+
"PL", # pylint
60+
]
61+
fixable = [
62+
"I", # isort
63+
]
64+
ignore = [
65+
"E741", # ambiguous variable name
66+
"E501", # line too long
67+
"PLR0912", # too many branches
68+
"PLR0913", # too many arguments
69+
"PLR0915", # too many statements
70+
"PLR2004", # magic value comparison
71+
]

0 commit comments

Comments
 (0)