Skip to content

Commit

Permalink
Package Restyling
Browse files Browse the repository at this point in the history
Package Restyling #10
  • Loading branch information
vladyslav-fenchak committed May 19, 2021
1 parent 941bcb0 commit 0f914b8
Show file tree
Hide file tree
Showing 28 changed files with 336 additions and 203 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish Python Package Documentation

on:
release:
types: [ created ]

jobs:
deploy:
runs-on: ubuntu-latest
container: python:3.9-buster

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: make install

- name: Generate documentation
run: make docs

- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
43 changes: 22 additions & 21 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
name: Upload Python Package

on:
release:
types: [created]
release:
types: [ created ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
deploy:
runs-on: ubuntu-latest
container: python:3.9-buster

steps:

- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: make install

- name: Publish package
run: make release
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
67 changes: 33 additions & 34 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
python setup.py install
- name: Test with pytest
run: |
make test
- name: Generate coverage report
run: |
make coverage
- name: Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
build:
runs-on: ubuntu-latest
container: python:3.9-buster

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: make install

- name: Lint package
run: make lint

- name: Test package with coverage
run: make coverage

- name: Publish coverage
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true

- name: Generate documentation
run: make docs

- name: Generate build
run: make dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ ENV/
# IDE settings
.vscode/

# Intellij IDEa / PyCharm / etc.
.idea
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
default_stages: [ commit ]
repos:
- repo: local
hooks:
- id: install
pass_filenames: false
name: Install depencies
entry: make install
language: system

- id: reformat
pass_filenames: false
name: Reformat package
entry: make reformat
language: system

- id: lint
pass_filenames: false
name: Lint package
entry: make lint
language: system

- id: test
pass_filenames: false
name: Test package
entry: make test
language: system

- id: docs
pass_filenames: false
name: Generate documentation
entry: make docs
language: system

- id: build
pass_filenames: false
entry: make dist
name: Generate build
language: system
28 changes: 28 additions & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
enabled: true
exclude:
- "**/*.md"
- ".idea/**/*"
- "docs/**/*"
- "**/*.in"
- "Makefile"
- ".github/workflows/**/*"
restylers:
- name: black
image: restyled/restyler-black:v19.10b0
command:
- black
arguments: ["--line-length", "120"]
include:
- "**/*.py"
interpreters:
- python
- name: isort
image: restyled/restyler-isort:v5.8.0
command:
- isort
arguments: []
include:
- "**/*.py"
interpreters:
- python
12 changes: 6 additions & 6 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Credits
=======
# Credits

Development Lead
----------------
## Development Lead

* Andrea Mucci <[email protected]>

Contributors
------------
## Core Devs

* Sergio Garcia Prado <[email protected]>
* Vladyslav Fenchak <[email protected]>

## Contributors
None yet. Why not be the first?
6 changes: 2 additions & 4 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
History
=======
# History

0.0.1 (2021-05-13)
------------------
## 0.0.1 (2021-05-19)

* First release on PyPI.
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

42 changes: 25 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean: clean-build clean-pyc clean-test clean-env

clean-build: ## remove build artifacts
rm -fr build/
Expand All @@ -47,38 +47,46 @@ clean-test: ## remove test and coverage artifacts
rm -fr htmlcov/
rm -fr .pytest_cache

clean-env:
rm -fr .env/

lint: ## check style with flake8
flake8 minos tests
poetry run flake8

test: ## run tests quickly with the default Python
pytest
poetry run pytest

test-all: ## run tests on every Python version with tox
tox
poetry run tox

coverage: ## check code coverage quickly with the default Python
coverage run --source minos -m pytest
coverage report -m
coverage xml
poetry run coverage run --source minos -m pytest
poetry run coverage report -m
poetry run coverage xml
## $(BROWSER) htmlcov/index.html

reformat: ## check code coverage quickly with the default Python
poetry run black --line-length 120 minos tests
poetry run isort --recursive minos tests

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/api_gateway.rst
rm -f docs/minos_api_gateway.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ api_gateway
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
poetry run sphinx-apidoc -o docs/api minos
poetry run $(MAKE) -C docs clean
poetry run $(MAKE) -C docs html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*
poetry publish

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
poetry build
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
install:
poetry install

full-install: clean install
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
API Gateway
===========
# Minos Api Gateway

## Description

Minos Boilerplate contains all the boilerplate you need to create a Minos Python package.

Credits
-------
## Credits

This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [Minos Package](https://github.com/Clariteia/minos-pypackage) project template.
7 changes: 7 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage:
status:
project:
default:
threshold: 1%
if_not_found: failure
comment: false
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = api_gateway
SPHINXPROJ = minos_api_gateway
SOURCEDIR = .
BUILDDIR = _build

Expand Down
Loading

0 comments on commit 0f914b8

Please sign in to comment.