Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Update Python dev version to 3.11.1 #140

Merged
merged 1 commit into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trim_trailing_whitespace = true
[{.babelrc,.compressrc,.eslintrc,.linguirc}]
indent_size = 2

[*.{css,cfg,html,html.j2,ini,js,json,md,service,service.j2,toml,yaml,yml,xml}]
[*.{css,cfg,html,ini,j2,js,json,md,service,toml,yaml,yml,xml}]
indent_size = 2

[*.{nginx,nginx.j2,py,rst,sh}]
Expand Down
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[flake8]
ban-relative-imports = true
extend-ignore = E501, PIE786
extend-select = TC, TC1
inline-quotes = double
max-complexity = 15
multiline-quotes = double
type-checking-strict = true
2 changes: 1 addition & 1 deletion .github/actions/install_badabump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs:
steps:
- id: "python"
name: "Install Python"
uses: "actions/setup-python@v4.3.0"
uses: "actions/setup-python@v4.3.1"
with:
python-version-file: ".python-version"

Expand Down
12 changes: 9 additions & 3 deletions .github/actions/install_python_and_poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,40 @@ inputs:
description: "Cache key suffix to append to venv cache key"
required: false
default: ""

python-version:
description: "Python version to use"
required: false

python-version-file:
description: "Read Python version from given file"
required: false

poetry-version:
description: "Poetry version to use"
required: false
default: "1.2.2"
default: "1.3.0"

outputs:
python-path:
description: "Absolute path to Python executable"
value: "${{ steps.python.outputs.python-path }}"

python-version:
description: "Installed Python version"
value: "${{ steps.python.outputs.python-version }}"

poetry-version:
description: "Installed poetry version"
value: "${{ inputs.poetry-version }}"

runs:
using: "composite"

steps:
- id: "python"
name: "Install Python"
uses: "actions/setup-python@v4.3.0"
uses: "actions/setup-python@v4.3.1"
with:
python-version: "${{ inputs.python-version }}"
python-version-file: "${{ inputs.python-version-file }}"
Expand All @@ -43,7 +49,7 @@ runs:
run: "pipx install --python='${{ steps.python.outputs.python-path }}' poetry==${{ inputs.poetry-version }}"

- name: "Cache venv"
uses: "actions/cache@v3.0.10"
uses: "actions/cache@v3.0.11"
with:
path: "./.venv/"
key: "venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}${{ inputs.cache-key-suffix }}"
2 changes: 1 addition & 1 deletion .github/actions/run_pre_commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
shell: "bash"

- name: "Cache mypy"
uses: "actions/cache@v3.0.10"
uses: "actions/cache@v3.0.11"
with:
path: "./.mypy_cache/"
key: "mypy-${{ runner.os }}-${{ inputs.python-version }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/run_tox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runs:
shell: "bash"

- name: "Cache tox"
uses: "actions/cache@v3.0.10"
uses: "actions/cache@v3.0.11"
with:
path: "./.tox/"
key: "tox-${{ inputs.python-version }}"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ on:
description: "Twine version to use."
type: "string"
required: false
default: "4.0.1"
default: "4.0.2"

secrets:
pypi-user:
description: "PyPI username to use."
required: true

pypi-password:
description: "PyPI password (token) to use."
required: true
Expand Down Expand Up @@ -42,7 +43,7 @@ jobs:

- name: "Publish package"
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
uses: "pypa/gh-action-pypi-publish@v1.5.1"
uses: "pypa/gh-action-pypi-publish@v1.6.4"
with:
user: "${{ secrets.pypi-user }}"
password: "${{ secrets.pypi-password }}"
4 changes: 2 additions & 2 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:
run: "badabump --ci ${{ github.event.inputs.args }}"

- id: "token"
uses: "tibdex/github-app-token@v1.7"
uses: "tibdex/github-app-token@v1.7.0"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- name: "Create pull request with changed files"
uses: "peter-evans/create-pull-request@v4.2.0"
uses: "peter-evans/create-pull-request@v4.2.3"
with:
token: "${{ steps.token.outputs.token }}"
commit-message: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- id: "token"
uses: "tibdex/github-app-token@v1.7"
uses: "tibdex/github-app-token@v1.7.0"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ dmypy.json

# AWS CDK files
/cdk.out
/cdk.context.json

# DotENV files
.env.*
Expand All @@ -153,3 +152,9 @@ dmypy.json

# Sublime Text 3 workspace
*.sublime-workspace

# Auto-generated .gz static files
static/**/*.gz

# Do not ignore dist files in vendored static files
!static/vendor/**/dist/
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude: ^(archive|assets|migrations)/.*|.*/(migrations|test-data|vendor)/.*|.*\
minimum_pre_commit_version: "1.17.0"
repos:
- repo: "https://github.com/commitizen-tools/commitizen"
rev: "v2.35.0"
rev: "v2.37.1"
hooks:
- id: "commitizen"
# By default commitizen using `python3` instead `python` language, so
Expand All @@ -29,7 +29,7 @@ repos:
exclude: ^docs/.*$

- repo: "https://github.com/psf/black"
rev: "22.10.0"
rev: "22.12.0"
hooks:
- id: "black"
# By default black using `python3` instead `python` language, so
Expand All @@ -48,7 +48,7 @@ repos:
- "black==22.10.0"

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.3.0"
rev: "v4.4.0"
hooks:
- id: "end-of-file-fixer"
- id: "trailing-whitespace"
Expand All @@ -71,19 +71,19 @@ repos:
- id: "flake8"
name: "Lint code (flake8)"
additional_dependencies: &flake8_additional_dependencies
- "flake8==5.0.4"
- "flake8-broken-line==0.6.0"
- "flake8-bugbear==22.9.23"
- "flake8-builtins==2.0.0"
- "flake8-comprehensions==3.10.0"
- "flake8-bugbear==22.12.6"
- "flake8-builtins==2.0.1"
- "flake8-comprehensions==3.10.1"
- "flake8-eradicate==1.4.0"
- "flake8-isort==5.0.0"
- "flake8-isort==5.0.3"
- "flake8-mutable==1.2.0"
- "flake8-pie==0.16.0"
- "flake8-quotes==3.3.1"
- "flake8-string-format==0.3.0"
- "flake8-tidy-imports==4.8.0"
- "flake8-variables-names==0.0.5"
- "flake8==5.0.4"
- "pep8-naming==0.13.2"
exclude: ^docs/.*$

Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.0
3.11.1
42 changes: 23 additions & 19 deletions python.mk
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
.PHONY: \
build-python \
build-python-only \
clean-egg-info \
clean-python \
distclean-python \
ensure-venv \
install-python \
install-python-only \
lint-python \
lint-python-only \
list-outdated-python \
poetry \
python-version \
test-python \
test-python-only \
test-python-setup \
test-python-teardown

GIT_DIR = .git

PYTHON_VERISON = $(shell cat .python-version)
Expand All @@ -32,19 +13,26 @@ PYENV ?= $(shell if [ -z "${CI}" ]; then echo "pyenv"; fi)
PYTHON ?= $(DOTENV) $(PYTHON_BIN)
PYTHON_DIST_DIR ?= dist

.PHONY: build-python
build-python: install-python build-python-only

.PHONY: build-python-only
build-python-only:
$(POETRY) build -vv -f wheel

.PHONY: clean-egg-info
clean-egg-info:
find . \( -name *.egg-info -a -type d -not -path '$(VENV_DIR)/*' \) -exec rm -rf {} + 2> /dev/null

.PHONY: clean-python
clean-python:
find . \( -name __pycache__ -o -type d -empty -not -path '$(GIT_DIR)/*' \) -exec rm -rf {} + 2> /dev/null

.PHONY: distclean-python
distclean-python: clean-egg-info
-rm -rf .coverage .install-python $(VENV_DIR)/ $(PYTHON_DIST_DIR)/

.PHONY: ensure-venv
ensure-venv: .python-version
if [ -f "$(PYTHON_BIN)" ]; then \
if [ "$$("$(PYTHON_BIN)" -V)" != "Python $(PYTHON_VERISON)" ]; then \
Expand All @@ -56,20 +44,30 @@ ensure-venv: .python-version
$(POETRY) env use $$($(PYENV) which python3); \
fi

.PHONY: install-python
install-python: .install-python
.install-python: poetry.toml $(PYTHON_BIN) poetry.lock
touch $@

.PHONY: install-python-only
install-python-only:
if [ "$(STAGE)" = "prod" ]; then $(POETRY) install $(POETRY_INSTALL_ARGS) --no-dev; else $(POETRY) install $(POETRY_INSTALL_ARGS); fi

.PHONY: lint-and-test-python
lint-and-test-python: lint-python test-python

.PHONY: lint-python
lint-python: install-python lint-python-only

.PHONY: lint-python-only
lint-python-only:
SKIP=$(SKIP) $(PRE_COMMIT) run --all $(HOOK)

.PHONY: list-outdated-python
list-outdated-python: install-python
$(POETRY) show -o

.PHONY: poetry
poetry:
$(POETRY) $(ARGS)

Expand All @@ -80,21 +78,27 @@ poetry.lock: pyproject.toml
poetry.toml:
$(POETRY) config --local virtualenvs.create true
$(POETRY) config --local virtualenvs.in-project true
$(POETRY) config --local virtualenvs.prefer-active-python true

.PHONY: python-version
python-version:
@echo "Expected: Python $(PYTHON_VERISON)"
@if [ -f "$(PYTHON_BIN)" ]; then echo "Virtual env: $$("$(PYTHON_BIN)" -V)"; else echo "Virtual env: -"; fi

.PHONY: test-python
test-python: install-python clean-python test-python-only

.PHONY: test-python-only
test-python-only: STAGE = test
test-python-only: test-python-setup
STAGE=$(STAGE) $(PYTHON) -m pytest $(TEST_ARGS)
@$(MAKE) -s test-python-teardown

.PHONY: test-python-setup
test-python-setup: STAGE = test
test-python-setup:

.PHONY: test-python-teardown
test-python-teardown: STAGE = test
test-python-teardown:

Expand Down