Skip to content

Commit

Permalink
Merge branch 'release/6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed May 2, 2023
2 parents 40b48da + 2cc76fa commit 588f033
Show file tree
Hide file tree
Showing 49 changed files with 1,623 additions and 625 deletions.
24 changes: 24 additions & 0 deletions .github/actions/project-environment-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Project Environment Setup
description: Setup project environment
runs:
using: "composite"
steps:
# The actions/cache step below uses this id to get the exact python version
- id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11.2"
architecture: x64
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
cache: "pipenv"
# https://github.com/actions/cache/blob/main/examples.md#python---pipenv
- uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
- name: Install Dependencies with pipenv
if: steps.cache-pipenv.outputs.cache-hit != 'true'
shell: bash
run: |
pip install pipenv
pipenv install --quiet --deploy --dev
48 changes: 21 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,22 @@ on:
- '**.tweet'

jobs:
compilation:
static-code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# The actions/cache step below uses this id to get the exact python version
- id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11.2"
architecture: x64
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
cache: "pipenv"
# https://github.com/actions/cache/blob/main/examples.md#python---pipenv
- uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
- name: Install Dependencies with pipenv
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pip install pipenv
pipenv install --quiet --deploy --dev
- uses: ./.github/actions/project-environment-setup
- run: pipenv run isort --recursive --diff .
- run: pipenv run black --check .
- run: pipenv run flake8
- run: pipenv run mypy
- name: Python Tests with pytest
run: pipenv run pytest --cov --cov-fail-under=85 --capture=no --log-cli-level=INFO -n auto
- name: Build Docker Image
run: |
docker build . -t python_boilerplate:smoke-test-tag
docker inspect python_boilerplate:smoke-test-tag
- name: Smoke Test Docker Image
run: |
docker run --rm python_boilerplate:smoke-test-tag param_3_from_command_line
run: LOG_LEVEL=INFO pipenv run pytest --cov --cov-fail-under=90 --capture=no --log-cli-level=INFO -n auto
pyinstaller-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/project-environment-setup
- name: Build Application Executable Package with PyInstaller
run: |
pipenv run pyinstaller --windowed --noconsole \
Expand All @@ -59,3 +40,16 @@ jobs:
du -s -h *
- name: Smoke Test PyInstaller Application
run: ./dist/multithread_and_thread_pool_usage/multithread_and_thread_pool_usage
docker-image-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker Image
run: |
docker build . -t python_boilerplate:smoke-test-tag
docker inspect python_boilerplate:smoke-test-tag
echo "Image size: `docker inspect -f "{{ .Size }}" python_boilerplate:smoke-test-tag | numfmt --to=si`"
docker image ls python_boilerplate:smoke-test-tag
- name: Smoke Test Docker Image
run: |
docker run --rm python_boilerplate:smoke-test-tag param_3_from_command_line
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
### Project ###
*.db
*.gz
logs/
data/
build/
# pytest-monitor SQLite database
.pymon

### PyCharm ###
.idea
Expand Down
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# See https://pre-commit.com/ for usage and config
fail_fast: true
repos:
# https://github.com/pre-commit/pre-commit-hooks/releases/tag/v4.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ --fix, auto ]
- id: check-json
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: name-tests-test
args: [ --pytest-test-first ]
- id: detect-private-key
- id: check-case-conflict
- repo: local
hooks:
- id: isort
Expand Down Expand Up @@ -56,6 +60,6 @@ repos:
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: env LOG_LEVEL=ERROR pipenv run pytest --cov --cov-fail-under=85 --capture=no --log-cli-level=ERROR -n auto
entry: env LOG_LEVEL=ERROR pipenv run pytest --cov --cov-fail-under=90 --capture=no --log-cli-level=ERROR -n auto
types: [ python ]
pass_filenames: false
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# [6.0.0](https://github.com/johnnymillergh/muscle-and-fitness-server/compare/5.0.0...6.0.0) (2023-05-02)


### Features

* **$arrow:** add demo for `arrow` ([e8e2d9c](https://github.com/johnnymillergh/python_boilerplate/commit/e8e2d9c9f50b2155f657bcb5af27993bef802af0))
* **$PGP:** support PGP encryption ([88e6e17](https://github.com/johnnymillergh/python_boilerplate/commit/88e6e1717bfcb4a8ea84b2b08829ae28cc4d8e15))
* **$profiling:** support `[@cpu](https://github.com/cpu)_profile` & `[@mem](https://github.com/mem)_profile` decorators ([a2f8e7c](https://github.com/johnnymillergh/python_boilerplate/commit/a2f8e7cea450be8eb0a38a621dbe6f5e36903b48))
* **$Pydantic:** integrate Pydantic and enhance mypy type checking ([2cf347e](https://github.com/johnnymillergh/python_boilerplate/commit/2cf347e3ef7f3c2ab4856b0942e087ff2c0f4c3a))


### Performance Improvements

* **$GitHub:** run action jobs in parallel ([fcbd061](https://github.com/johnnymillergh/python_boilerplate/commit/fcbd0619b38a705b18a348180dd30246a2c0105e))
* **$pytest-monitor:** integrate pytest-monitor for CPU & memory profiling ([31c77a7](https://github.com/johnnymillergh/python_boilerplate/commit/31c77a71ad14a3c8c8264bea28aaf6aafeb56ce3))


### Reverts

* **$Docker:** `apt-get update && apt-get install -y --no-install-recommends gcc` ([9957e23](https://github.com/johnnymillergh/python_boilerplate/commit/9957e23677b7180e877df12fb439e4d909d96943))



# [5.0.0](https://github.com/johnnymillergh/muscle-and-fitness-server/compare/4.0.1...5.0.0) (2023-03-04)


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps

# Install pipenv and compilation dependencies
RUN pip install pipenv==2022.10.25
RUN pip install pipenv
RUN apt-get update && apt-get install -y --no-install-recommends gcc

# Install python dependencies in /.venv
Expand Down
33 changes: 20 additions & 13 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,47 @@ python_version = "3.11"

[packages]
# Foundamental dependencies
pydantic = "==1.10.7"
# Loguru is a library which aims to bring enjoyable logging in Python. https://pypi.org/project/loguru/
loguru = "==0.6.0"
loguru = "==0.7.0"
# pyhocon is a HOCON parser for Python. Additionally we provide a tool (pyhocon) to convert any HOCON content into json,
# yaml and properties format. https://pypi.org/project/pyhocon/
pyhocon = "==0.3.60"
# Data manipulation dependencies
# NumPy is a Python library used for working with arrays. https://pypi.org/project/numpy/
numpy = "==1.24.2"
numpy = "==1.24.3"
# pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working
# with "relational" or "labeled" data both easy and intuitive. https://pypi.org/project/pandas/
pandas = "==1.5.3"
pandas = "==2.0.0"
# Python enhancement dependencies
# Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating,
# formatting and converting dates, times and timestamps. https://pypi.org/project/arrow/
arrow = "==1.2.3"
# ORM dependencies
# Peewee is a simple and small ORM. https://pypi.org/project/peewee/
peewee = "==3.16.0"
peewee = "==3.16.2"
# Template engine dependencies
# Jinja is a fast, expressive, extensible templating engine. https://pypi.org/project/Jinja2/
jinja2 = "==3.1.2"
# Tool dependencies
# Faker is a Python package that generates fake data for you. https://pypi.org/project/Faker/
faker = "==17.6.0"
faker = "==18.6.0"
# A Python module to parse, validate and reformat standard numbers and codes in different formats.
# It contains a large collection of number formats. https://pypi.org/project/python-stdnum/
python-stdnum = "==1.18"
# Retrying library for Python. https://pypi.org/project/tenacity/
tenacity = "==8.2.2"
# Python plotting package. https://pypi.org/project/matplotlib/
matplotlib = "==3.7.0"
matplotlib = "==3.7.1"
# Pretty Good Privacy for Python. https://github.com/SecurityInnovation/PGPy
pgpy = "==0.6.0"
# Cross-platform lib for process and system monitoring in Python. https://github.com/giampaolo/psutil
psutil = "==5.9.4"

[dev-packages]
# Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of
# hand-formatting. https://pypi.org/project/black/
black = "==23.1.0"
black = "==23.3.0"
# Naming Convention checker for Python. https://github.com/PyCQA/pep8-naming
pep8-naming = "==0.13.3"
# Linting & toolkit for checking your code base against coding style (PEP8). https://pypi.org/project/flake8/
Expand All @@ -53,25 +58,27 @@ flake8 = "==6.0.0"
flake8-quotes = "==3.3.2"
flake8-print = "==5.0.0"
flake8-use-fstring = "==1.4"
flake8-comprehensions = "==3.10.1"
flake8-comprehensions = "==3.12.0"
# isort your imports, so you don't have to. https://pypi.org/project/isort/
isort = "==5.12.0"
# Add type annotations to your Python programs, and use mypy to type check them. https://pypi.org/project/mypy/
mypy = "==1.0.1"
mypy = "==1.2.0"
# A framework for managing and maintaining multi-language pre-commit hooks. https://pypi.org/project/pre-commit/
pre-commit = "==3.1.1"
pre-commit = "==3.3.0"
# The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
# for applications and libraries. https://pypi.org/project/pytest/
pytest = "==7.2.2"
pytest = "==7.3.1"
# Thin-wrapper around the mock package for easier use with pytest. https://pypi.org/project/pytest-mock/
pytest-mock = "==3.10.0"
# This plugin produces coverage reports. https://pypi.org/project/pytest-cov/
pytest-cov = "==4.0.0"
# Plugin for generating HTML reports for pytest results. https://github.com/pytest-dev/pytest-html/
pytest-html = "==3.2.0"
# pytest xdist plugin for distributed testing and loop-on-failing modes. https://github.com/pytest-dev/pytest-xdist/
pytest-xdist = "==3.2.0"
pytest-xdist = "==3.2.1"
# Call stack profiler for Python. Shows you why your code is slow! https://github.com/joerick/pyinstrument
pyinstrument = "==4.4.0"
# Pytest plugin for analyzing resource usage during test sessions. https://github.com/CFMTech/pytest-monitor
pytest-monitor = "==1.6.5"
# PyInstaller bundles a Python application and all its dependencies into a single package. https://github.com/pyinstaller/pyinstaller
pyinstaller = "==5.8.0"
pyinstaller = "==5.10.1"
Loading

0 comments on commit 588f033

Please sign in to comment.