Merge pull request #1 from enpaul/ci

Add CI
This commit is contained in:
Ethan Paul 2020-03-14 11:46:54 -04:00 committed by GitHub
commit 1b111791c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1733 additions and 8 deletions

View File

@ -8,4 +8,3 @@ exclude_lines =
main()
\.\.\.
pass

38
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: CI
on: [pull_request]
jobs:
Test:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: 3.5
toxenv: py35
- version: 3.6
toxenv: py36
- version: 3.7
toxenv: py37
- version: 3.8
toxenv: py38
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python.version }}
- name: Run ${{ matrix.python.toxenv }} tests via tox
run: |
pip install tox==3.14.5
tox -e ${{ matrix.python.toxenv }}
Check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Run meta checks via tox
run: |
pip install tox==3.14.5
tox -e format -e static -e docs

1
.gitignore vendored
View File

@ -96,4 +96,3 @@ ENV/
# Rope project settings
.ropeproject

27
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,27 @@
---
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/asottile/blacken-docs
rev: v0.5.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.3b0]
language_version: python3.7
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: end-of-file-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: trailing-whitespace
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.8.0
hooks:
- id: reorder-python-imports

View File

@ -425,4 +425,3 @@ min-public-methods=2
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception

View File

@ -18,4 +18,3 @@ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

3
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Exclude autogenerated module documentation
modules.rst
mezzo*.rst

61
docs/conf.py Normal file
View File

@ -0,0 +1,61 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
from pathlib import Path
BASE_DIR = Path(__file__).parent.resolve()
ABOUT = {}
with open(Path(BASE_DIR, "..", "mezzo", "__about__.py")) as infile:
exec(infile.read(), ABOUT)
# The full version, including alpha/beta/rc tags
release = ABOUT["__version__"]
project = ABOUT["__title__"]
copyright = "2020, Ethan Paul"
author = "; ".join(ABOUT["__authors__"])
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.imgmath",
"sphinx.ext.viewcode",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/": None}

21
docs/index.rst Normal file
View File

@ -0,0 +1,21 @@
.. Mezzo documentation master file, created by
sphinx-quickstart on Fri Mar 13 21:33:10 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Mezzo's documentation!
=================================
.. toctree::
:maxdepth: 2
:caption: Contents:
API Reference <mezzo>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

4
mezzo/__about__.py Normal file
View File

@ -0,0 +1,4 @@
# pylint: disable=missing-docstring
__version__ = "0.0.0"
__title__ = "mezzo"
__authors__ = ["Ethan Paul <e@enp.one>"]

1524
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,21 @@ authors = ["Ethan Paul <e@enp.one>"]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.4"
python = "^3.5"
[tool.poetry.dev-dependencies]
tox = "^3.14.5"
sphinx = "^2.4.4"
sphinx-autodoc-typehints = {version = "^1.10.3", python = "^3.5.2"}
reorder-python-imports = {version = "^2.1.0", python = "^3.6.1"}
bandit = "^1.6.2"
ipython = {version = "^7.13.0", python = "^3.6"}
pre-commit = "^1.10"
mypy = "^0.770"
black = {version = "^19.10b0", allow-prereleases = true, python = "^3.6"}
pylint = "^2.4.4"
pytest = "^5.4.1"
pytest-cov = "^2.8.1"
[build-system]
requires = ["poetry>=1.0.0"]

45
tox.ini Normal file
View File

@ -0,0 +1,45 @@
[tox]
envlist = py35, py36, py37, py38, format, static, docs
skip_missing_interpreters = true
isolated_build = true
[testenv]
description = Nothing for now
commands =
python -c "print('Hello World!')"
[testenv:format]
description = Enforce file formatting (pre-commit)
skip_install = true
basepython = python3
deps =
pre-commit == 1.21.0
commands =
pre-commit run --all-files
[testenv:static]
description = Static code analysis (mypy+pylint+bandit)
basepython = python3.7
ignore_errors = true
deps =
pylint == 2.4.4
mypy == 0.770
bandit == 1.6.2
commands =
mypy mezzo --ignore-missing-imports --no-strict-optional
pylint mezzo --rcfile .pylintrc
bandit --recursive mezzo
[testenv:docs]
description = Build documentation (sphinx)
basepython = python3.7
deps =
sphinx == 2.4.4
sphinx-autodoc-typehints == 1.10.3
whitelist_externals =
rm
commands =
sphinx-apidoc -o "./docs/" "mezzo"
rm "docs/modules.rst"
sphinx-build -M html "./docs/" "./docs/_build" -W
sphinx-build -M latex "./docs/" "./docs/_build" -W