Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Aug 28, 2022
2 parents 6128932 + bb00bc1 commit 8c9f5be
Show file tree
Hide file tree
Showing 54 changed files with 2,676 additions and 458 deletions.
149 changes: 143 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# http://editorconfig.org/#file-format-details
root = true

[*]
Expand All @@ -7,10 +6,148 @@ end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.md]
trim_trailing_whitespace = false
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true

[Makefile]
indent_style = tab
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p
ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span, pre, textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal

[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1

[{*.py,*.pyw}]
ij_python_align_collections_and_comprehensions = true
ij_python_align_multiline_imports = true
ij_python_align_multiline_parameters = true
ij_python_align_multiline_parameters_in_calls = true
ij_python_blank_line_at_file_end = true
ij_python_blank_lines_after_imports = 1
ij_python_blank_lines_after_local_imports = 0
ij_python_blank_lines_around_class = 1
ij_python_blank_lines_around_method = 1
ij_python_blank_lines_around_top_level_classes_functions = 2
ij_python_blank_lines_before_first_method = 0
ij_python_call_parameters_new_line_after_left_paren = false
ij_python_call_parameters_right_paren_on_new_line = false
ij_python_call_parameters_wrap = normal
ij_python_dict_alignment = 0
ij_python_dict_new_line_after_left_brace = false
ij_python_dict_new_line_before_right_brace = false
ij_python_dict_wrapping = 1
ij_python_from_import_new_line_after_left_parenthesis = false
ij_python_from_import_new_line_before_right_parenthesis = false
ij_python_from_import_parentheses_force_if_multiline = false
ij_python_from_import_trailing_comma_if_multiline = false
ij_python_from_import_wrapping = 1
ij_python_hang_closing_brackets = false
ij_python_keep_blank_lines_in_code = 1
ij_python_keep_blank_lines_in_declarations = 1
ij_python_keep_indents_on_empty_lines = false
ij_python_keep_line_breaks = true
ij_python_method_parameters_new_line_after_left_paren = false
ij_python_method_parameters_right_paren_on_new_line = false
ij_python_method_parameters_wrap = normal
ij_python_new_line_after_colon = false
ij_python_new_line_after_colon_multi_clause = true
ij_python_optimize_imports_always_split_from_imports = false
ij_python_optimize_imports_case_insensitive_order = false
ij_python_optimize_imports_join_from_imports_with_same_source = false
ij_python_optimize_imports_sort_by_type_first = true
ij_python_optimize_imports_sort_imports = true
ij_python_optimize_imports_sort_names_in_from_imports = false
ij_python_space_after_comma = true
ij_python_space_after_number_sign = true
ij_python_space_after_py_colon = true
ij_python_space_before_backslash = true
ij_python_space_before_comma = false
ij_python_space_before_for_semicolon = false
ij_python_space_before_lbracket = false
ij_python_space_before_method_call_parentheses = false
ij_python_space_before_method_parentheses = false
ij_python_space_before_number_sign = true
ij_python_space_before_py_colon = false
ij_python_space_within_empty_method_call_parentheses = false
ij_python_space_within_empty_method_parentheses = false
ij_python_spaces_around_additive_operators = true
ij_python_spaces_around_assignment_operators = true
ij_python_spaces_around_bitwise_operators = true
ij_python_spaces_around_eq_in_keyword_argument = false
ij_python_spaces_around_eq_in_named_parameter = false
ij_python_spaces_around_equality_operators = true
ij_python_spaces_around_multiplicative_operators = true
ij_python_spaces_around_power_operator = true
ij_python_spaces_around_relational_operators = true
ij_python_spaces_around_shift_operators = true
ij_python_spaces_within_braces = false
ij_python_spaces_within_brackets = false
ij_python_spaces_within_method_call_parentheses = false
ij_python_spaces_within_method_parentheses = false
ij_python_use_continuation_indent_for_arguments = false
ij_python_use_continuation_indent_for_collection_and_comprehensions = false
ij_python_use_continuation_indent_for_parameters = true
ij_python_wrap_long_lines = false

[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

[*.conf]
indent_size = 2
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ on:
paths-ignore:
- '**.md'
- '_config.yml'
- '**.tweet'
tags: "*"

jobs:
test:
compilation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v2
with:
python-version: "3.10.0"
python-version: "3.10.6"
architecture: x64
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
cache: "pipenv"

- name: Install Dependencies with pipenv
run: |
Expand All @@ -33,16 +36,9 @@ jobs:
- run: pipenv run flake8
- run: pipenv run mypy
- name: Python tests with pytest
run: pipenv run pytest --cov --cov-fail-under=20

build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

run: pipenv run pytest --cov --cov-fail-under=70 --capture=no --log-cli-level=INFO
- name: Build docker image
run: docker build . -t python_boilerplate:test

run: docker build . -t python_boilerplate:smoke-test-tag
- name: Smoke test docker image
run: |
docker run --rm python_boilerplate:test 10
docker run --rm python_boilerplate:smoke-test-tag 10
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Project ###
*.db
*.gz
logs/
data/

### PyCharm ###
.idea
*.iml
out
gen

### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/


### Python ###
# Byte-compiled / optimized / DLL files
Expand Down
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ repos:
name: pytest
stages: [commit]
language: system
entry: pipenv run pytest
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-report html --capture=no --log-cli-level=INFO
types: [python]
pass_filenames: false

- id: pytest-cov
name: pytest
stages: [push]
language: system
entry: pipenv run pytest --cov --cov-fail-under=20
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: pipenv run pytest --cov --cov-fail-under=70 --capture=no --log-cli-level=INFO
types: [python]
pass_filenames: false
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# [2.0.0](https://github.com/johnnymillergh/muscle-and-fitness-server/compare/1.0.0...2.0.0) (2022-08-28)


### Performance Improvements

* refactored by latest dependencies ([4c6bd41](https://github.com/johnnymillergh/python_boilerplate/commit/4c6bd416e3afbd3c709ceac0edc1c8cf7dfa13bc))



# 1.0.0 (2021-11-06)


Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ COPY --from=python-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"

# Create and switch to a new user
RUN useradd --create-home appuser
WORKDIR /home/appuser
USER appuser
# RUN useradd --create-home appuser
WORKDIR /app
# USER appuser

# Install application into container
COPY . .
Expand Down
59 changes: 52 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,60 @@ url = "https://pypi.python.org/simple"
verify_ssl = true

[requires]
# https://docs.python.org/3/whatsnew/3.10.html
python_version = "3.10"

[packages]
# Foundamental dependencies
# Loguru is a library which aims to bring enjoyable logging in Python. https://pypi.org/project/loguru/
loguru = "==0.6.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.59"

# Data manipulation dependencies
# NumPy is a Python library used for working with arrays. https://pypi.org/project/numpy/
numpy = "==1.23.2"
# 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.4.3"

# 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.2"

# ORM dependencies
# Peewee is a simple and small ORM. https://pypi.org/project/peewee/
peewee = "==3.15.1"

# 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 = "==14.1.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.17"

[dev-packages]
black = "==20.8b1"
flake8 = "*"
isort = "*"
mypy = "*"
pre-commit = "*"
pytest = "*"
pytest-cov = "*"
# 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 = "==22.6.0"
# Linting & toolkit for checking your code base against coding style (PEP8). https://pypi.org/project/flake8/
flake8 = "==5.0.4"
# isort your imports, so you don't have to. https://pypi.org/project/isort/
isort = "==5.10.1"
# Add type annotations to your Python programs, and use mypy to type check them. https://pypi.org/project/mypy/
mypy = "==0.971"
# A framework for managing and maintaining multi-language pre-commit hooks. https://pypi.org/project/pre-commit/
pre-commit = "==2.20.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.1.2"
# Thin-wrapper around the mock package for easier use with pytest. https://pypi.org/project/pytest-mock/
pytest-mock = "==3.8.2"
# This plugin produces coverage reports. https://pypi.org/project/pytest-cov/
pytest-cov = "==3.0.0"
Loading

0 comments on commit 8c9f5be

Please sign in to comment.