clean up config files

This commit is contained in:
573Dev 2021-04-18 15:02:53 -05:00 committed by 573dev
parent 1d6530b4dd
commit d2ff78b22a
9 changed files with 195 additions and 31 deletions

View File

@ -1,4 +0,0 @@
[flake8]
ignore = E203, W503
max-line-length = 88
inline-quotes = double

128
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,128 @@
name: build
on: [push]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check:
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v2
# Set up python
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.x
# Install Deps
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
# Run Check
- name: Run Code Linters
run: tox -e check
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
# Checkout Repo
- uses: actions/checkout@v2
# Set up python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Install Deps
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
# Run Tests
- name: Run Python Tests
run: tox
- name: Show items
run: ls -la
# Upload Coverage Artifacts
- name: Upload Coverage Data
uses: actions/upload-artifact@v2
with:
name: coverage_${{ matrix.python-version }}
path: .coverage.*
coverage:
needs: test
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v2
# Set up python
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.x
# Install Deps
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox
# Download Coverage Artifacts
- name: Download Coverage Data
uses: actions/download-artifact@v2
- name: Move coverage data
run: |
mv coverage_*/.coverage* .
rm -rf coverage_*/
# Run Coverage
- name: Run Coverage
run: tox -e coverage
# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./dist/coverage.xml
directory: ./coverage/reports/
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
verbose: false
documentation:
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v2
# Set up python
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.x
# Install Deps
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox
# Run Documentation
- name: Run Documentation
run: tox -e docs

View File

@ -1,3 +0,0 @@
[mypy]
ignore_missing_imports = True
plugins = sqlmypy

13
.readthedocs.yml Normal file
View File

@ -0,0 +1,13 @@
version: 2
sphinx:
builder: html
configuration: docs/conf.py
python:
version: 3
install:
- method: pip
path: .
extra_requirements:
- docs

View File

@ -1,8 +1,18 @@
from datetime import datetime
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
from v8_server import __version__
# This exists to fix a bug in recommonmark due to a missing function definition
# https://github.com/readthedocs/recommonmark/issues/177
class CustomCommonMarkParser(CommonMarkParser):
def visit_document(self, node):
pass
# Sphinx Base --------------------------------------------------------------------------
# Extensions
extensions = [
@ -16,8 +26,6 @@ extensions = [
"sphinx.ext.viewcode",
# https://sphinx-autoapi.readthedocs.io/en/latest/
"autoapi.extension",
# https://github.com/rtfd/recommonmark
"recommonmark",
]
# Set initial page name
@ -25,7 +33,7 @@ master_doc = "index"
# Project settings
project = "V8 Server"
year = "2020"
year = datetime.now().year
author = "573dev"
copyright = f"{year}, {author}"
@ -64,9 +72,8 @@ napoleon_use_param = False
# Sphinx Extension AutoAPI -------------------------------------------------------------
autoapi_type = "python"
autoapi_dirs = ["../v8_server/"]
autoapi_template_dir = "docs/autoapi_templates"
autoapi_template_dir = "./autoapi_templates"
autoapi_root = "autoapi"
autoapi_ignore = ["*/v8_server/version.py"]
autoapi_add_toctree_entry = False
autoapi_keep_files = False
@ -80,6 +87,8 @@ def setup(app):
# Set source filetype(s)
# Allow .rst files along with .md
app.add_source_suffix(".rst", "restructuredtext")
app.add_source_suffix(".md", "markdown")
app.add_source_parser(CustomCommonMarkParser)
# RecommonMark Settings ------------------------------------------------------------
# Enable the evaluation of rst directive in .md files

View File

@ -10,13 +10,11 @@ show_missing = true
skip_covered = true
exclude_lines = ["if __name__ == .__main__.:", "def __str__", "def __repr__", "pragma: no cover"]
[tool.coverage.xml]
output = "./dist/coverage.xml"
[tool.isort]
line_length = 88
force_grid_wrap = "0"
multi_line_output = "3"
use_parentheses = true
profile = "black"
color_output = true
lines_after_imports = 2
combine_as_imports = true
known_first_party = ["v8_server"]
known_third_party = ["pytest, recommonmark"]
include_trailing_comma = true
lines_after_imports = "2"

15
setup.cfg Normal file
View File

@ -0,0 +1,15 @@
[aliases]
test=pytest
[bdist_wheel]
universal = 1
[flake8]
ignore = E203, W503
max-line-length = 88
inline-quotes = double
[mypy]
warn_unused_ignores = true
ignore_missing_imports = true
plugins = sqlmypy

View File

@ -5,18 +5,25 @@ from setuptools import find_packages, setup
TEST_DEPS = ["coverage[toml]", "pytest", "pytest-cov"]
DOCS_DEPS = ["sphinx", "sphinx-rtd-theme", "sphinx-autoapi", "recommonmark"]
CHECK_DEPS = ["isort", "flake8", "flake8-quotes", "pep8-naming", "mypy", "black"]
DOCS_DEPS = ["recommonmark", "sphinx", "sphinx-autoapi", "sphinx-rtd-theme"]
CHECK_DEPS = [
"black",
"flake8",
"flake8-quotes",
"isort[colors]",
"mypy",
"pep8-naming",
]
REQUIREMENTS = [
"flask",
"flask_sqlalchemy",
"watchdog",
"pyopenssl",
"kbinxml",
"lxml",
"pycryptodome",
"kbinxml",
"pyopenssl",
"sqlalchemy",
"sqlalchemy-stubs",
"watchdog",
]
EXTRAS = {

13
tox.ini
View File

@ -12,19 +12,20 @@ setenv =
PYTHONPATH = {toxinidir}
COVERAGE_FILE=.coverage.{envname}
commands =
py.test --cov=v8_server --verbose --tb=long {posargs}
py.test --cov=v8_server --verbose --tb=long --durations=5 {posargs}
[testenv:coverage]
basepython = python3.8
basepython = python3
deps = coverage[toml]
skip_install = True
skipsdist = True
commands =
/usr/bin/env bash -c "{envpython} -m coverage combine .coverage.*"
coverage report
coverage xml
[testenv:check]
basepython = python3.8
basepython = python3
extras = check
commands =
isort v8_server tests setup.py docs/conf.py --check-only --diff
@ -33,10 +34,10 @@ commands =
mypy v8_server setup.py docs/conf.py
[testenv:docs]
basepython = python3.8
basepython = python3
extras = docs
commands = sphinx-build {posargs:-E} -b html docs dist/docs
[travis]
[gh-actions]
python =
3.8: check, py38, coverage, docs
3.8: py38