Skip to content

Commit

Permalink
Merge pull request #122 from Skyscanner/update_actions
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
ignaciobolonio authored Jan 2, 2024
2 parents c31b96c + e11fc2e commit 3035231
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
2 changes: 1 addition & 1 deletion .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
run: python setup.py sdist bdist_wheel

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
37 changes: 26 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ SOURCES = $(shell find . -name "*.py")
install:
pip install -r requirements.txt

install-dev: install
pip install -e ".[dev]"
install-dev:
pip install -r requirements.txt -r requirements-dev.txt .

install-docs:
pip install -e ".[dev,docs]"
pip install -r requirements.txt -r requirements-docs.txt .

format: isort-format black-format

Expand All @@ -17,16 +17,16 @@ isort-format:
black-format:
black .

lint: isort-lint black-lint flake8-lint
lint: isort-lint black-lint ruff-lint

isort-lint:
isort --check-only .

black-lint:
black --check .

flake8-lint:
flake8 .
ruff-lint:
ruff check .

unit:
pytest -svvv tests
Expand All @@ -42,10 +42,25 @@ test: lint unit
test-docs:
mkdocs build --strict

freeze:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile --no-emit-index-url --no-annotate --output-file requirements.txt setup.py
FREEZE_OPTIONS = --no-emit-index-url --no-annotate -v --resolver=backtracking
freeze-base:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) setup.py --output-file requirements.txt
freeze-dev:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) setup.py --extra dev --output-file requirements-dev.txt
freeze-docs:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) setup.py --extra docs --output-file requirements-docs.txt

freeze-upgrade:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile --no-emit-index-url --upgrade --no-annotate --output-file requirements.txt setup.py
freeze: freeze-base freeze-dev freeze-docs

.PHONY: install install-dev install-docs format isort-format black-format lint isort-lint black-lint flake8-lint unit coverage test freeze freeze-upgrade
freeze-base-upgrade:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) --upgrade setup.py --output-file requirements.txt
freeze-dev-upgrade:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) --upgrade setup.py --extra dev --output-file requirements-dev.txt
freeze-docs-upgrade:
CUSTOM_COMPILE_COMMAND="make freeze" pip-compile $(FREEZE_OPTIONS) --upgrade setup.py --extra docs --output-file requirements-docs.txt

freeze-upgrade: freeze-base-upgrade freeze-dev-upgrade freeze-docs-upgrade

.PHONY: install install-dev install-docs format isort-format black-format lint isort-lint black-lint flake8-lint unit \
coverage test freeze freeze-upgrade freeze-base freeze-dev freeze-docs freeze-base-upgrade freeze-dev-upgrade \
freeze-docs-upgrade
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,66 @@ include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 120

[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 120
indent-width = 4

# Assume Python 3.7
target-version = "py37"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
42 changes: 42 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# make freeze
#
anyio==3.7.1
black==23.3.0
build==0.10.0
certifi==2023.11.17
click==8.1.7
coverage[toml]==7.2.7
exceptiongroup==1.2.0
h11==0.14.0
httpcore==0.17.3
httpx==0.24.1
idna==3.6
importlib-metadata==4.2.0
iniconfig==2.0.0
isort==5.11.5
mypy-extensions==1.0.0
packaging==23.2
pathspec==0.11.2
pip-tools==6.14.0
platformdirs==4.0.0
pluggy==1.2.0
pydantic==1.9.0
pyproject-hooks==1.0.0
pytest==7.4.3
pytest-cov==4.1.0
pytest-repeat==0.9.3
ruff==0.1.9
sniffio==1.3.0
tomli==2.0.1
typed-ast==1.5.5
typing-extensions==4.7.1
wheel==0.42.0
zipp==3.15.0

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
33 changes: 33 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# make freeze
#
automacdoc==0.3
beautifulsoup4==4.12.2
click==8.1.7
ghp-import==2.1.0
importlib-metadata==6.7.0
jinja2==3.1.2
livereload==2.6.3
markdown==3.4.4
markupsafe==2.1.3
mergedeep==1.3.4
mkdocs==1.3.0
mkdocs-material==4.6.3
mkdocstrings==0.10.0
packaging==23.2
pydantic==1.9.0
pygments==2.17.2
pymdown-extensions==10.2.1
python-dateutil==2.8.2
pytkdocs==0.2.1
pyyaml==6.0.1
pyyaml-env-tag==0.1
six==1.16.0
soupsieve==2.4.1
tornado==6.2
typing-extensions==4.7.1
watchdog==3.0.0
zipp==3.15.0
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# make freeze
#
pydantic==1.9.0
typing-extensions==4.1.1
typing-extensions==4.7.1
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

dev_requires = [
"black>=22.1.0",
"flake8>=3.8.3",
"httpx>=0.14.2",
"isort>=5.4.2",
"pip-tools>=2.0.2",
"pytest>=6.0.1",
"pytest-cov>=2.10.1",
"pytest-repeat==0.9.3",
"ruff",
]

docs_requires = [
Expand All @@ -28,7 +28,7 @@

setup(
name="pycfmodel",
version="0.21.1",
version="0.21.2",
description="A python model for CloudFormation scripts",
author="Skyscanner Product Security",
author_email="[email protected]",
Expand All @@ -39,5 +39,8 @@
python_requires=">=3.7",
install_requires=install_requires,
tests_require=dev_requires,
extras_require={"dev": dev_requires, "docs": docs_requires},
extras_require={
"dev": dev_requires,
"docs": docs_requires,
},
)

0 comments on commit 3035231

Please sign in to comment.