diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..90a59d3
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,50 @@
+name: CI
+
+# Controls when the action will run.
+on:
+ # Triggers the workflow on push or pull request events
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 12 * * 0' # run once a week on Sunday
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+ tests:
+ name: "Python ${{ matrix.python-version }}"
+ runs-on: "ubuntu-latest"
+
+ strategy:
+ matrix:
+ python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"]
+
+ # Steps represent a sequence of tasks that will be executed as part of the job
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: "actions/checkout@v2"
+ - uses: "actions/setup-python@v2"
+ with:
+ python-version: "${{ matrix.python-version }}"
+ - name: "Install dependencies"
+ run: |
+ set -xe
+ python -VV
+ python -m site
+ python -m pip install --upgrade pip setuptools wheel
+ python -m pip install --upgrade virtualenv tox tox-gh-actions
+ - name: "Run tox targets for ${{ matrix.python-version }}"
+ run: "python -m tox"
+
+ - name: "Report to coveralls"
+ # coverage is only created in the py39 environment
+ # --service=github is a workaround for bug
+ # https://github.com/coveralls-clients/coveralls-python/issues/251
+ if: "matrix.python-version == '3.9'"
+ run: |
+ pip install coveralls
+ coveralls --service=github
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 29bca3f..b1e335c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,5 +1,15 @@
repos:
- repo: https://github.com/psf/black
- rev: stable
+ rev: 20.8b1
hooks:
- id: black
+ args: [--line-length=80]
+ - repo: https://gitlab.com/pycqa/flake8
+ rev: "3.8.4"
+ hooks:
+ - id: flake8
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v2.7.4
+ hooks:
+ - id: pyupgrade
+ args: [--py36-plus]
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 622d714..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: python
-
-python: 3.8
-
-cache: pip
-
-matrix:
- include:
- - python: "3.6"
- env: TOXENV=py36
- - python: "3.7"
- env: TOXENV=py37
- - python: "3.8"
- env: TOXENV=py38
- - python: "3.8"
- env: TOXENV=pep8
- - python: "3.8"
- env: TOXENV=coverage
-before_install:
- - pip install --upgrade pip setuptools
-install:
- - pip install tox
- - if [ "$TOXENV" = 'coverage' ]; then pip install coveralls; fi
-script:
- - tox -e $TOXENV
-after_success:
- - if [ "$TOXENV" = 'coverage' ]; then coveralls; fi
diff --git a/CHANGES.rst b/CHANGES.rst
index b1cb959..e98edfc 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -6,6 +6,10 @@ CHANGES
- Make Python 3.6 the default testing environment.
+- Add support for Python 3.9.
+
+- Use GitHub Actios for CI.
+
0.1 (2016-06-09)
================
diff --git a/README.rst b/README.rst
index 0b27616..46891c2 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,18 @@
+.. image:: https://github.com/morepath/morepath_wiki/workflows/CI/badge.svg?branch=master
+ :target: https://github.com/morepath/morepath_wiki/actions?workflow=CI
+ :alt: CI Status
+
+.. image:: https://coveralls.io/repos/github/morepath/morepath_wiki/badge.svg?branch=master
+ :target: https://coveralls.io/github/morepath/morepath_wiki?branch=master
+
+.. image:: https://img.shields.io/pypi/v/morepath_wiki.svg
+ :target: https://pypi.org/project/morepath_wiki/
+
+.. image:: https://img.shields.io/pypi/pyversions/morepath_wiki.svg
+ :target: https://pypi.org/project/morepath_wiki/
+
+
+
Morepath Wiki
=============
@@ -60,4 +75,4 @@ And to run the test suite::
.. _GitHub: https://github.com/morepath/morepath_wiki
-.. _virtual environment: http://www.virtualenv.org/
+.. _virtual environment: https://virtualenv.pypa.io/en/latest/
diff --git a/morepath_wiki/html.py b/morepath_wiki/html.py
index ab4c21e..efb04ee 100644
--- a/morepath_wiki/html.py
+++ b/morepath_wiki/html.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf8 -*-
#
# $Id: html.py 5409 2011-06-29 07:07:25Z rjones $
# $HeadURL: svn+ssh://svn/svn/trunk/api/eklib/html.py $
@@ -223,7 +222,6 @@
See the end of the source file for the license of use.
XHTML support was contributed by Michael Haubenwallner.
"""
-from __future__ import with_statement
__version__ = "1.16"
@@ -232,7 +230,7 @@
import unittest
-class HTML(object):
+class HTML:
"""Easily generate HTML.
>>> print HTML('html', 'some text')
@@ -254,7 +252,9 @@ class HTML(object):
newline_default_on = set("table ol ul dl".split())
- def __init__(self, name=None, text=None, stack=None, newlines=True, escape=True):
+ def __init__(
+ self, name=None, text=None, stack=None, newlines=True, escape=True
+ ):
self._name = name
self._content = []
self._attrs = {}
@@ -311,10 +311,13 @@ def __call__(self, *content, **kw):
if self._name == "read":
if len(content) == 1 and isinstance(content[0], int):
raise TypeError(
- "you appear to be calling read(%d) on " "a HTML instance" % content
+ "you appear to be calling read(%d) on "
+ "a HTML instance" % content
)
elif len(content) == 0:
- raise TypeError("you appear to be calling read() on a " "HTML instance")
+ raise TypeError(
+ "you appear to be calling read() on a " "HTML instance"
+ )
# customising a tag with content or attributes
escape = kw.pop("escape", True)
@@ -343,7 +346,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
self._stack.pop()
def __repr__(self):
- return "" % (self._name, id(self))
+ return "".format(self._name, id(self))
def _stringify(self, str_type):
# turn me and my content into text
@@ -352,7 +355,7 @@ def _stringify(self, str_type):
return join.join(map(str_type, self._content))
a = ['%s="%s"' % i for i in self._attrs.items()]
l = [self._name] + a
- s = "<%s>%s" % (" ".join(l), join)
+ s = "<{}>{}".format(" ".join(l), join)
if self._content:
s += join.join(map(str_type, self._content))
s += join + "%s>" % self._name
@@ -384,12 +387,12 @@ def _stringify(self, str_type):
return join.join(map(str_type, self._content))
a = ['%s="%s"' % i for i in self._attrs.items()]
l = [self._name] + a
- s = "<%s>%s" % (" ".join(l), join)
+ s = "<{}>{}".format(" ".join(l), join)
if self._content or not (self._name.lower() in self.empty_elements):
s += join.join(map(str_type, self._content))
s += join + "%s>" % self._name
else:
- s = "<%s />%s" % (" ".join(l), join)
+ s = "<{} />{}".format(" ".join(l), join)
return s
@@ -409,12 +412,12 @@ def _stringify(self, str_type):
return join.join(map(str_type, self._content))
a = ['%s="%s"' % i for i in self._attrs.items()]
l = [self._name] + a
- s = "<%s>%s" % (" ".join(l), join)
+ s = "<{}>{}".format(" ".join(l), join)
if self._content:
s += join.join(map(str_type, self._content))
s += join + "%s>" % self._name
else:
- s = "<%s />%s" % (" ".join(l), join)
+ s = "<{} />{}".format(" ".join(l), join)
return s
@@ -443,7 +446,8 @@ def test_iadd_tag(self):
h += XML("some-tag", "spam", newlines=False)
h += XML("text", "spam", newlines=False)
self.assertEquals(
- str(h), "