Skip to content

Commit

Permalink
Initial version.
Browse files Browse the repository at this point in the history
  • Loading branch information
fladi committed Dec 31, 2016
0 parents commit ea1ddc7
Show file tree
Hide file tree
Showing 34 changed files with 881 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[bumpversion]
current_version = 0.0.0
commit = True
tag = True

[bumpversion:file:setup.py]

[bumpversion:file:docs/conf.py]

[bumpversion:file:src/django_static_push/__init__.py]

14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[paths]
source =
src/django_static_push
*/site-packages/django_static_push

[run]
branch = True
source = django-static-push
parallel = true

[report]
show_missing = true
precision = 2
omit = *migrations*
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# see http://editorconfig.org
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8

[*.{bat,cmd,ps1}]
end_of_line = crlf
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
venv*/
pyvenv*/

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
.coverage.*
nosetests.xml
coverage.xml
htmlcov

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
*.iml
*.komodoproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

.DS_Store
*~
.*.sw[po]
.build
.ve
.env
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
language: python
python: '3.5'
sudo: false
env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
matrix:
- TOXENV=check
- TOXENV=docs

- TOXENV=py34,codecov
- TOXENV=py35,codecov
- TOXENV=pypy,codecov
before_install:
- python --version
- uname -a
- lsb_release -a
install:
- pip install tox
- virtualenv --version
- easy_install --version
- pip --version
- tox --version
script:
- tox -v
after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
notifications:
email:
on_success: never
on_failure: always
5 changes: 5 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Authors
=======

* Michael Fladischer - https://openservices.at
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Changelog
=========

0.1.0 (2016-01-29)
-----------------------------------------

* First release on PyPI.
90 changes: 90 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
============
Contributing
============

Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

Bug reports
===========

When `reporting a bug <https://github.com/fladi/django-static-push/issues>`_ please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

Documentation improvements
==========================

django-static-push could always use more documentation, whether as part of the
official django-static-push docs, in docstrings, or even on the web in blog posts,
articles, and such.

Feature requests and feedback
=============================

The best way to send feedback is to file an issue at https://github.com/fladi/django-static-push/issues.

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that code contributions are welcome :)

Development
===========

To set up `django-static-push` for local development:

1. Fork `django-static-push <https://github.com/fladi/django-static-push>`_
(look for the "Fork" button).
2. Clone your fork locally::

git clone [email protected]:your_name_here/django-static-push.git

3. Create a branch for local development::

git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.

4. When you're done making changes, run all the checks, doc builder and spell checker with `tox <http://tox.readthedocs.io/en/latest/install.html>`_ one command::

tox

5. Commit your changes and push your branch to GitHub::

git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature

6. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------

If you need some code review or feedback while you're developing the code just make the pull request.

For merging, you should:

1. Include passing tests (run ``tox``) [1]_.
2. Update documentation when there's new API, functionality etc.
3. Add a note to ``CHANGELOG.rst`` about the changes.
4. Add yourself to ``AUTHORS.rst``.

.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will
`run the tests <https://travis-ci.org/fladi/django-static-push/pull_requests>`_ for each change you add in the pull request.
It will be slower though ...
Tips
----

To run a subset of tests::

tox -e envname -- py.test -k test_myfeature

To run all the test environments in *parallel* (you need to ``pip install detox``)::

detox
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2016, Michael Fladischer
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 changes: 18 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
graft docs
graft src
graft tests

include .bumpversion.cfg
include .coveragerc
include .editorconfig

include AUTHORS.rst
include CHANGELOG.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst

include tox.ini .travis.yml
include manage.py

global-exclude *.py[cod] __pycache__ *.so *.dylib
108 changes: 108 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
========
Overview
========

.. start-badges
.. list-table::
:stub-columns: 1

* - docs
- |docs|
* - tests
- | |travis| |requires|
| |codecov|
* - package
- |version| |downloads| |wheel| |supported-versions| |supported-implementations|

.. |docs| image:: https://readthedocs.org/projects/django-static-push/badge/?style=flat
:target: https://readthedocs.org/projects/django-static-push
:alt: Documentation Status

.. |travis| image:: https://travis-ci.org/fladi/django-static-push.svg?branch=master
:alt: Travis-CI Build Status
:target: https://travis-ci.org/fladi/django-static-push

.. |requires| image:: https://requires.io/github/fladi/django-static-push/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/fladi/django-static-push/requirements/?branch=master

.. |codecov| image:: https://codecov.io/github/fladi/django-static-push/coverage.svg?branch=master
:alt: Coverage Status
:target: https://codecov.io/github/fladi/django-static-push

.. |version| image:: https://img.shields.io/pypi/v/django-static-push.svg?style=flat
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/django-static-push

.. |downloads| image:: https://img.shields.io/pypi/dm/django-static-push.svg?style=flat
:alt: PyPI Package monthly downloads
:target: https://pypi.python.org/pypi/django-static-push

.. |wheel| image:: https://img.shields.io/pypi/wheel/django-static-push.svg?style=flat
:alt: PyPI Wheel
:target: https://pypi.python.org/pypi/django-static-push

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/django-static-push.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/django-static-push

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/django-static-push.svg?style=flat
:alt: Supported implementations
:target: https://pypi.python.org/pypi/django-static-push


.. end-badges
Middleware and templatetag for Django to utilize HTTP/2 push for assets included in a Django template. The
middleware injects a `Link` header in each response if there are files to be pushed to the client. All files in the
template which are suitable for HTTP/2 push should be included with the ``staticpush`` templatetag instead of the
vanilla ``static`` templatetag. The former simply augments the later and registers the resulting static URL with the
middleware.

This package currently supports Apache2 webservers with ``mod_http2`` enabled, as the actual HTTP/2 push is offloaded to the
webserver.

.. warning::

This is ALPHA code. Do not use in production! It only serves as a proof-of-concept for now.

Conditional HTTP/2 push is not supported yet. This means that your site will actually perform worse than
over HTTP/1.1 because each response will trigger a push of all incldued assets, irrespective of any cache on the
webbrowser.

Installation
============

::

pip install django-static-push

Documentation
=============

https://django-static-push.readthedocs.org/

Development
===========

To run the all tests run::

tox

Note, to combine the coverage data from all the tox environments run:

.. list-table::
:widths: 10 90
:stub-columns: 1

- - Windows
- ::

set PYTEST_ADDOPTS=--cov-append
tox

- - Other
- ::

PYTEST_ADDOPTS=--cov-append tox
1 change: 1 addition & 0 deletions docs/authors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../AUTHORS.rst
Loading

0 comments on commit ea1ddc7

Please sign in to comment.