Skip to content

Commit 4f2f689

Browse files
authored
Python 3.12 upgrade (#14)
* update to 3.12 * fix: branch name in github validate workflow * add tests
1 parent 3787d30 commit 4f2f689

File tree

12 files changed

+923
-117
lines changed

12 files changed

+923
-117
lines changed

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Defines the coding style for different editors and IDEs.
2+
# http://editorconfig.org
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Rules for source code.
8+
[*]
9+
charset = utf-8
10+
end_of_line = lf
11+
insert_final_newline = true
12+
indent_size = 2
13+
indent_style = space
14+
trim_trailing_whitespace = true
15+
16+
# Rules for Python code.
17+
[*.py]
18+
indent_size = 4
19+
20+
# Rules for markdown documents.
21+
[*.md]
22+
indent_size = 4
23+
trim_trailing_whitespace = false
24+
25+
# Rules for makefile
26+
[Makefile]
27+
indent_style = tab
28+
indent_size = 4

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.12"]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip setuptools poetry tox-gh-actions
24+
poetry install
25+
- name: Build wheels and source tarball
26+
run: poetry build
27+
- name: publish to PyPi
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
with:
30+
user: __token__
31+
password: ${{ secrets.PYPI_API_TOKEN }}
32+
skip_existing: true

.github/workflows/validate.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Validate
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
- main
9+
- 'release/**'
10+
pull_request:
11+
branches:
12+
- '*'
13+
workflow_dispatch:
14+
15+
jobs:
16+
validate:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: ["3.12"]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip setuptools poetry
30+
poetry install
31+
- name: Linting
32+
run: |
33+
poetry run isort .
34+
poetry run black .
35+
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/ --statistics --count
36+
- name: Security
37+
run: poetry run bandit -c pyproject.toml -r .
38+
- name: Testing
39+
run: python -m unittest discover

.gitignore

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,58 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
5-
# C extensions
6-
*.so
7-
8-
# Pycharm
9-
.idea/
10-
11-
# Distribution / packaging
12-
.Python
13-
env/
14-
build/
15-
develop-eggs/
16-
dist/
17-
downloads/
18-
eggs/
19-
.eggs/
20-
lib/
21-
lib64/
22-
parts/
23-
sdist/
24-
var/
25-
*.egg-info/
26-
.installed.cfg
27-
*.egg
1+
*.py[co]
2+
*.swp
3+
*.bak
284

29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
5+
# docs
6+
_build
7+
8+
# Packages
9+
*.egg
10+
*.egg-info
11+
dist
12+
build
13+
eggs
14+
parts
15+
bin
16+
var
17+
sdist
18+
develop-eggs
19+
.installed.cfg
3420

3521
# Installer logs
3622
pip-log.txt
37-
pip-delete-this-directory.txt
3823

3924
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
4225
.coverage
43-
.coverage.*
44-
.cache
45-
nosetests.xml
46-
coverage.xml
47-
*,cover
26+
.tox
27+
28+
.idea
4829

49-
# Translations
30+
.DS_Store
31+
32+
#Translations
5033
*.mo
51-
*.pot
5234

53-
# Django stuff:
54-
*.log
35+
#Mr Developer
36+
.mr.developer.cfg
37+
38+
# Configuration
39+
sdelint.cnf
40+
41+
#generated data
42+
usecases/output.csv
43+
44+
# Test files
45+
info.log
46+
htmlcov/
47+
48+
#ides
49+
.idea
50+
.vscode
51+
52+
#custom cert bundle
53+
my_root_certs.crt
5554

56-
# Sphinx documentation
57-
docs/_build/
55+
# symbolic links
56+
.flake8
5857

59-
# PyBuilder
60-
target/
58+
conf/

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
repos:
2+
- repo: https://github.com/Lucas-C/pre-commit-hooks
3+
rev: v1.1.13
4+
hooks:
5+
- id: forbid-crlf
6+
- id: remove-crlf
7+
- id: forbid-tabs
8+
exclude_types: [csv]
9+
- id: remove-tabs
10+
exclude_types: [csv]
11+
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.1.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: check-merge-conflict
18+
- id: check-yaml
19+
args: [--unsafe]
20+
21+
- repo: https://github.com/pre-commit/mirrors-isort
22+
rev: v5.10.1
23+
hooks:
24+
- id: isort
25+
26+
- repo: https://github.com/ambv/black
27+
rev: 22.3.0
28+
hooks:
29+
- id: black
30+
language_version: python3.12
31+
32+
- repo: https://github.com/pycqa/flake8
33+
rev: 3.9.2
34+
hooks:
35+
- id: flake8
36+
additional_dependencies: [flake8-typing-imports==1.10.0]
37+
exclude: ^tests
38+

.travis.yml

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
lint:
2-
find . -name '*.py' | egrep -v './doc' | xargs flake8 --ignore=E501,W601
2+
flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/ --statistics --count

0 commit comments

Comments
 (0)