summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Lorey <git@karllorey.com>2022-06-13 21:30:36 +0200
committerKarl Lorey <git@karllorey.com>2022-06-13 21:30:36 +0200
commit8ef28fffec245fe421a3090abe32e42cd16d4ff9 (patch)
tree790e587f5e405d5a63c9b64e97c79a02a18ccabc
parentd506295757c2136e98a3ea8d7988cb25644d7c7f (diff)
Swtich from travis to Github Actions, pre-commit, and tox
-rw-r--r--.github/workflows/ci.yml39
-rw-r--r--.pre-commit-config.yaml35
-rw-r--r--.travis.yml18
-rw-r--r--README.rst2
-rwxr-xr-xdocs/conf.py2
-rw-r--r--docs/index.rst1
-rw-r--r--mlscraper/__init__.py6
-rw-r--r--requirements/dev.in11
-rw-r--r--requirements/docs.in1
-rw-r--r--requirements/docs.txt1
-rw-r--r--requirements/tests.in1
-rw-r--r--requirements/tests.txt2
-rw-r--r--setup.cfg26
-rw-r--r--tox.ini39
14 files changed, 133 insertions, 51 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..18f6a4d
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,39 @@
+name: Tests
+on:
+ push:
+ branches:
+ - master
+ - develop
+ pull_request:
+ branches:
+ - master
+ - develop
+
+jobs:
+ tests:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {name: Linux, python: '3.10', os: ubuntu-latest, tox: py310}
+ - {name: Windows, python: '3.10', os: windows-latest, tox: py310}
+ - {name: Mac, python: '3.10', os: macos-latest, tox: py310}
+ - {name: '3.11-dev', python: '3.11-dev', os: ubuntu-latest, tox: py311}
+ - {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
+ - {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
+ - {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
+ - {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v3
+ with:
+ python-version: ${{ matrix.python }}
+ - name: update pip
+ run: |
+ pip install -U wheel
+ pip install -U setuptools
+ python -m pip install -U pip
+ - run: pip install tox
+ - run: tox -e ${{ matrix.tox }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..2de7305
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,35 @@
+repos:
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v2.32.1
+ hooks:
+ - id: pyupgrade
+ args: ["--py36-plus"]
+ - repo: https://github.com/asottile/reorder_python_imports
+ rev: v3.1.0
+ hooks:
+ - id: reorder-python-imports
+ name: Reorder Python imports (src, tests)
+ files: "^(?!examples/)"
+ args: ["--application-directories", "src"]
+ additional_dependencies: ["setuptools>60.9"]
+ - repo: https://github.com/psf/black
+ rev: 22.3.0
+ hooks:
+ - id: black
+ - repo: https://github.com/PyCQA/flake8
+ rev: 4.0.1
+ hooks:
+ - id: flake8
+ additional_dependencies:
+ - flake8-bugbear
+ - flake8-implicit-str-concat
+ - repo: https://github.com/peterdemin/pip-compile-multi
+ rev: v2.4.5
+ hooks:
+ - id: pip-compile-multi-verify
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.2.0
+ hooks:
+ - id: fix-byte-order-marker
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7aad86b..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: python
-python:
-- 3.8
-- 3.7
-- 3.6
-- 3.5
-install: pip install -U tox-travis
-script: tox
-deploy:
- provider: pypi
- distributions: sdist bdist_wheel
- user: __token__
- password:
- secure: ilKZ9qDwnHVzQC1b1odIUSLphTQ0wWtXNOAs6tZ63MFd4oHFactVihuryuH66cj2mzXuXcRghWe91MT4EjOGUa+he68oHTCp2cV6HwEP+6b+BO6JZXeCQ0luxmFqm0TFbssfmt20ilmZgBiaswu0QliYrKW7yUocsGHqXwfbhaQL3b40mMTG8a7IB9f4hiU7wafbV0JbHZWn5uhlmPQEmdxxMlrhVkTytz9lIN4GLl2wpPskulKT7uwBjYGxQWlsvEROfxjom7AWkEMwsxp3Ht3jG5H3YW/gl9l9o1DJSRXHwFSCY17HtMXa57G3vHIpLl7NgMhLkPfC01fKYkhex+DzngfTpZ41zKrVRaHjKB4RHNTYlQRp/cPLTVlHG6b5h+TFVy7RgYOMkrhCf4DVBpgWTbLi2Eav+t2bnSqvw8PQiFUfRKCaM+8ARa3oAUixIZxIqa9R7fmYopQraDkYyb4ydOK9vQtaATgRYEiIFPDJfsEaRNOKh8ovnkiZvnx/lYcYxt4vtuRCW53Gf5HzGGnEmOBCjQ1v29XlQsjPNIPV4GTfA7Ac8ds6ncp98pU628OjhIFlsELpm3iBK0s4cub7CM9dzcZtoMark9uYyRFFDuWAy5k8hrx15rf7RW9tLYw6TWUSzs7iRBYf8QQoY5hjUACBj928e892iNTiNrk=
- on:
- tags: true
- repo: lorey/mlscraper
- python: 3.8
diff --git a/README.rst b/README.rst
index 7d59a82..b5c58bf 100644
--- a/README.rst
+++ b/README.rst
@@ -16,8 +16,6 @@ You train it by providing a few examples of your desired output.
It will then figure out the extraction rules for you automatically
and afterwards you'll be able to extract data from any new page you provide.
-.. image:: .github/how-it-works-wide.png
-
----------------
Background Story
----------------
diff --git a/docs/conf.py b/docs/conf.py
index 5396add..d8cb71b 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -64,7 +64,7 @@ release = mlscraper.__version__
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
-language = None
+language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
diff --git a/docs/index.rst b/docs/index.rst
index 4bfa9eb..23b7d64 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -8,7 +8,6 @@ Welcome to mlscraper's documentation!
readme
installation
usage
- modules
contributing
authors
history
diff --git a/mlscraper/__init__.py b/mlscraper/__init__.py
index f45ed94..9926d2d 100644
--- a/mlscraper/__init__.py
+++ b/mlscraper/__init__.py
@@ -1,3 +1,3 @@
-# create hierarchy for training
-# - for all items: find selectable object
-# - for all selectable objects: find path to other items
+__author__ = """Karl Lorey"""
+__email__ = "git@karllorey.com"
+__version__ = "0.1.2"
diff --git a/requirements/dev.in b/requirements/dev.in
new file mode 100644
index 0000000..31d384c
--- /dev/null
+++ b/requirements/dev.in
@@ -0,0 +1,11 @@
+bump2version
+wheel
+watchdog
+flake8
+tox
+coverage
+Sphinx
+twine
+
+pytest
+pytest-runner
diff --git a/requirements/docs.in b/requirements/docs.in
new file mode 100644
index 0000000..6966869
--- /dev/null
+++ b/requirements/docs.in
@@ -0,0 +1 @@
+sphinx
diff --git a/requirements/docs.txt b/requirements/docs.txt
new file mode 100644
index 0000000..6966869
--- /dev/null
+++ b/requirements/docs.txt
@@ -0,0 +1 @@
+sphinx
diff --git a/requirements/tests.in b/requirements/tests.in
new file mode 100644
index 0000000..e079f8a
--- /dev/null
+++ b/requirements/tests.in
@@ -0,0 +1 @@
+pytest
diff --git a/requirements/tests.txt b/requirements/tests.txt
new file mode 100644
index 0000000..4d4a689
--- /dev/null
+++ b/requirements/tests.txt
@@ -0,0 +1,2 @@
+pytest
+pre-commit
diff --git a/setup.cfg b/setup.cfg
index 670ba58..76d14eb 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,8 +18,28 @@ replace = __version__ = "{new_version}"
[bdist_wheel]
universal = 1
-[flake8]
-exclude = docs
-
[aliases]
test = pytest
+
+[flake8]
+exclude = docs
+# B = bugbear
+# E = pycodestyle errors
+# F = flake8 pyflakes
+# W = pycodestyle warnings
+# B9 = bugbear opinions
+# ISC = implicit str concat
+select = B, E, F, W, B9, ISC
+ignore =
+ # slice notation whitespace, invalid
+ E203
+ # import at top, too many circular import fixes
+ E402
+ # line length, handled by bugbear B950
+ E501
+ # bare except, handled by bugbear B001
+ E722
+ # bin op line break, invalid
+ W503
+# up to 88 allowed by bugbear B950
+max-line-length = 80
diff --git a/tox.ini b/tox.ini
index 9c4a94b..fbe6a6a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,27 +1,20 @@
[tox]
-envlist = py35, py36, py37, py38, flake8
-
-[travis]
-python =
- 3.8: py38
- 3.7: py37
- 3.6: py36
- 3.5: py35
-
-[testenv:flake8]
-basepython = python
-deps = flake8
-commands = flake8 mlscraper tests
+envlist =
+ py3{11,10,9,8,7},pypy3{8,7}
+ style
+ docs
+skip_missing_interpreters = true
[testenv]
-setenv =
- PYTHONPATH = {toxinidir}
-deps =
- -r{toxinidir}/requirements_dev.txt
-; If you want to make tox run the tests with the same versions, create a
-; requirements.txt with the pinned versions and uncomment the following line:
-; -r{toxinidir}/requirements.txt
-commands =
- pip install -U pip
- pytest --basetemp={envtmpdir}
+envtmpdir = {toxworkdir}/tmp/{envname}
+deps = -rrequirements/tests.txt
+commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs:tests}
+
+[testenv:style]
+deps = pre-commit
+skip_install = true
+commands = pre-commit run --all-files --show-diff-on-failure
+[testenv:docs]
+deps = sphinx
+commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html