From 5bb0642b5d4557ad5c2f2e2286f15557acb8c83f Mon Sep 17 00:00:00 2001 From: Patrick Kanzler <4189642+patkan@users.noreply.github.com> Date: Sat, 30 Oct 2021 22:21:34 +0200 Subject: [PATCH] housekeeping tasks (#464) * update settings to use black * update python versions * enquote version numbers * update dependency * set explicit build command * add newline * add command to checkout * add run step * chain * sudo * test * newer sphinx version * update sphinx * clean up setuptools usage * use tox * install tox * tox --- .github/workflows/documentation.yml | 11 +++++++---- .github/workflows/pythonpackage.yml | 2 +- .vscode/settings.json | 21 ++++++++++++--------- doc/conf.py | 15 ++++----------- doc/requirements.txt | 2 +- setup.cfg | 3 ++- tox.ini | 9 ++++++--- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 81be6a9..f74a954 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -22,7 +22,10 @@ jobs: - uses: actions/checkout@v2.3.5 with: submodules: 'recursive' - - uses: ammaraskar/sphinx-action@0.4 - with: - docs-folder: "doc/" - pre-build-command: "apt-get update -y && apt-get install -y git python3-sphinx graphviz libenchant1c2a" \ No newline at end of file + - name: Install packages + run: + sudo apt-get update -y && + sudo apt-get install -y git python3-sphinx graphviz libenchant1c2a && + sudo pip install tox + - name: Test doc build + run: tox -e docs diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index b4719a5..fc46967 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2.3.5 diff --git a/.vscode/settings.json b/.vscode/settings.json index 32ab8c0..ca826d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,14 @@ { - "restructuredtext.confPath": "${workspaceFolder}/doc", - "files.watcherExclude": { - "**/.git/objects/**": true, - "**/.git/subtree-cache/**": true, - "**/node_modules/*/**": true, - "**/.eggs/**": true, - "**/.hypothesis/**": true, - "**/.tox/**": true, - } + "restructuredtext.confPath": "${workspaceFolder}/doc", + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/*/**": true, + "**/.eggs/**": true, + "**/.hypothesis/**": true, + "**/.tox/**": true, + }, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "python.formatting.provider": "black", } \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index e81e20b..24d0b05 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -15,11 +15,9 @@ import sys import os +from importlib.metadata import version as imp_version + on_rtd = os.getenv("READTHEDOCS") == "True" -if on_rtd: - import escpos -else: - from setuptools_scm import get_version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -75,14 +73,9 @@ copyright = u"2016, Manuel F Martinez and others" # |version| and |release|, also used in various other places throughout the # built documents. # -if on_rtd: - # The full version, including alpha/beta/rc tags. - release = escpos.__version__ -else: - # locally setuptools_scm should work - release = get_version(root=root) +release = imp_version("python-escpos") # The short X.Y version. -version = ".".join(release.split(".")[:2]) # The short X.Y version. +version = ".".join(release.split(".")[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/requirements.txt b/doc/requirements.txt index 728e22d..09e59da 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -6,5 +6,5 @@ sphinx-rtd-theme setuptools setuptools-scm docutils>=0.12 -sphinxcontrib-spelling>=5 +sphinxcontrib-spelling>=7.2.0 python-barcode>=0.11.0,<1 diff --git a/setup.cfg b/setup.cfg index 3423563..ef78c82 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,6 +22,7 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Libraries :: Python Modules Topic :: Office/Business :: Financial :: Point-Of-Sale @@ -59,7 +60,7 @@ tests_require = mock hypothesis>4 flake8 - sphinxcontrib-spelling>=5 + sphinxcontrib-spelling>=7.2.0 [nosetests] verbosity=3 diff --git a/tox.ini b/tox.ini index 1501eb8..ea27473 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, docs, flake8 +envlist = py35, py36, py37, py38, py39, py310, docs, flake8 [gh-actions] python = @@ -7,6 +7,8 @@ python = 3.6: py36 3.7: py37 3.8: py38 + 3.9: py39 + 3.10: py310 [testenv] deps = nose @@ -25,10 +27,11 @@ passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAV [testenv:docs] basepython = python changedir = doc -deps = sphinx>=1.5.1 +deps = sphinx>=3.0.0 setuptools_scm python-barcode - sphinxcontrib-spelling>=5 + sphinxcontrib-spelling>=7.2.0 + sphinx_rtd_theme commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:flake8]