Skip to content

Commit

Permalink
Start verifying the code with the usage of Python 3.9 and Python 3.10 (
Browse files Browse the repository at this point in the history
…#85)

* Declare the current owners of the code the way GitHub will understand

* Name the GitHub Workflow files more directly (without using verbs)

* Improve naming of the jobs declared in GitHub Workflow files

* Run flake8/mypy/pylint in separate steps to increase their visibility

* Checkout the repository using the 4th version of the actions tool

* Set up the Python interpreter with the usage of the dedicated tool

* Enable caching of the dependencies to avoid downloading them each run

* Avoid installing the make command already available in Ubuntu

* Replace the hardcoded Python version with the strategy matrix

* Always check pull requests using multiple Python versions (>=3.8)

* Remove the names of steps to simplify the GitHub Workflow files

* Disable the ability to run publishing the package to PyPI manually

* Improve checking whether the version was updated before merging

* Synchronize the repository files with their latest available version

* Create a dedicated section for the packaging-related commands

* Update pip-tools to the latest available version

* Prepare the dedicated file with requirements for the deployment job

* Reimplement the process of publishing to use the correct commands

* Update the list of classifiers describing the Lambdalizator library

* Update the list of badges visible in the main documentation

* Upgrade the version of Lambdalizator to publish the provided changes

* Always strip the whitespaces while retrieving the library version
  • Loading branch information
redlickigrzegorz authored Jan 2, 2024
1 parent 9241851 commit 6fb335a
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ indent_size = 1
indent_style = tab
tab_width = 4

[*.{cfg, json, yaml, yml}]
[*.{cfg,json,yaml,yml}]
indent_size = 2

[*.md]
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* pdyba songofroland grzegorzpro
* @pdyba @redlickigrzegorz
67 changes: 0 additions & 67 deletions .github/workflows/pr_checks.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/publish_to_pypi.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check pull request

on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
code_quality:
name: Check code quality

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"] # TODO: Support newer versions

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: make install-dev
- run: make black-check
- run: make isort-check
- run: make flake8
- run: make mypy
- run: make pylint

unit_tests:
name: Run unit tests

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"] # TODO: Support newer versions

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: make install-dev
- run: make test

version_check:
name: Check version

runs-on: ubuntu-latest

if: ${{ github.base_ref == 'master' }}
steps:
- uses: actions/checkout@v4
- name: Check whether the version was updated
run: |
PUBLISHED_VERSION=$(curl --silent https://pypi.org/pypi/lbz/json | jq -r '.info.version')
ACTUAL_VERSION=$(cat version)
if [ "$PUBLISHED_VERSION" == "$ACTUAL_VERSION" ]; then
echo "Update the Lambdalizator version before merging!"
exit 1
fi
25 changes: 25 additions & 0 deletions .github/workflows/pypi_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish to PyPI

on:
push:
branches:
- master

jobs:
pypi:
name: Publish to PyPI

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "pip"
- run: make build-nocache
- run: pip install -r requirements-deploy.txt
- run: python -m twine upload --verbose dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI }}
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Created by https://www.toptal.com/developers/gitignore/api/python,intellij+all,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=python,intellij+all,macos

Expand Down Expand Up @@ -285,6 +284,16 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python,intellij+all,macos

# pyenv
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ Released 2023-09-27
- Adjust the behavior of EventAwareResource and event_emitter to clean up EventAPI on its initialization
- Adjust the behavior of EventAPI to always store all events that were processed during one session

### Version 0.5.19
Released 2024-01-02

- Start verifying the code with the usage of Python 3.9 and Python 3.10
- Adjust the GitHub Workflow files to make the pipelines more descriptive
- Improve the rest of the repository for upcoming changes

### Version 0.6.0
Release ETA 2024-02-31 ;)

Expand Down
34 changes: 20 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ upgrade-all:
pip-compile --upgrade requirements-dev.in


###############################################################################
# Packaging and Distributing
# -----------------------------------------------------------------------------
.PHONY: build
build:
python setup.py sdist bdist_wheel
echo -e "\033[0;32mBuild complete"

.PHONY: clean
clean:
rm -rf ./build ./dist ./*.egg-info
echo "Existing distribution has been removed!"

.PHONY: build-nocache clean-and-build cab
build-nocache clean-and-build cab: clean build


###############################################################################
# Code Quality
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -71,7 +88,7 @@ pylint:
pylint examples lbz tests setup.py

.PHONY: lint
lint: flake8 mypy pylint
lint: flake8 mypy pylint

.PHONY: format-and-lint
format-and-lint: format lint
Expand All @@ -85,21 +102,10 @@ test-unit tu:
coverage run --include "lbz/*" -m pytest "tests"
coverage report -m --skip-covered

.PHONY: test
test: test-unit

.PHONY: test-unit-verbose tuv
test-unit-verbose tuv:
coverage run --include "lbz/*" -m pytest "tests" -vv
coverage report -m --skip-covered

###############################################################################
# Custom Scripts
# -----------------------------------------------------------------------------
.PHONY: build
build:
python setup.py sdist bdist_wheel

.PHONY: upload
upload:
python3 -m twine upload dist/*
.PHONY: test
test: test-unit
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Lambdalizator
![Python 3.8+](https://img.shields.io/badge/python-v3.8-blue) ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)

---
[![Stable version](https://img.shields.io/pypi/v/lbz.svg?color=blue)](https://pypi.org/project/lbz/)
[![Python versions](https://img.shields.io/pypi/pyversions/lbz.svg)](https://pypi.org/project/lbz/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black/)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1.svg)](https://pycqa.github.io/isort/)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org)
[![Downloads](https://pepy.tech/badge/lbz)](https://pepy.tech/project/lbz/)

AWS Lambda Toolbox inspired by Flask. Currently supporting:
- REST API
Expand Down
1 change: 1 addition & 0 deletions requirements-deploy.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
twine
62 changes: 62 additions & 0 deletions requirements-deploy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements-deploy.in
#
certifi==2023.11.17
# via requests
charset-normalizer==3.3.2
# via requests
docutils==0.20.1
# via readme-renderer
idna==3.6
# via requests
importlib-metadata==7.0.1
# via
# keyring
# twine
importlib-resources==6.1.1
# via keyring
jaraco-classes==3.3.0
# via keyring
keyring==24.3.0
# via twine
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.1.0
# via jaraco-classes
nh3==0.2.15
# via readme-renderer
pkginfo==1.9.6
# via twine
pygments==2.17.2
# via
# readme-renderer
# rich
readme-renderer==42.0
# via twine
requests==2.31.0
# via
# requests-toolbelt
# twine
requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
rich==13.7.0
# via twine
twine==4.0.2
# via -r requirements-deploy.in
typing-extensions==4.9.0
# via rich
urllib3==2.1.0
# via
# requests
# twine
zipp==3.17.0
# via
# importlib-metadata
# importlib-resources
8 changes: 5 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements-dev.in
#
Expand Down Expand Up @@ -70,7 +70,7 @@ pathspec==0.9.0
# via black
pep517==0.13.0
# via build
pip-tools==6.8.0
pip-tools==7.3.0
# via -r requirements-dev.in
platformdirs==2.5.2
# via
Expand Down Expand Up @@ -103,6 +103,8 @@ tomli==2.0.1
# build
# coverage
# mypy
# pep517
# pip-tools
# pylint
# pytest
tomlkit==0.11.1
Expand Down
Loading

0 comments on commit 6fb335a

Please sign in to comment.