Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato committed Aug 9, 2021
1 parent 95fc8d4 commit 7058ffb
Show file tree
Hide file tree
Showing 26 changed files with 1,431 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
exclude = __pycache__,built,build,venv
ignore = E203, E266, W503
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: RobertoPrevato
109 changes: 109 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Build

on:
release:
types: [published]
push:
branches:
- main
- ci
pull_request:
branches:
- "*"

env:
PROJECT_NAME: configuration

jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 9
submodules: false

- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v1
id: depcache
with:
path: deps
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}

- name: Download dependencies
if: steps.depcache.outputs.cache-hit != 'true'
run: |
pip download --dest=deps -r requirements.txt
- name: Install dependencies
run: |
pip install -U --no-index --find-links=deps deps/*
- name: Run tests
run: |
pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
- name: Run linters
run: |
echo "Running linters"
flake8 .
isort --check-only . 2>&1
black --check . 2>&1
- name: Upload pytest test results
uses: actions/upload-artifact@master
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/pytest-results-${{ matrix.python-version }}.xml
if: always()

- name: Codecov
run: |
bash <(curl -s https://codecov.io/bash)
- name: Install distribution dependencies
run: pip install --upgrade twine setuptools wheel
if: matrix.python-version == 3.8 || matrix.python-version == 3.9

- name: Create distribution package
run: python setup.py sdist bdist_wheel
if: matrix.python-version == 3.8 || matrix.python-version == 3.9

- name: Upload distribution package
uses: actions/upload-artifact@master
with:
name: dist-package-${{ matrix.python-version }}
path: dist
if: matrix.python-version == 3.8 || matrix.python-version == 3.9

publish:
runs-on: ubuntu-18.04
needs: build
if: github.event_name == 'release'
steps:
- name: Download a distribution artifact
uses: actions/download-artifact@v2
with:
name: dist-package-3.9
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
110 changes: 110 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea/

test-cov.xml
test-output.xml
*.py,cover
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile = black
multi_line_output = 3
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2021-08-09 :cactus:
- Forks new project from [roconfiguration](https://github.com/Neoteroi/roconfiguration), with name `essentials-configuration`
- New code API to support extensions
- Applies `isort` and enforces `isort` and `black` checks in CI pipeline
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.md
include LICENSE
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: release test


artifacts: test
python setup.py sdist bdist_wheel


release: test
python setup.py sdist upload


test:
pytest


testcov:
pytest --cov-report html --cov=configuration tests/


lint: check-flake8 check-isort check-black


check-flake8:
@echo "$(BOLD)Checking flake8$(RESET)"
@flake8 . 2>&1


check-isort:
@echo "$(BOLD)Checking isort$(RESET)"
@isort --check-only . 2>&1


check-black:
@echo "$(BOLD)Checking black$(RESET)"
@black --check . 2>&1


format:
@echo "$(BOLD)Formatting code 🧹 🧼$(RESET)"
@black . 2>&1
@isort . 2>&1
Loading

0 comments on commit 7058ffb

Please sign in to comment.