pax_global_header 0000666 0000000 0000000 00000000064 14176331465 0014524 g ustar 00root root 0000000 0000000 52 comment=90f5a001b37c96a6e288bf008fbfc5f71b195625
django-sekizai-3.0.1/ 0000775 0000000 0000000 00000000000 14176331465 0014424 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/.coveragerc 0000664 0000000 0000000 00000000447 14176331465 0016552 0 ustar 00root root 0000000 0000000 [run]
branch = True
source = sekizai
omit =
migrations/*
tests/*
[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
ignore_errors = True
django-sekizai-3.0.1/.editorconfig 0000664 0000000 0000000 00000000652 14176331465 0017104 0 ustar 00root root 0000000 0000000 # editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
[*.py]
max_line_length = 120
quote_type = single
[*.{scss,js,html}]
max_line_length = 120
indent_style = space
quote_type = double
[*.js]
max_line_length = 120
quote_type = single
[*.rst]
max_line_length = 80
[*.yml]
indent_size = 2
django-sekizai-3.0.1/.github/ 0000775 0000000 0000000 00000000000 14176331465 0015764 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/.github/workflows/ 0000775 0000000 0000000 00000000000 14176331465 0020021 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000002112 14176331465 0023630 0 ustar 00root root 0000000 0000000 name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '41 7 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
# âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
django-sekizai-3.0.1/.github/workflows/docs.yml 0000664 0000000 0000000 00000000717 14176331465 0021501 0 ustar 00root root 0000000 0000000 name: Docs
on: [push, pull_request]
jobs:
docs:
runs-on: ubuntu-latest
name: docs
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- run: python -m pip install -r docs/requirements.txt
- name: Build docs
run: |
cd docs
sphinx-build -b dirhtml -n -d build/doctrees . build/dirhtml
django-sekizai-3.0.1/.github/workflows/lint.yml 0000664 0000000 0000000 00000001565 14176331465 0021521 0 ustar 00root root 0000000 0000000 name: Lint
on: [push, pull_request]
jobs:
flake8:
name: flake8
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install flake8
run: pip install --upgrade flake8
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v1
with:
linters: flake8
run: flake8
isort:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- run: python -m pip install isort
- name: isort
uses: liskin/gh-problem-matcher-wrap@v1
with:
linters: isort
run: isort -c -rc -df sekizai
django-sekizai-3.0.1/.github/workflows/publish-to-live-pypi.yml 0000664 0000000 0000000 00000001551 14176331465 0024550 0 ustar 00root root 0000000 0000000 name: Publish Python đ distributions đĻ to pypi
on:
release:
types:
- published
jobs:
build-n-publish:
name: Build and publish Python đ distributions đĻ to pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution đĻ to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
django-sekizai-3.0.1/.github/workflows/publish-to-test-pypi.yml 0000664 0000000 0000000 00000001634 14176331465 0024572 0 ustar 00root root 0000000 0000000 name: Publish Python đ distributions đĻ to TestPyPI
on:
push:
branches:
- master
jobs:
build-n-publish:
name: Build and publish Python đ distributions đĻ to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution đĻ to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
django-sekizai-3.0.1/.github/workflows/test.yml 0000664 0000000 0000000 00000001611 14176331465 0021522 0 ustar 00root root 0000000 0000000 name: CodeCov tests
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10"]
requirements-file: [
django-2.2.txt,
django-3.1.txt,
django-3.2.txt
]
os: [
ubuntu-20.04,
]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements/${{ matrix.requirements-file }}
python setup.py install
- name: Run coverage
run: coverage run setup.py test
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
django-sekizai-3.0.1/.gitignore 0000664 0000000 0000000 00000000265 14176331465 0016417 0 ustar 00root root 0000000 0000000 *.py[cod]
*$py.class
*.egg-info
*.log
*.pot
.DS_Store
.coverage
.eggs/
.idea/
.project/
.pydevproject/
.vscode/
.settings/
.tox/
__pycache__/
build/
dist/
env/
.venv/
local.sqlite
django-sekizai-3.0.1/.pre-commit-config.yaml 0000664 0000000 0000000 00000001273 14176331465 0020710 0 ustar 00root root 0000000 0000000 repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.4.0'
hooks:
- id: django-upgrade
args: [--target-version, "2.2"]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
hooks:
- id: yesqa
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-merge-conflict
- id: mixed-line-ending
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
django-sekizai-3.0.1/CHANGELOG.rst 0000664 0000000 0000000 00000002034 14176331465 0016444 0 ustar 00root root 0000000 0000000 =========
Changelog
=========
unreleased
==========
3.0.1 2022-02-01
================
* Fix for tests in sdist tarball [#115]
3.0.0 2022-01-22
================
* Added support for Django 3.2
* Drop support for python 3.5 and 3.6
2.0.0 (2020-08-26)
==================
* Added support for Django 3.1
* Dropped support for Python 2.7 and Python 3.4
* Dropped support for Django < 2.2
* Replaced pep8 with flake8
* Adapted documentation
1.1.0 (2020-01-22)
==================
* Added support for Django 3.0
* Added support for Python 3.8
* Extended test matrix
* Added isort and adapted imports
* Adapted code base to align with other supported addons
* Adapted ``README.rst`` instructions
1.0.0 (2019-04-11)
==================
* Added support for Django 1.11, 2.0, 2.1, and 2.2
* Removed support for Django < 1.11
0.10.0 (2016-08-28)
===================
* Added support for Django 1.10
* Removed support for Python 2.6
0.9.0 (2015-12-06)
==================
* Added Changelog
* Added support for Django 1.9
* Added support for Python 3.5
django-sekizai-3.0.1/LICENSE 0000664 0000000 0000000 00000002716 14176331465 0015437 0 ustar 00root root 0000000 0000000 Copyright (c) 2010, Jonas Obrist
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Jonas Obrist nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
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 JONAS OBRIST 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. django-sekizai-3.0.1/MANIFEST.in 0000664 0000000 0000000 00000000232 14176331465 0016157 0 ustar 00root root 0000000 0000000 include LICENSE
include README.rst
recursive-exclude * *.py[co]
recursive-include tests *.html
recursive-include tests *.py
recursive-include tests *.txt
django-sekizai-3.0.1/README.rst 0000664 0000000 0000000 00000006270 14176331465 0016120 0 ustar 00root root 0000000 0000000 ==============
Django Sekizai
==============
|pypi| |build| |coverage|
Sekizai means "blocks" in Japanese, and that's what this app provides. A fresh
look at blocks. With django-sekizai you can define placeholders where your
blocks get rendered and at different places in your templates append to those
blocks. This is especially useful for css and javascript. Your sub-templates can
now define css and Javascript files to be included, and the css will be nicely
put at the top and the Javascript to the bottom, just like you should. Also
sekizai will ignore any duplicate content in a single block.
There are some issue/restrictions with this implementation due to how the
django template language works, but if used properly it can be very useful and
it is the media handling framework for the django CMS (since version 2.2).
.. note::
This project is endorsed by the `django CMS Association `_.
That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.
Join us on `Slack `_.
*******************************************
Contribute to this project and win rewards
*******************************************
Because this is a an open-source project, we welcome everyone to
`get involved in the project `_ and
`receive a reward `_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.
We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
pull request, please review our `contribution guidelines
`_.
We're grateful to all contributors who have helped create and maintain this package.
Contributors are listed at the `contributors `_
section.
Documentation
=============
See ``REQUIREMENTS`` in the `setup.py `_
file for additional dependencies:
|python| |django|
Please refer to the documentation in the docs/ directory for more information or visit our
`online documentation `_.
Running Tests
-------------
You can run tests by executing::
virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test
.. |pypi| image:: https://badge.fury.io/py/django-sekizai.svg
:target: http://badge.fury.io/py/django-sekizai
.. |build| image:: https://travis-ci.org/divio/django-sekizai.svg?branch=master
:target: https://travis-ci.org/divio/django-sekizai
.. |coverage| image:: https://codecov.io/gh/divio/django-sekizai/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/django-sekizai
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
:target: https://pypi.org/project/django-sekizai/
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
:target: https://www.djangoproject.com/
django-sekizai-3.0.1/docs/ 0000775 0000000 0000000 00000000000 14176331465 0015354 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/docs/Makefile 0000664 0000000 0000000 00000006106 14176331465 0017017 0 ustar 00root root 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-sekizai.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-sekizai.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
django-sekizai-3.0.1/docs/conf.py 0000664 0000000 0000000 00000014215 14176331465 0016656 0 ustar 00root root 0000000 0000000 #
# django-sekizai documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 29 23:12:20 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'django-sekizai'
copyright = '2010, Jonas Obrist'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.6'
# The full version, including alpha/beta/rc tags.
release = '0.6.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'django-sekizaidoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-sekizai.tex', 'django-sekizai Documentation',
'Jonas Obrist', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
django-sekizai-3.0.1/docs/index.rst 0000664 0000000 0000000 00000031413 14176331465 0017217 0 ustar 00root root 0000000 0000000 .. django-sekizai documentation master file, created by
sphinx-quickstart on Tue Jun 29 23:12:20 2010.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
##########################################
Welcome to django-sekizai's documentation!
##########################################
.. note::
If you get an error when using django-sekizai that starts with
**Invalid block tag:**, please read :ref:`restrictions`.
*****
About
*****
Sekizai means "blocks" in Japanese, and that's what this app provides. A fresh
look at blocks. With django-sekizai you can define placeholders where your
blocks get rendered and at different places in your templates append to those
blocks. This is especially useful for css and javascript. Your sub-templates can
now define css and Javascript files to be included, and the css will be nicely
put at the top and the Javascript to the bottom, just like you should. Also
sekizai will ignore any duplicate content in a single block.
*****
Usage
*****
Configuration
=============
In order to get started with django-sekizai, you'll need to do the following
steps:
* Put 'sekizai' into your ``INSTALLED_APPS`` setting.
* Add ``sekizai.context_processors.sekizai`` to your
``TEMPLATES['OPTIONS']['context_processors']`` setting and use
``django.template.RequestContext`` when rendering your templates.
Template Tag Reference
======================
.. highlight:: html+django
.. note:: All sekizai template tags require the ``sekizai_tags`` template tag
library to be loaded.
Handling code snippets
----------------------
.. versionadded:: 0.7
The ``strip`` flag was added.
Sekizai uses ``render_block`` and ``addtoblock`` to handle unique code snippets.
Define your blocks using ``{% render_block %}`` and add data to that
block using ``{% addtoblock [strip] %}...{% endaddtoblock %}``. If the
strip flag is set, leading and trailing whitespace will be removed.
Example Template::
{% load sekizai_tags %}
{% block css %}{% endblock %}
{% render_block "css" %}
Your content comes here.
Maybe you want to throw in some css:
{% addtoblock "css" %}
{% endaddtoblock %}
Some more content here.
{% addtoblock "js" %}
{% endaddtoblock %}
And even more content.
{% block js %}{% endblock %}
{% render_block "js" %}
Above example would roughly render like this::
Your content comes here.
Maybe you want to throw in some css:
Some more content here.
And even more content.
.. note::
It's recommended to have all ``render_block`` tags in your base template, the one that gets extended by all your
other templates.
.. _restrictions:
Restrictions
------------
.. warning::
``{% render_block %}`` tags **must not** be placed inside a template tag block (a template tag which has an
end tag, such as ``{% block %}...{% endblock %}`` or ``{% if %}...{% endif %}``).
.. warning::
``{% render_block %}`` tags **must not** be in an included template!
.. warning::
If the ``{% addtoblock %}`` tag is used in an **extending** template, the tags **must** be
placed within ``{% block %}...{% endblock %}`` tags. If this block extension, where ``{% addtoblock %}``
lies, is actually overridden in a child template (i.e by a same-name block which doesn't call ``block.super``),
then this ``{% addtoblock %}`` will be ignored.
.. warning::
``{% addtoblock %}`` tags **must not** be used in a template included with ``only`` option!
Handling data
-------------
Sometimes you might not want to use code snippets but rather just add a value to
a list. For this purpose there are the
``{% with_data as %}...{% end_with_data %}`` and
``{% add_data %}`` template tags.
Example::
{% load sekizai_tags %}
{% with_data "css-data" as stylesheets %}
{% for stylesheet in stylesheets %}
{% endfor %}
{% end_with_data %}
Your content comes here.
Maybe you want to throw in some css:
{% add_data "css-data" "css/stylesheet.css" %}
Some more content here.
Above example would roughly render like this::
Your content comes here.
Maybe you want to throw in some css:
Some more content here.
And even more content.
.. warning::
The restrictions for ``{% render_block %}`` also apply to ``{% with_data %}``, see above.
The restrictions for ``{% addtoblock %}`` also apply to ``{% add_data %}``, see above.
Sekizai data is unique
----------------------
All data in sekizai is enforced to be unique within its block namespace. This
is because the main purpose of sekizai is to handle javascript and css
dependencies in templates.
A simple example using ``addtoblock`` and ``render_block`` would be::
{% load sekizai_tags %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% render_block "js" %}
Above template would roughly render to::
.. versionadded:: 0.5
Processing sekizai data
-----------------------
Because of the restrictions of the ``{% render_block %}`` tag, it is not possible
to use sekizai with libraries such as django-compressor directly. For that
reason, sekizai added postprocessing capabilities to ``render_block`` in
version 0.5.
Postprocessors are callable Python objects (usually functions) that get the
render context, the data in a sekizai namespace and the name of the namespace
passed as arguments and should return a string.
An example for a processor that uses the Django builtin spaceless functionality
would be:
.. code-block:: python
def spaceless_post_processor(context, data, namespace):
from django.utils.html import strip_spaces_between_tags
return strip_spaces_between_tags(data)
To use this post processor you have to tell ``render_block`` where it's
located. If above code sample lives in the Python module
``myapp.sekizai_processors`` you could use it like this::
...
{% render_block "js" postprocessor "myapp.sekizai_processors.spaceless_post_processor" %}
...
It's also possible to pre-process data in ``{% addtoblock %}`` like this::
{% addtoblock "css" preprocessor "myapp.sekizai_processors.processor" %}
*******
Helpers
*******
:mod:`sekizai.helpers`
======================
.. function:: get_namespaces(template)
Returns a list of all sekizai namespaces found in ``template``, which should
be the name of a template. This method also checks extended templates.
.. function:: validate_template(template, namespaces)
Returns ``True`` if all namespaces given are found in the template given.
Useful to check that the namespaces required by your application are
available, so you can failfast if they're not.
*******
Example
*******
.. highlight:: html+django
A full example on how to use django-sekizai and when.
Let's assume you have a website, where all templates extend base.html, which
just contains your basic HTML structure. Now you also have a small template
which gets included on some pages. This template needs to load a javascript
library and execute some specific javascript code.
Your ``base.html`` might look like this::
{% load sekizai_tags %}
Your website
{% render_block "css" %}
{% block "content" %}
{% endblock %}
{% render_block "js" %}
As you can see, we load ``sekizai_tags`` at the very beginning. We have two
sekizai namespaces: "css" and "js". The "css" namespace is rendered in the head
right after the base css files, the "js" namespace is rendered at the very
bottom of the body, right after we load jQuery.
Now to our included template. We assume there's a context variable called
``userid`` which will be used with the javascript code.
Your template (``inc.html``) might look like this::
{% load sekizai_tags %}
{% addtoblock "js" %}
{% endaddtoblock %}
{% addtoblock "js" %}
{% endaddtoblock %}
The important thing to notice here is that we split the javascript into two
``addtoblock`` blocks. Like this, the library 'mylib.js' is only included once,
and the userid specific code will be included once per userid.
Now to put it all together let's assume we render a third template with
``[1, 2, 3]`` as ``my_userids`` variable.
The third template looks like this::
{% extends "base.html" %}
{% block "content" %}
{% for userid in my_userids %}
{% include "inc.html" %}
{% endfor %}
{% endblock %}
And here's the rendered template::
Your website
*********
Changelog
*********
See `CHANGELOG.rst `_ for a full list.
django-sekizai-3.0.1/docs/requirements.txt 0000664 0000000 0000000 00000000210 14176331465 0020631 0 ustar 00root root 0000000 0000000 django<3.3
MarkupSafe
Pygments
restructuredtext_lint
sphinx
sphinxcontrib-spelling
sphinx-autobuild
sphinxcontrib-inlinesyntaxhighlight
django-sekizai-3.0.1/requirements.in 0000664 0000000 0000000 00000000111 14176331465 0017470 0 ustar 00root root 0000000 0000000 bump2version
Django>2.2
django-classy-tags>=1
pip-tools
pre-commit
wheel
django-sekizai-3.0.1/requirements.txt 0000664 0000000 0000000 00000002211 14176331465 0017704 0 ustar 00root root 0000000 0000000 #
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile
#
--trusted-host pypi.python.org
--trusted-host pypi.org
--trusted-host files.pythonhosted.org
asgiref==3.4.1
# via django
bump2version==1.0.1
# via -r requirements.in
cfgv==3.3.1
# via pre-commit
click==8.0.3
# via pip-tools
distlib==0.3.4
# via virtualenv
django==4.0.1
# via
# -r requirements.in
# django-classy-tags
django-classy-tags==2.0.0
# via -r requirements.in
filelock==3.4.2
# via virtualenv
identify==2.4.4
# via pre-commit
nodeenv==1.6.0
# via pre-commit
pep517==0.12.0
# via pip-tools
pip-tools==6.4.0
# via -r requirements.in
platformdirs==2.4.1
# via virtualenv
pre-commit==2.17.0
# via -r requirements.in
pyyaml==6.0
# via pre-commit
six==1.16.0
# via virtualenv
sqlparse==0.4.2
# via django
toml==0.10.2
# via pre-commit
tomli==2.0.0
# via pep517
virtualenv==20.13.0
# via pre-commit
wheel==0.37.1
# via
# -r requirements.in
# pip-tools
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
django-sekizai-3.0.1/sekizai/ 0000775 0000000 0000000 00000000000 14176331465 0016063 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/sekizai/__init__.py 0000664 0000000 0000000 00000000026 14176331465 0020172 0 ustar 00root root 0000000 0000000 __version__ = '3.0.1'
django-sekizai-3.0.1/sekizai/context.py 0000664 0000000 0000000 00000000544 14176331465 0020124 0 ustar 00root root 0000000 0000000 from django.template import Context
from sekizai.context_processors import sekizai
class SekizaiContext(Context):
"""
An alternative context to be used instead of RequestContext in places where
no request is available.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.update(sekizai())
django-sekizai-3.0.1/sekizai/context_processors.py 0000664 0000000 0000000 00000000506 14176331465 0022404 0 ustar 00root root 0000000 0000000 from collections import defaultdict
from sekizai.data import UniqueSequence
from sekizai.helpers import get_varname
def sekizai(request=None):
"""
Simple context processor which makes sure that the SekizaiDictionary is
available in all templates.
"""
return {get_varname(): defaultdict(UniqueSequence)}
django-sekizai-3.0.1/sekizai/context_processors.pyi 0000664 0000000 0000000 00000000300 14176331465 0022545 0 ustar 00root root 0000000 0000000 from typing import Dict, Union
from django.http import HttpRequest
from sekizai.data import UniqueSequence
def sekizai(request: Union[None, HttpRequest]) -> Dict[str, UniqueSequence]: ...
django-sekizai-3.0.1/sekizai/data.py 0000664 0000000 0000000 00000001150 14176331465 0017343 0 ustar 00root root 0000000 0000000 from collections.abc import MutableSequence
class UniqueSequence(MutableSequence):
def __init__(self):
self.data = []
def __contains__(self, item):
return item in self.data
def __iter__(self):
return iter(self.data)
def __getitem__(self, item):
return self.data[item]
def __setitem__(self, key, value):
self.data[key] = value
def __delitem__(self, key):
del self.data[key]
def __len__(self):
return len(self.data)
def insert(self, index, value):
if value not in self:
self.data.insert(index, value)
django-sekizai-3.0.1/sekizai/helpers.py 0000664 0000000 0000000 00000012377 14176331465 0020111 0 ustar 00root root 0000000 0000000 from django.conf import settings
from django.template.base import Template, Variable, VariableNode
from django.template.context import Context
from django.template.loader import get_template
from django.template.loader_tags import BlockNode, ExtendsNode
def _get_nodelist(tpl):
if isinstance(tpl, Template):
return tpl.nodelist
else:
return tpl.template.nodelist
def is_variable_extend_node(node):
if hasattr(node, 'parent_name_expr') and node.parent_name_expr:
return True
if hasattr(node, 'parent_name') and hasattr(node.parent_name, 'filters'):
if (node.parent_name.filters or
isinstance(node.parent_name.var, Variable)):
return True
return False
def get_context():
context = Context()
context.template = Template('')
return context
def _extend_blocks(extend_node, blocks):
"""
Extends the dictionary `blocks` with *new* blocks in the parent node
(recursive)
"""
# we don't support variable extensions
if is_variable_extend_node(extend_node):
return
parent = extend_node.get_parent(get_context())
# Search for new blocks
for node in _get_nodelist(parent).get_nodes_by_type(BlockNode):
if node.name not in blocks:
blocks[node.name] = node
else:
# set this node as the super node (for {{ block.super }})
block = blocks[node.name]
seen_supers = []
while (hasattr(block.super, 'nodelist') and
block.super not in seen_supers):
seen_supers.append(block.super)
block = block.super
block.super = node
# search for further ExtendsNodes
for node in _get_nodelist(parent).get_nodes_by_type(ExtendsNode):
_extend_blocks(node, blocks)
break
def _extend_nodelist(extend_node):
"""
Returns a list of namespaces found in the parent template(s) of this
ExtendsNode
"""
# we don't support variable extensions (1.3 way)
if is_variable_extend_node(extend_node):
return []
blocks = extend_node.blocks
_extend_blocks(extend_node, blocks)
found = []
for block in blocks.values():
found += _scan_namespaces(block.nodelist, block)
parent_template = extend_node.get_parent(get_context())
# if this is the topmost template, check for namespaces outside of blocks
if not _get_nodelist(parent_template).get_nodes_by_type(ExtendsNode):
found += _scan_namespaces(
_get_nodelist(parent_template),
None
)
else:
found += _scan_namespaces(
_get_nodelist(parent_template),
extend_node
)
return found
def _scan_namespaces(nodelist, current_block=None):
from sekizai.templatetags.sekizai_tags import RenderBlock
found = []
for node in nodelist:
# check if this is RenderBlock node
if isinstance(node, RenderBlock):
# resolve it's name against a dummy context
found.append(node.kwargs['name'].resolve({}))
found += _scan_namespaces(node.blocks['nodelist'], node)
# handle {% extends ... %} tags if check_inheritance is True
elif isinstance(node, ExtendsNode):
found += _extend_nodelist(node)
# in block nodes we have to scan for super blocks
elif isinstance(node, VariableNode) and current_block:
if node.filter_expression.token == 'block.super':
if hasattr(current_block.super, 'nodelist'):
found += _scan_namespaces(
current_block.super.nodelist,
current_block.super
)
return found
def get_namespaces(template):
compiled_template = get_template(template)
return _scan_namespaces(_get_nodelist(compiled_template))
def validate_template(template, namespaces):
"""
Validates that a template (or it's parents if check_inheritance is True)
contain all given namespaces
"""
if getattr(settings, 'SEKIZAI_IGNORE_VALIDATION', False):
return True
found = get_namespaces(template)
for namespace in namespaces:
if namespace not in found:
return False
return True
def get_varname():
return getattr(settings, 'SEKIZAI_VARNAME', 'SEKIZAI_CONTENT_HOLDER')
class Watcher:
"""
Watches a context for changes to the sekizai data, so it can be replayed
later. This is useful for caching.
NOTE: This class assumes you ONLY ADD, NEVER REMOVE data from the context!
"""
def __init__(self, context):
self.context = context
self.frozen = {
key: list(value) for key, value in self.data.items()
}
@property
def data(self):
return self.context.get(get_varname(), {})
def get_changes(self):
sfrozen = set(self.frozen)
sdata = set(self.data)
new_keys = sfrozen ^ sdata
changes = {}
for key in new_keys:
changes[key] = list(self.data[key])
shared_keys = sfrozen & sdata
for key in shared_keys:
old_set = set(self.frozen[key])
new_values = [
item for item in self.data[key] if item not in old_set
]
changes[key] = new_values
return changes
django-sekizai-3.0.1/sekizai/helpers.pyi 0000664 0000000 0000000 00000001462 14176331465 0020253 0 ustar 00root root 0000000 0000000 from typing import Dict, List, Union
from django.template.base import Node, NodeList, Template
from django.template.context import Context
def _get_nodelist(tpl: Template) -> NodeList: ...
def is_variable_extend_node(node: Node) -> bool: ...
def get_context() -> Context: ...
def _extend_blocks(extend_node: Node, blocks: Dict[str, Node]): ...
def _extend_nodelist(extend_node: Node) -> List[str]: ...
def _scan_namespaces(nodelist: NodeList, current_block: Union[None, Node]) -> List[str]: ...
def get_namespaces(template: str) -> List[str]: ...
def validate_template(template: str, namespaces: List[str]) -> bool: ...
def get_varname() -> str: ...
class Watcher:
def __init__(self, context: Context) -> None: ...
@property
def data(self) -> dict: ...
def get_changes(self) -> dict: ...
django-sekizai-3.0.1/sekizai/models.py 0000664 0000000 0000000 00000000000 14176331465 0017706 0 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/sekizai/templatetags/ 0000775 0000000 0000000 00000000000 14176331465 0020555 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/sekizai/templatetags/__init__.py 0000664 0000000 0000000 00000000000 14176331465 0022654 0 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/sekizai/templatetags/sekizai_tags.py 0000664 0000000 0000000 00000010646 14176331465 0023613 0 ustar 00root root 0000000 0000000 from importlib import import_module
from django import template
from classytags.arguments import Argument, Flag
from classytags.core import Options, Tag
from classytags.parser import Parser
from sekizai.helpers import get_varname
register = template.Library()
def validate_context(context):
"""
Validates a given context.
Returns True if the context is valid.
Returns False if the context is invalid but the error should be silently
ignored.
Raises a TemplateSyntaxError if the context is invalid and we're in debug
mode.
"""
try:
template_debug = context.template.engine.debug
except AttributeError:
# Get the default engine debug value
template_debug = template.Engine.get_default().debug
if get_varname() in context:
return True
if not template_debug:
return False
raise template.TemplateSyntaxError(
"You must enable the 'sekizai.context_processors.sekizai' template "
"context processor or use 'sekizai.context.SekizaiContext' to "
"render your templates."
)
def import_processor(import_path):
if '.' not in import_path:
raise TypeError("Import paths must contain at least one '.'")
module_name, object_name = import_path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, object_name)
class SekizaiParser(Parser):
def parse_blocks(self):
super().parse_blocks()
self.blocks['nodelist'] = self.parser.parse()
class AddtoblockParser(Parser):
def parse_blocks(self):
name = self.kwargs['name'].var.token
self.blocks['nodelist'] = self.parser.parse(
('endaddtoblock', 'endaddtoblock %s' % name)
)
self.parser.delete_first_token()
class SekizaiTag(Tag):
def render(self, context):
if validate_context(context):
return super().render(context)
return ''
class RenderBlock(Tag):
name = 'render_block'
options = Options(
Argument('name'),
'postprocessor',
Argument('postprocessor', required=False, default=None, resolve=False),
parser_class=SekizaiParser,
)
def render_tag(self, context, name, postprocessor, nodelist):
if not validate_context(context):
return nodelist.render(context)
rendered_contents = nodelist.render(context)
varname = get_varname()
data = '\n'.join(context[varname][name])
if postprocessor:
func = import_processor(postprocessor)
data = func(context, data, name)
return f'{data}\n{rendered_contents}'
register.tag('render_block', RenderBlock)
class AddData(SekizaiTag):
name = 'add_data'
options = Options(
Argument('key'),
Argument('value'),
)
def render_tag(self, context, key, value):
varname = get_varname()
context[varname][key].append(value)
return ''
register.tag('add_data', AddData)
class WithData(SekizaiTag):
name = 'with_data'
options = Options(
Argument('name'),
'as',
Argument('variable', resolve=False),
blocks=[
('end_with_data', 'inner_nodelist'),
],
parser_class=SekizaiParser,
)
def render_tag(self, context, name, variable, inner_nodelist, nodelist):
rendered_contents = nodelist.render(context)
varname = get_varname()
data = context[varname][name]
context.push()
context[variable] = data
inner_contents = inner_nodelist.render(context)
context.pop()
return f'{inner_contents}\n{rendered_contents}'
register.tag('with_data', WithData)
class Addtoblock(SekizaiTag):
name = 'addtoblock'
options = Options(
Argument('name'),
Flag('strip', default=False, true_values=['strip']),
'preprocessor',
Argument('preprocessor', required=False, default=None, resolve=False),
parser_class=AddtoblockParser,
)
def render_tag(self, context, name, strip, preprocessor, nodelist):
rendered_contents = nodelist.render(context)
if strip:
rendered_contents = rendered_contents.strip()
if preprocessor:
func = import_processor(preprocessor)
rendered_contents = func(context, rendered_contents, name)
varname = get_varname()
context[varname][name].append(rendered_contents)
return ""
register.tag('addtoblock', Addtoblock)
django-sekizai-3.0.1/sekizai/templatetags/sekizai_tags.pyi 0000664 0000000 0000000 00000000263 14176331465 0023756 0 ustar 00root root 0000000 0000000 from types import ModuleType
from django.template import Context
def validate_context(context: Context) -> bool: ...
def import_processor(import_path: str) -> ModuleType: ...
django-sekizai-3.0.1/setup.cfg 0000664 0000000 0000000 00000001653 14176331465 0016252 0 ustar 00root root 0000000 0000000 [bumpversion]
current_version = 3.0.1
commit = True
tag = False
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:sekizai/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
[bumpversion:file:CHANGELOG.rst]
search =
unreleased
==========
replace =
unreleased
==========
{new_version} {utcnow:%%Y-%%m-%%d}
================
[flake8]
max-line-length = 119
exclude =
*.egg-info,
.eggs,
.env,
.git,
.settings,
.tox,
.venv,
build,
data,
dist,
docs/conf.py,
*migrations*,
requirements,
tmp
[isort]
line_length = 119
skip = manage.py, *migrations*, .tox, .eggs, data, .env, .venv
include_trailing_comma = true
multi_line_output = 5
lines_after_imports = 2
default_section = THIRDPARTY
sections = FUTURE, STDLIB, DJANGO, THIRDPARTY, FIRSTPARTY, LOCALFOLDER
known_first_party = sekizai
known_django = django
django-sekizai-3.0.1/setup.py 0000664 0000000 0000000 00000003313 14176331465 0016136 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
from pathlib import Path
from setuptools import find_packages, setup
REQUIREMENTS = [
'django>=2.2',
'django-classy-tags>=1',
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
]
this_directory = Path(__file__).parent
long_description = (this_directory / "README.rst").read_text()
setup(
name='django-sekizai',
version='3.0.1',
author='Jonas Obrist',
author_email='ojiidotch@gmail.com',
maintainer='Django CMS Association and contributors',
maintainer_email='info@django-cms.org',
url='https://github.com/django-cms/django-sekizai',
license='BSD-3-Clause',
description='Django Sekizai',
long_description=long_description,
long_description_content_type='text/x-rst',
packages=find_packages(exclude=['tests']),
python_requires='>=3.7',
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
classifiers=CLASSIFIERS,
test_suite='tests.settings.run',
)
django-sekizai-3.0.1/tests/ 0000775 0000000 0000000 00000000000 14176331465 0015566 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/__init__.py 0000664 0000000 0000000 00000000000 14176331465 0017665 0 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/requirements/ 0000775 0000000 0000000 00000000000 14176331465 0020311 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/requirements/base.txt 0000664 0000000 0000000 00000000051 14176331465 0021760 0 ustar 00root root 0000000 0000000 # other requirements
tox
coverage
flake8
django-sekizai-3.0.1/tests/requirements/django-2.2.txt 0000664 0000000 0000000 00000000036 14176331465 0022612 0 ustar 00root root 0000000 0000000 -r base.txt
django>=2.2,<3.0
django-sekizai-3.0.1/tests/requirements/django-3.1.txt 0000664 0000000 0000000 00000000036 14176331465 0022612 0 ustar 00root root 0000000 0000000 -r base.txt
django>=3.1,<3.2
django-sekizai-3.0.1/tests/requirements/django-3.2.txt 0000664 0000000 0000000 00000000036 14176331465 0022613 0 ustar 00root root 0000000 0000000 -r base.txt
django>=3.2,<3.3
django-sekizai-3.0.1/tests/settings.py 0000664 0000000 0000000 00000002400 14176331465 0017774 0 ustar 00root root 0000000 0000000 import os
import sys
urlpatterns = []
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
INSTALLED_APPS = [
'sekizai',
'tests',
]
ROOT_URLCONF = 'tests.settings'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(os.path.dirname(__file__), 'templates')
],
'OPTIONS': {
'context_processors': ['sekizai.context_processors.sekizai'],
'debug': True,
},
},
]
def runtests():
from django import setup
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
INSTALLED_APPS=INSTALLED_APPS,
ROOT_URLCONF=ROOT_URLCONF,
DATABASES=DATABASES,
TEST_RUNNER='django.test.runner.DiscoverRunner',
TEMPLATES=TEMPLATES,
)
setup()
# Run the test suite, including the extra validation tests.
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=False, failfast=False)
failures = test_runner.run_tests(INSTALLED_APPS)
return failures
def run():
failures = runtests()
sys.exit(failures)
if __name__ == '__main__':
run()
django-sekizai-3.0.1/tests/templates/ 0000775 0000000 0000000 00000000000 14176331465 0017564 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/templates/basic.html 0000664 0000000 0000000 00000000344 14176331465 0021534 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css" %}
some content
{% addtoblock "css" %}
my css file
{% endaddtoblock %}
more content
{% addtoblock "js" %}
my js file
{% endaddtoblock %}
final content
{% render_block "js" %}
django-sekizai-3.0.1/tests/templates/css.html 0000664 0000000 0000000 00000000241 14176331465 0021237 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css-to-file" %}
{% addtoblock "css-to-file" %}
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/css2.html 0000664 0000000 0000000 00000000404 14176331465 0021322 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css-onefile" %}
{% addtoblock "css-onefile" %}{% endaddtoblock %}
{% addtoblock "css-onefile" %}{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/easy_base.html 0000664 0000000 0000000 00000000130 14176331465 0022377 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "css" %}
{% block main %}content{% endblock %} django-sekizai-3.0.1/tests/templates/easy_inherit.html 0000664 0000000 0000000 00000000117 14176331465 0023134 0 ustar 00root root 0000000 0000000 {% extends "easy_base.html" %}
{% block main %}{{ block.super }}{% endblock %} django-sekizai-3.0.1/tests/templates/eat.html 0000664 0000000 0000000 00000000132 14176331465 0021217 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "css" %}
my css file
{% endaddtoblock %}
mycontent django-sekizai-3.0.1/tests/templates/errors/ 0000775 0000000 0000000 00000000000 14176331465 0021100 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/templates/errors/failadd.html 0000664 0000000 0000000 00000000106 14176331465 0023347 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock %}
file one
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/errors/failbase.html 0000664 0000000 0000000 00000000211 14176331465 0023526 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "js" %}
{% include "errors/failinc.html" %}
{% addtoblock "js" %}
file one
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/errors/failbase2.html 0000664 0000000 0000000 00000000211 14176331465 0023610 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% include "errors/failinc.html" %}
{% addtoblock "js" %}
file one
{% endaddtoblock %}
{% render_block "js" %} django-sekizai-3.0.1/tests/templates/errors/failinc.html 0000664 0000000 0000000 00000000112 14176331465 0023365 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "js %}
file two
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/errors/failrender.html 0000664 0000000 0000000 00000000053 14176331465 0024077 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block %} django-sekizai-3.0.1/tests/templates/inherit/ 0000775 0000000 0000000 00000000000 14176331465 0021226 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/templates/inherit/base.html 0000664 0000000 0000000 00000000520 14176331465 0023023 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
head start
{% render_block "css" %}
head end
include start
{% include "inherit/baseinc.html" %}
include end
block main start
{% block "main" %}
block main base contents
{% endblock %}
block main end
body pre-end
{% render_block "js" %}
body end
{% addtoblock "css" %}
some css file
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/inherit/baseinc.html 0000664 0000000 0000000 00000000132 14176331465 0023514 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
inc add js
{% addtoblock "js" %}
inc js file
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/inherit/chain.html 0000664 0000000 0000000 00000000151 14176331465 0023173 0 ustar 00root root 0000000 0000000 {% extends "inherit/extend.html" %}
{% block "main" %}
{{ block.super }}
{{ other_var }}
{% endblock %} django-sekizai-3.0.1/tests/templates/inherit/extend.html 0000664 0000000 0000000 00000000301 14176331465 0023375 0 ustar 00root root 0000000 0000000 {% extends "inherit/base.html" %}
{% load sekizai_tags %}
{% addtoblock "css" %}
invisible css file
{% endaddtoblock %}
{% block "main" %}
{% include "inherit/extinc.html" %}
{% endblock %} django-sekizai-3.0.1/tests/templates/inherit/extinc.html 0000664 0000000 0000000 00000000040 14176331465 0023400 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
extinc
django-sekizai-3.0.1/tests/templates/inherit/nullbase.html 0000664 0000000 0000000 00000000000 14176331465 0023707 0 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/templates/inherit/nullext.html 0000664 0000000 0000000 00000000127 14176331465 0023607 0 ustar 00root root 0000000 0000000 {% extends "inherit/nullbase.html" %}
{% load sekizai_tags %}
{% render_block "js" %} django-sekizai-3.0.1/tests/templates/inherit/spacechain.html 0000664 0000000 0000000 00000000047 14176331465 0024213 0 ustar 00root root 0000000 0000000 {% extends "inherit/extend.html" %} django-sekizai-3.0.1/tests/templates/inherit/subvarchain.html 0000664 0000000 0000000 00000000045 14176331465 0024420 0 ustar 00root root 0000000 0000000 {% extends "inherit/varchain.html" %} django-sekizai-3.0.1/tests/templates/inherit/super_blocks.html 0000664 0000000 0000000 00000000370 14176331465 0024607 0 ustar 00root root 0000000 0000000 {% extends "inherit/base.html" %}
{% load sekizai_tags %}
{% addtoblock "css" %}
invisible css file
{% endaddtoblock %}
{% block "main" %}
{{ block.super }}
{% addtoblock "css" %}
visible css file
{% endaddtoblock %}
more contents
{% endblock %} django-sekizai-3.0.1/tests/templates/inherit/varchain.html 0000664 0000000 0000000 00000000023 14176331465 0023702 0 ustar 00root root 0000000 0000000 {% extends var %}
django-sekizai-3.0.1/tests/templates/named_end.html 0000664 0000000 0000000 00000000172 14176331465 0022364 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock "myblock" %}
mycontent
{% endaddtoblock "myblock" %}
{% render_block "myblock" %}
django-sekizai-3.0.1/tests/templates/namespaces.html 0000664 0000000 0000000 00000000370 14176331465 0022571 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "one" %}
{% render_block "two" %}
{% addtoblock "one" %}
the same file
{% endaddtoblock %}
{% addtoblock "two" %}
the same file
{% endaddtoblock %}
{% addtoblock "one" %}
the same file
{% endaddtoblock %} django-sekizai-3.0.1/tests/templates/processors/ 0000775 0000000 0000000 00000000000 14176331465 0021766 5 ustar 00root root 0000000 0000000 django-sekizai-3.0.1/tests/templates/processors/addtoblock_namespace.html 0000664 0000000 0000000 00000000252 14176331465 0026775 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" preprocessor "tests.test_core.namespace_processor" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" %}
django-sekizai-3.0.1/tests/templates/processors/addtoblock_null.html 0000664 0000000 0000000 00000000245 14176331465 0026015 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" preprocessor "tests.test_core.null_processor" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" %}
django-sekizai-3.0.1/tests/templates/processors/namespace.html 0000664 0000000 0000000 00000000253 14176331465 0024610 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" postprocessor "tests.test_core.namespace_processor" %}
django-sekizai-3.0.1/tests/templates/processors/null.html 0000664 0000000 0000000 00000000246 14176331465 0023630 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
header
{% addtoblock "js" %}
javascript
{% endaddtoblock %}
footer
{% render_block "js" postprocessor "tests.test_core.null_processor" %}
django-sekizai-3.0.1/tests/templates/unique.html 0000664 0000000 0000000 00000000246 14176331465 0021762 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% render_block "unique" %}
{% addtoblock "unique" %}unique data{% endaddtoblock %}
{% addtoblock "unique" %}unique data{% endaddtoblock %}
django-sekizai-3.0.1/tests/templates/variables.html 0000664 0000000 0000000 00000000373 14176331465 0022425 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% addtoblock blockname %}
file two
{% endaddtoblock %}
{% addtoblock "one" %}
file two
{% endaddtoblock %}
{% addtoblock blockname|upper %}
file one
{% endaddtoblock %}
{% render_block "ONE" %}
{% render_block blockname %} django-sekizai-3.0.1/tests/templates/with_data.html 0000664 0000000 0000000 00000000251 14176331465 0022414 0 ustar 00root root 0000000 0000000 {% load sekizai_tags %}
{% with_data "key" as mylist %}
{% for obj in mylist %}
{{ obj }}
{% endfor %}
{% end_with_data %}
{% add_data "key" 1 %}
{% add_data "key" 2 %} django-sekizai-3.0.1/tests/test_core.py 0000664 0000000 0000000 00000033277 14176331465 0020143 0 ustar 00root root 0000000 0000000 import sys
from difflib import SequenceMatcher
from io import StringIO
from unittest import TestCase
from django import template
from django.conf import settings
from django.template.engine import Engine
from django.template.loader import render_to_string
from sekizai import context_processors
from sekizai.context import SekizaiContext
from sekizai.helpers import Watcher, get_namespaces, get_varname, validate_template
from sekizai.templatetags.sekizai_tags import import_processor, validate_context
def null_processor(context, data, namespace):
return ''
def namespace_processor(context, data, namespace):
return namespace
class SettingsOverride:
"""
Overrides Django settings within a context and resets them to their initial
values on exit.
Example:
with SettingsOverride(DEBUG=True):
# do something
"""
class NULL:
pass
def __init__(self, **overrides):
self.overrides = overrides
def __enter__(self):
self.old = {}
for key, value in self.overrides.items():
self.old[key] = getattr(settings, key, self.NULL)
setattr(settings, key, value)
def __exit__(self, type, value, traceback):
for key, value in self.old.items():
if value is self.NULL:
delattr(settings, key)
else:
setattr(settings, key, value)
class CaptureStdout:
"""
Overrides sys.stdout with a StringIO stream.
"""
def __init__(self):
self.old = None
def __enter__(self):
self.old = sys.stdout
new = sys.stdout = StringIO()
return new
def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout = self.old
class Match(tuple): # pragma: no cover
@property
def a(self):
return self[0]
@property
def b(self):
return self[1]
@property
def size(self):
return self[2]
def _backwards_compat_match(thing): # pragma: no cover
if isinstance(thing, tuple):
return Match(thing)
return thing
class BitDiffResult:
def __init__(self, status, message):
self.status = status
self.message = message
class BitDiff:
"""
Visual aid for failing tests
"""
def __init__(self, expected):
self.expected = [repr(str(bit)) for bit in expected]
def test(self, result):
result = [repr(str(bit)) for bit in result]
if self.expected == result:
return BitDiffResult(True, "success")
else: # pragma: no cover
longest = max(
[len(x) for x in self.expected] +
[len(x) for x in result] +
[len('Expected')]
)
sm = SequenceMatcher()
sm.set_seqs(self.expected, result)
matches = sm.get_matching_blocks()
lasta = 0
lastb = 0
data = []
for match in [_backwards_compat_match(match) for match in matches]:
unmatcheda = self.expected[lasta:match.a]
unmatchedb = result[lastb:match.b]
unmatchedlen = max([len(unmatcheda), len(unmatchedb)])
unmatcheda += ['' for x in range(unmatchedlen)]
unmatchedb += ['' for x in range(unmatchedlen)]
for i in range(unmatchedlen):
data.append((False, unmatcheda[i], unmatchedb[i]))
for i in range(match.size):
data.append((
True, self.expected[match.a + i], result[match.b + i]
))
lasta = match.a + match.size
lastb = match.b + match.size
padlen = (longest - len('Expected'))
padding = ' ' * padlen
line1 = '-' * padlen
line2 = '-' * (longest - len('Result'))
msg = '\nExpected%s | | Result' % padding
msg += f'\n--------{line1}-|---|-------{line2}'
for success, a, b in data:
pad = ' ' * (longest - len(a))
if success:
msg += f'\n{a}{pad} | | {b}'
else:
msg += f'\n{a}{pad} | ! | {b}'
return BitDiffResult(False, msg)
def update_template_debug(debug=True):
"""
Helper method for updating the template debug option based on
the django version. Use the results of this function as the context.
:return: SettingsOverride object
"""
# Create our overridden template settings with debug turned off.
templates_override = settings.TEMPLATES
templates_override[0]['OPTIONS'].update({'debug': debug})
# Engine gets created based on template settings initial value so
# changing the settings after the fact won't update, so do it
# manually. Necessary when testing validate_context
# with render method and want debug off.
Engine.get_default().debug = debug
return SettingsOverride(TEMPLATES=templates_override)
class SekizaiTestCase(TestCase):
def _render(self, tpl, ctx=None, sekizai_context=True):
ctx = dict(ctx) if ctx else {}
if sekizai_context:
ctx.update(context_processors.sekizai())
return render_to_string(tpl, ctx)
def _get_bits(self, tpl, ctx=None, sekizai_context=True):
ctx = ctx or {}
rendered = self._render(tpl, ctx, sekizai_context)
bits = [
bit for bit in [bit.strip('\n')
for bit in rendered.split('\n')] if bit
]
return bits, rendered
def _test(self, tpl, res, ctx=None, sekizai_context=True):
"""
Helper method to render template and compare it's bits
"""
ctx = ctx or {}
bits, rendered = self._get_bits(tpl, ctx, sekizai_context)
differ = BitDiff(res)
result = differ.test(bits)
self.assertTrue(result.status, result.message)
return rendered
def test_basic_dual_block(self):
"""
Basic dual block testing
"""
bits = [
'my css file', 'some content', 'more content', 'final content',
'my js file'
]
self._test('basic.html', bits)
def test_named_endaddtoblock(self):
"""
Testing with named endaddblock
"""
bits = ["mycontent"]
self._test('named_end.html', bits)
def test_eat_content_before_render_block(self):
"""
Testing that content gets eaten if no render_blocks is available
"""
bits = ["mycontent"]
self._test("eat.html", bits)
def test_sekizai_context_required(self):
"""
Test that the template tags properly fail if not used with either
SekizaiContext or the context processor.
"""
with self.assertRaises(template.TemplateSyntaxError):
self._render('basic.html', {}, sekizai_context=False)
def test_complex_template_inheritance(self):
"""
Test that (complex) template inheritances work properly
"""
bits = [
"head start",
"some css file",
"head end",
"include start",
"inc add js",
"include end",
"block main start",
"extinc",
"block main end",
"body pre-end",
"inc js file",
"body end"
]
self._test("inherit/extend.html", bits)
"""
Test that blocks (and block.super) work properly with sekizai
"""
bits = [
"head start",
"visible css file",
"some css file",
"head end",
"include start",
"inc add js",
"include end",
"block main start",
"block main base contents",
"more contents",
"block main end",
"body pre-end",
"inc js file",
"body end"
]
self._test("inherit/super_blocks.html", bits)
def test_namespace_isolation(self):
"""
Tests that namespace isolation works
"""
bits = ["the same file", "the same file"]
self._test('namespaces.html', bits)
def test_variable_namespaces(self):
"""
Tests variables and filtered variables as block names.
"""
bits = ["file one", "file two"]
self._test('variables.html', bits, {'blockname': 'one'})
def test_invalid_addtoblock(self):
"""
Tests that template syntax errors are raised properly in templates
rendered by sekizai tags
"""
self.assertRaises(
template.TemplateSyntaxError,
self._render, 'errors/failadd.html'
)
def test_invalid_renderblock(self):
self.assertRaises(
template.TemplateSyntaxError,
self._render, 'errors/failrender.html'
)
def test_invalid_include(self):
self.assertRaises(
template.TemplateSyntaxError,
self._render, 'errors/failinc.html'
)
def test_invalid_basetemplate(self):
self.assertRaises(
template.TemplateSyntaxError,
self._render, 'errors/failbase.html'
)
def test_invalid_basetemplate_two(self):
self.assertRaises(
template.TemplateSyntaxError,
self._render, 'errors/failbase2.html'
)
def test_with_data(self):
"""
Tests the with_data/add_data tags.
"""
bits = ["1", "2"]
self._test('with_data.html', bits)
def test_easy_inheritance(self):
self.assertEqual('content', self._render("easy_inherit.html").strip())
def test_validate_context(self):
sekizai_ctx = SekizaiContext()
django_ctx = template.Context()
self.assertRaises(
template.TemplateSyntaxError,
validate_context, django_ctx
)
self.assertEqual(validate_context(sekizai_ctx), True)
with update_template_debug(debug=False):
self.assertEqual(validate_context(django_ctx), False)
self.assertEqual(validate_context(sekizai_ctx), True)
bits = ['some content', 'more content', 'final content']
self._test('basic.html', bits, sekizai_context=False)
def test_post_processor_null(self):
bits = ['header', 'footer']
self._test('processors/null.html', bits)
def test_post_processor_namespace(self):
bits = ['header', 'footer', 'js']
self._test('processors/namespace.html', bits)
def test_import_processor_failfast(self):
self.assertRaises(TypeError, import_processor, 'invalidpath')
def test_unique(self):
bits = ['unique data']
self._test('unique.html', bits)
def test_strip(self):
tpl = template.Template("""
{% load sekizai_tags %}
{% addtoblock 'a' strip %} test{% endaddtoblock %}
{% addtoblock 'a' strip %}test {% endaddtoblock %}
{% render_block 'a' %}""")
context = SekizaiContext()
output = tpl.render(context)
self.assertEqual(output.count('test'), 1, output)
def test_addtoblock_processor_null(self):
bits = ['header', 'footer']
self._test('processors/addtoblock_null.html', bits)
def test_addtoblock_processor_namespace(self):
bits = ['header', 'footer', 'js']
self._test('processors/addtoblock_namespace.html', bits)
class HelperTests(TestCase):
def test_validate_template_js_css(self):
self.assertTrue(validate_template('basic.html', ['js', 'css']))
def test_validate_template_js(self):
self.assertTrue(validate_template('basic.html', ['js']))
def test_validate_template_css(self):
self.assertTrue(validate_template('basic.html', ['css']))
def test_validate_template_empty(self):
self.assertTrue(validate_template('basic.html', []))
def test_validate_template_notfound(self):
self.assertFalse(validate_template('basic.html', ['notfound']))
def test_get_namespaces_easy_inherit(self):
self.assertEqual(get_namespaces('easy_inherit.html'), ['css'])
def test_get_namespaces_chain_inherit(self):
self.assertEqual(get_namespaces('inherit/chain.html'), ['css', 'js'])
def test_get_namespaces_space_chain_inherit(self):
self.assertEqual(
get_namespaces('inherit/spacechain.html'),
['css', 'js']
)
def test_get_namespaces_var_inherit(self):
self.assertEqual(get_namespaces('inherit/varchain.html'), [])
def test_get_namespaces_sub_var_inherit(self):
self.assertEqual(get_namespaces('inherit/subvarchain.html'), [])
def test_get_namespaces_null_ext(self):
self.assertEqual(get_namespaces('inherit/nullext.html'), [])
def test_deactivate_validate_template(self):
with SettingsOverride(SEKIZAI_IGNORE_VALIDATION=True):
self.assertTrue(validate_template('basic.html', ['js', 'css']))
self.assertTrue(validate_template('basic.html', ['js']))
self.assertTrue(validate_template('basic.html', ['css']))
self.assertTrue(validate_template('basic.html', []))
self.assertTrue(validate_template('basic.html', ['notfound']))
def test_watcher_add_namespace(self):
context = SekizaiContext()
watcher = Watcher(context)
varname = get_varname()
context[varname]['key'].append('value')
changes = watcher.get_changes()
self.assertEqual(changes, {'key': ['value']})
def test_watcher_add_data(self):
context = SekizaiContext()
varname = get_varname()
context[varname]['key'].append('value')
watcher = Watcher(context)
context[varname]['key'].append('value2')
changes = watcher.get_changes()
self.assertEqual(changes, {'key': ['value2']})
django-sekizai-3.0.1/tox.ini 0000664 0000000 0000000 00000001050 14176331465 0015733 0 ustar 00root root 0000000 0000000 [tox]
envlist =
flake8
isort
py{37,38,39,310}-dj{22,31,32}
skip_missing_interpreters=True
[testenv]
deps =
-r{toxinidir}/tests/requirements/base.txt
dj22: Django>=2.2,<3.0
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<3.3
commands =
{envpython} --version
{env:COMMAND:coverage} erase
{env:COMMAND:coverage} run setup.py test
{env:COMMAND:coverage} report
[testenv:flake8]
deps = flake8
commands = flake8 --config=setup.cfg
[testenv:isort]
deps = isort
commands = isort -c -rc -df sekizai
skip_install = true