Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 33 additions & 34 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,42 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install -U black pylama wheel pip tox
pip install .
- name: Set build name
run: echo "::set-output name=${GITHUB_REPOSITORY}-$(python setup.py --version)"
- name: Lint
run: |
- name: Run Tox
# Run tox using the version of Python in `PATH`
run: tox -e py
- name: Build Package
if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
python setup.py bdist
- name: Publish package
if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install -U black pylama wheel pip tox
pip install .
- name: Set build name
run: echo "::set-output name=${GITHUB_REPOSITORY}-$(python setup.py --version)"
- name: Lint
run: |
- name: Run Tox
# Run tox using the version of Python in `PATH`
run: tox -e py
- name: Build Package
if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
python setup.py bdist
- name: Publish package
if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
45 changes: 31 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: '^$|venv'
exclude: "^$|venv|.obsidian"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,27 +11,44 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.4.2
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/humitos/mirrors-autoflake.git
rev: v1.1
language_version: python3.12
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: [ '--in-place', '--remove-all-unused-imports', '--remove-unused-variable' ]
args: [--remove-all-unused-imports, --in-place]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
args: ['--line-length=79']
language_version: python3.9
args: ["--profile", "black", "--filter-files", "--line-length=79"]
language_version: python3.12
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [types-requests, types-PyYAML, types-Flask, types-Werkzeug,
types-Markdown]
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py36-plus]
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/andreoliwa/nitpick
rev: v0.35.0
hooks:
- id: nitpick
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: rst-backticks
default_language_version:
python: python3.11
22 changes: 22 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
24 changes: 14 additions & 10 deletions fixtures/dennis.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>User: Dennis</title>
</head>
<body>
<p>This page is about a fictional person with the following attributes:</p>
<ul itemscope itemid="http://example.com/users/dennis#id" itemtype="http://schema.org/Person">
<li>His name is <span itemprop="name">Dennis Felt</span></li>
</ul>
</body>
<head>
<title>User: Dennis</title>
</head>
<body>
<p>This page is about a fictional person with the following attributes:</p>
<ul
itemscope
itemid="http://example.com/users/dennis#id"
itemtype="http://schema.org/Person"
>
<li>His name is <span itemprop="name">Dennis Felt</span></li>
</ul>
</body>
</html>
24 changes: 14 additions & 10 deletions fixtures/fiona.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>User: Fiona</title>
</head>
<body>
<p>This page is about a fictional person with the following attributes:</p>
<ul itemscope itemid="http://example.com/users/fiona#id" itemtype="http://schema.org/Person">
<li>Her name is <span itemprop="name">Fiona Bennett</span></li>
</ul>
</body>
<head>
<title>User: Fiona</title>
</head>
<body>
<p>This page is about a fictional person with the following attributes:</p>
<ul
itemscope
itemid="http://example.com/users/fiona#id"
itemtype="http://schema.org/Person"
>
<li>Her name is <span itemprop="name">Fiona Bennett</span></li>
</ul>
</body>
</html>
28 changes: 15 additions & 13 deletions fixtures/results.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>List of Users</title>
</head>
<body>
<h1>Search Results</h1>
<p>
This is a fictional page for possible response for a user search.
</p>
<ol>
<li><a href="/users/fiona" rel="http://example.com/relations/user">Fiona Bennett</a></li>
</ol>
<head>
<title>List of Users</title>
</head>
<body>
<h1>Search Results</h1>
<p>This is a fictional page for possible response for a user search.</p>
<ol>
<li>
<a href="/users/fiona" rel="http://example.com/relations/user"
>Fiona Bennett</a
>
</li>
</ol>
Return <a href="/">Home</a>
</body>
</body>
</html>
54 changes: 29 additions & 25 deletions fixtures/users.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>List of Users</title>
</head>
<body>
<h1>List of Users</h1>
<p>
This is a fictional page for an API that allows browsing, adding and
editing users.
</p>
<h2>Add new user</h2>
<form name="newuser" method="post" action="/users">
<input name="name" value="" type="text"/>
<input type="submit"/>
</form>
<h2>Search for user</h2>
<form name="search" method="get" action="/users/search">
<input name="q" value="" type="text"/>
<input type="submit"/>
</form>
<h2>View user</h2>
<ul>
<li><a href="/users/fiona" rel="http://example.com/relations/user">Fiona Bennett</a></li>
</ul>
<head>
<title>List of Users</title>
</head>
<body>
<h1>List of Users</h1>
<p>
This is a fictional page for an API that allows browsing, adding and
editing users.
</p>
<h2>Add new user</h2>
<form name="newuser" method="post" action="/users">
<input name="name" value="" type="text" />
<input type="submit" />
</form>
<h2>Search for user</h2>
<form name="search" method="get" action="/users/search">
<input name="q" value="" type="text" />
<input type="submit" />
</form>
<h2>View user</h2>
<ul>
<li>
<a href="/users/fiona" rel="http://example.com/relations/user"
>Fiona Bennett</a
>
</li>
</ul>
Return <a href="/">Home</a>
</body>
</body>
</html>
4 changes: 4 additions & 0 deletions nitpick-style.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[nitpick.styles]
include = [
"py://nitpick/resources/python/pre-commit-hooks",
]