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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
container: python:3.10-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Build package
run: python3 setup.py bdist_wheel sdist
- name: Publish package
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
branches: ["*"]
paths-ignore:
- 'docs/**'
- 'setup.*'
- '*.md'
- '*.rst'
- '.readthedocs.yaml'
- 'LICENSE'
tags-ignore: ["*"]
pull_request:
jobs:
Expand All @@ -15,30 +15,36 @@ jobs:
timeout-minutes: 3
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.9", "3.10", "3.11"]
container:
image: python:${{ matrix.python }}-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install testing dependencies
run: pip3 --no-cache-dir install -e '.[sentry]' -r requires/testing.txt
- name: Create environment
run: |
pip install hatch
hatch dep show requirements --all >requirements.txt
pip install -r requirements.txt
pip install .

- name: Run flake8 tests
run: flake8
- name: Lint
run: |
flake8 docs sprockets examples.py tests.py
yapf -dr docs sprockets examples.py tests.py

- name: Run tests
run: coverage run
- name: Test
run: coverage run -m pytest tests.py

- name: Output coverage
run: coverage report && coverage xml

- name: Upload Coverage
uses: codecov/codecov-action@v1.0.2
uses: codecov/codecov-action@v3
if: github.event_name == 'push' && github.repository == 'sprockets/sprockets.http'
with:
token: ${{secrets.CODECOV_TOKEN}}
file: build/coverage.xml
files: coverage.xml
flags: unittests
fail_ci_if_error: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ env
*.egg-info
.coverage
/coverage.xml
!.pre-commit-config.yaml
!.github
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/google/yapf
rev: v0.40.1
hooks:
- id: yapf
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-isort
- flake8-pyproject
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2020 AWeber Communications
Copyright (c) 2015-2023 AWeber Communications
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sprockets.http
==============

|Version| |ReadTheDocs| |Travis| |Coverage|
|Version| |ReadTheDocs| |GitHub| |Coverage|

The goal of this library is to make it a little easier to develop great
HTTP API services using the Tornado web framework. It concentrates on
Expand Down Expand Up @@ -256,7 +256,8 @@ for choosing the appropriate response format and sending the error response.
:target: https://codecov.io/github/sprockets/sprockets.http
.. |ReadTheDocs| image:: http://readthedocs.org/projects/sprocketshttp/badge/?version=master
:target: https://sprocketshttp.readthedocs.io/
.. |Travis| image:: https://travis-ci.org/sprockets/sprockets.http.svg
:target: https://travis-ci.org/sprockets/sprockets.http
.. |GitHub| image:: https://img.shields.io/github/actions/workflow/status/sprockets/sprockets.http/testing.yaml
:alt: GitHub Workflow Status (with event)
:target: https://github.com/sprockets/sprockets.http/actions/workflows/testing.yaml
.. |Version| image:: https://badge.fury.io/py/sprockets.http.svg
:target: https://pypi.python.org/pypi/sprockets.http/
7 changes: 0 additions & 7 deletions docs/_static/custom.css

This file was deleted.

33 changes: 18 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
version = sprockets.http.__version__
release = '.'.join(str(v) for v in sprockets.http.version_info[0:2])

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode'
]
extensions = []
html_theme = 'python_docs_theme'
html_static_path = ['.']
html_css_files = ['custom.css']

master_doc = 'index'
html_theme_options = {
'github_user': 'sprockets',
'github_repo': 'sprockets.http',
'description': 'Tornado application runner',
'github_banner': True,
}
html_static_path = ['_static']
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
extensions.append('sphinx.ext.autodoc')

# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
extensions.append('sphinx.ext.intersphinx')
intersphinx_mapping = {
'python': ('http://docs.python.org/3/', None),
'tornado': ('http://tornadoweb.org/en/latest/', None),
'python': ('https://docs.python.org/3/', None),
'tornado': ('https://www.tornadoweb.org/en/latest/', None),
}

# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
extensions.append('sphinx.ext.extlinks')
extlinks = {
'compare':
("https://github.com/sprockets/sprockets.http/compare/%s", "%s"),
'issue': ("https://github.com/sprockets/sprockets.http/issues/%s", "#%s"),
}
61 changes: 50 additions & 11 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,61 @@ Do you want to contribute fixes or improvements?

**AWesome!** *Thank you very much, and let's get started.*

Quickstart Development Guide
----------------------------
This project uses hatch_ for project automation and pre-commit_ to ensure that your
changes aren't going to be rejected for formatting or style reasons. However, you do
need to install both utilities. You should install it using a specific python version
as a "user" installation.::

Setup
+++++
python3.10 -m pip install --user hatch pre-commit

code::
This will install the utility into ``~/.local/bin`` which you may need to add to
your ``PATH`` environment variable.

python3.10 -m venv env
pip install -r requires/development.txt
.. note::

You are not required to use ``hatch`` or ``pre-commit`` to contribute to this
project. Using them will make your life a little easier though. The following
sections contain instructions for using a completely vanilla Python virtual
environment which can be adapted to your workflow.

Testing
+++++++
-------
The simplest way to run the tests with coverage is from within a hatch-spawned shell::

code::
$ hatch shell
(sprockets-http)$ coverage run -m pytest tests.py
(sprockets-http)$ coverage report

coverage run
coverage report
You can also run the same commands without using an interactive hatch spawned shell::

$ hatch run coverage run -m pytest tests.py
$ hatch run coverage report

Finally, you can simply extract the development requirements using hatch and use a
vanilla virtual environment::

$ python3.11 -m venv --upgrade-deps env
$ . ./env/bin/activate
(env) $ pip install hatch
(env) $ hatch dep show requirements --all >requirements.txt
(env) $ pip install -r requirements.txt
(env) $ coverage run -m pytest tests.py
(env) $ coverage report

Linting
-------
Lint checking is off-loaded to the pre-commit_ utility. After installing the hooks,
any commit is blocked by style checks. You can also run the hooks manually using the
pre-commit_ utility.
::

$ pre-commit install --install-hooks
$ pre-commit run --all-files

Of course, you can run ``flake8`` and ``yapf`` manually inside of a vanilla environment::

(env) $ flake8 docs sprockets examples.py tests.py
(env) $ yapf -dr docs sprockets examples.py tests.py

.. _hatch: https://hatch.pypa.io/latest/
.. _pre-commit: https://pre-commit.com/
1 change: 1 addition & 0 deletions docs/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
div.sphinxsidebarwrapper { overflow-x: scroll }
Loading