Skip to content

Commit

Permalink
Upgrade to Python 3.10 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-rarus authored Jan 10, 2023
1 parent 13cd9d4 commit a6379b6
Show file tree
Hide file tree
Showing 8 changed files with 1,684 additions and 1,491 deletions.
21 changes: 8 additions & 13 deletions .github/hooks/.pre-commit-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fail_fast: true
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: check-ast
- id: check-case-conflict
Expand All @@ -28,40 +28,35 @@ repos:
- id: absolufy-imports
files: ^src/

- repo: https://github.com/jendrikseipp/vulture
rev: v2.4
hooks:
- id: vulture

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.2
hooks:
- id: codespell
types_or: [python, rst, markdown]
args: [--ignore-words=.codespell]

- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
rev: 5.11.4
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [--py310-plus]

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.4.0
hooks:
- id: yesqa

- repo: https://github.com/psf/black
rev: 22.8.0
rev: 22.12.0
hooks:
- id: black
language_version: python3.8
language_version: python3.10

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
cache: 'poetry'

- name: Cache pre-commit
Expand All @@ -39,7 +39,11 @@ jobs:
- name: Mypy
run: |
poetry run mypy --install-types --incremental --show-error-codes --pretty src
poetry run mypy --incremental --show-error-codes --pretty src
- name: Vulture
run: |
poetry run vulture src
- name: Tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
cache: 'poetry'

# Initializes the CodeQL tools for scanning.
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,10 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# Visual Studio Code
.vscode

# Test artifacts
junit/
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Installation
setup_venv:
install_venv:
poetry install --no-root

install_pre_commit:
poetry run pre-commit install -c .github/hooks/.pre-commit-config.yml

install_dev: setup_venv install_pre_commit
install_dev: install_venv install_pre_commit

# Dev tools
isort:
Expand All @@ -23,6 +23,9 @@ format: isort black
mypy:
poetry run mypy --incremental --install-types --show-error-codes --pretty src

vulture:
poetry run vulture src

pre_commit:
poetry run pre-commit run -a -c .github/hooks/.pre-commit-config.yml

Expand All @@ -38,7 +41,7 @@ test_cov:
compile_env:
poetry lock --no-update

build: isort black pre_commit flake8 mypy test
build: isort black pre_commit flake8 mypy vulture test

# Misc
jupyter:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ When developing a project there's a need to automate some tedious stuff that hel
- [flake8](https://github.com/PyCQA/flake8)
- [isort](https://github.com/PyCQA/isort)
- [mypy](https://github.com/python/mypy)
- [(vulture)](https://github.com/jendrikseipp/vulture)
- [poetry](https://github.com/python-poetry/poetry)

## [Makefile](Makefile)
Expand All @@ -41,7 +42,7 @@ To start your work, you need to set up your local environment and hooks.
make install_dev
```

You gonna put your CLI here later. It already contains calls to build tools and checks. Use `build` to run them all (`isort`, `black`, `pre_commit`, `flake8`, `mypy`, `test`).
You gonna put your CLI here later. It already contains calls to build tools and checks. Use `build` to run them all (`isort`, `black`, `pre_commit`, `flake8`, `mypy`, `vulture`, `test`).

```sh
make build
Expand All @@ -68,7 +69,6 @@ This hook is here to prevent you from committing any nasty code to your reposito
- miscellaneous syntax checks and fixers
- no commit to main branch (these should be only merged with PRs)
- refactor relative imports [(absolufy-imports)](https://github.com/MarcoGorelli/absolufy-imports)
- detect dead code [(vulture)](https://github.com/jendrikseipp/vulture)
- spell checks [(codespell)](https://github.com/codespell-project/codespell)
- sort imports [isort](https://github.com/timothycrosley/isort)
- upgrade old syntax to newer Python version [(pyupgrade)](https://github.com/asottile/pyupgrade)
Expand Down
Loading

0 comments on commit a6379b6

Please sign in to comment.