Initial commit from cookiecutter-pydjama, need update

parents
# This file exists so you can easily regenerate your project.
#
# `cookiepatcher` is a convenient shim around `cookiecutter`
# for regenerating projects (it will generate a .cookiecutterrc
# automatically for any template). To use it:
#
# pip install cookiepatcher
# cookiepatcher gh:ionelmc/cookiecutter-pylibrary project-path
#
# See:
# https://pypi.python.org/pypi/cookiecutter
#
# Alternatively, you can run:
#
# cookiecutter --overwrite-if-exists --config-file=project-path/.cookiecutterrc gh:ionelmc/cookiecutter-pylibrary
default_context:
codacy: 'yes'
codeclimate: 'no'
codecov: 'no'
command_line_interface: 'no'
command_line_interface_bin_name: 'django-hope'
coveralls: 'no'
distribution_name: 'django-hope'
django: 'yes'
django_fake_model: 'yes'
django_versions: '1.8,1.9,1.10,1.11'
email: 'timothee.mazzucotelli@gmail.com'
full_name: 'Timoth\xe9e Mazzucotelli'
github_username: 'Pawamoy'
gitter: 'no'
landscape: 'no'
package_name: 'hope'
project_name: 'Django HOPE'
project_short_description: 'Django application to implement the HOPE library.'
prospector: 'yes'
pylama: 'no'
python_versions: '2.7,3.4,3.5,3.6,3.7-dev,pypy'
pyup: 'no'
release_date: 'today'
repo_name: 'django-hope'
requiresio: 'no'
travis: 'no'
version: '0.1.0'
website: ' '
# see http://editorconfig.org
root = true
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
[*.py]
indent_size = 4
[*.{bat,cmd,ps1}]
end_of_line = crlf
*.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
wheelhouse
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
strictness: veryhigh
autodetect: true
max-line-length: 79
doc-warnings: true
member-warnings: false
test-warnings: false
output-format: grouped
ignore-patterns:
- ^\.tox/.*
- ^\.env/.*
- ^docs/.*
- ^tests/.*
- ^build/.*
- ^dist/.*
- .*/migrations/.*
- ^runtests\.py
dodgy:
run: true
frosted:
disable: [E401]
run: true
mccabe:
options: {max-complexity: 10}
run: true
pep257:
disable: [D000, D105, D203, D212, D401, D406, D407, D413]
run: true
pep8:
full: true
options: {max-line-length: 79, single-line-if-stmt: n}
run: true
profile-validator:
run: true
pyflakes:
run: true
pylint:
disable: [bad-continuation, no-name-in-module, no-member, fixme, empty-docstring, django-not-available, invalid-name, too-few-public-methods]
options: {max-attributes: 7, max-branches: 12, max-line-length: 79, max-locals: 15,
max-module-lines: 1000, max-parents: 7, max-public-methods: 20, max-returns: 6,
max-statements: 50, min-public-methods: 2}
run: true
pyroma:
disable: [PYR19, PYR16, PYR15]
run: true
vulture:
run: true
Authors
=======
* Timothée Mazzucotelli -
=========
Changelog
=========
0.1.0 (2017-11-30)
==================
* Alpha release on PyPI.
============
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/Pawamoy/django-hope/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 HOPE could always use more documentation, whether as part of the
official Django HOPE 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/Pawamoy/django-hope/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-hope` for local development:
1. Fork `django-hope <https://github.com/Pawamoy/django-hope>`_
(look for the "Fork" button).
2. Clone your fork locally::
git clone git@github.com:your_name_here/django-hope.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 tests with 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/Pawamoy/django-hope/pull_requests>`_ for each change you add in the pull request.
It will be slower though...
- **pyenv**:
.. code:: bash
# important libraries to compile Python
sudo apt install -y libssl-dev openssl zlib1g-dev sqlite3 libsqlite3-dev libbz2-dev bzip2
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
export PATH="${HOME}/.pyenv/bin:${PATH}"
eval "$(pyenv init -)"
pyenv install 3.5.3
pyenv install 3.6.0 # etc.
pyenv global system 3.5.3 3.6.0
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
ISC License
Copyright (c) 2017, Timothée Mazzucotelli
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
graft src
graft tests
graft docs
include .cookiecutterrc
include .editorconfig
include AUTHORS.rst
include CHANGELOG.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst
include tox.ini
include *.yml
include runtests.py
recursive-include requirements *.txt
recursive-include scripts *.sh
global-exclude *.py[cod] __pycache__ *.so *.dylib
===========
Django HOPE
===========
.. start-badges
|codacygrade|
|codacycoverage|
|version|
|wheel|
.. |codacygrade| image:: https://api.codacy.com/project/badge/Grade/REPLACE_WITH_PROJECT_ID
:target: https://www.codacy.com/app/Pawamoy/django-hope/dashboard
:alt: Codacy Code Quality Status
.. |codacycoverage| image:: https://api.codacy.com/project/badge/Coverage/REPLACE_WITH_PROJECT_ID
:target: https://www.codacy.com/app/Pawamoy/django-hope/dashboard
:alt: Codacy Code Coverage
.. |version| image:: https://img.shields.io/pypi/v/django-hope.svg?style=flat
:target: https://pypi.org/project/django-hope/
:alt: PyPI Package latest release
.. |wheel| image:: https://img.shields.io/pypi/wheel/django-hope.svg?style=flat
:target: https://pypi.org/project/django-hope/
:alt: PyPI Wheel
.. end-badges
Django application to implement the HOPE library.
License
=======
Software licensed under `ISC`_ license.
.. _ISC: https://www.isc.org/downloads/software-support-policy/isc-license/
Installation
============
::
pip install django-hope
Documentation
=============
`On ReadTheDocs`_
.. _`On ReadTheDocs`: http://django-hope.readthedocs.io/
Development
===========
To run all the tests: ``tox``
.. include:: ../AUTHORS.rst
.. include:: ../CHANGELOG.rst
# -*- coding: utf-8 -*-
"""Sphinx configuration file."""
from __future__ import unicode_literals
import os
import sys
import django
from django.conf import settings
sys.path.insert(0, os.path.join(os.path.abspath('..'), 'src'))
settings.configure(
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
],
SITE_ID=1
)
django.setup()
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
autodoc_default_flags = [
'members',
'special-members',
'show-inheritance'
]
if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling',
spelling_show_suggestions = True
spelling_lang = 'en_US'
source_suffix = '.rst'
master_doc = 'index'
project = u'Django HOPE'
year = '2017'
author = u'Timoth\xe9e Mazzucotelli'
copyright = '{0}, {1}'.format(year, author)
version = release = u'0.1.0'
pygments_style = 'trac'
templates_path = ['.']
extlinks = {
'issue': ('https://github.com/Pawamoy/django-hope/issues/%s', '#'),
'pr': ('https://github.com/Pawamoy/django-hope/pull/%s', 'PR #'),
}
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
html_last_updated_fmt = '%b %d, %Y'
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
}
html_short_title = '%s-%s' % (project, version)
html_context = {
'extra_css_files': [
'_static/extra.css',
],
}
html_static_path = [
"extra.css",
]
napoleon_use_ivar = True
napoleon_use_rtype = False
napoleon_use_param = False
suppress_warnings = ["image.nonlocal_uri"]
.. include:: ../CONTRIBUTING.rst
.wy-side-nav-search {
/* TODO: add the color as a cookiecutter variable, default to classic RTD blue #2980B9 */
background-color: #2980B9;
}
.wy-side-nav-search input[type="text"] {
border-color: transparent;
}
.wy-nav-content {
margin: initial;
}
/*.wy-nav-side {*/
/* TODO: add the color as a cookiecutter variable, default to none */
/*background-color: #2980B9;*/
/*}*/
.rst-content div[role=navigation], footer {
font-size: 0.85em;
color: #999;
}
.rst-content div[role=navigation] hr {
margin-top: 6px;
}
footer hr {
margin-bottom: 6px;
}
.rst-footer-buttons {
display: none;
}
a.icon-home, a.icon-home:hover {
display: inline-block;
padding: 4px 4px 4px 21px;
/* TODO: add this when logo is ready */
/*background: transparent url(logo.svg) center left no-repeat;*/
background-size: 1.2em;
margin-top: 0.2em;
margin-bottom: 1em;
}
.fa-home::before, .icon-home::before {
content: "";
}
.wy-nav-top a {
margin: -2em;
/* TODO: add this when logo is ready */
/*background: transparent url(logo.svg) center left no-repeat;*/
background-size: 1.2em;
padding: 4px 4px 4px 24px;
}
========
Contents
========
.. toctree::
:maxdepth: 2
readme
contributing
authors
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. include:: ../README.rst
sphinx
sphinx-rtd-theme
Django
-e .
builtin
builtins
classmethod
staticmethod
classmethods
staticmethods
args
kwargs
callstack
Changelog
Indices
docstrings
django-hope
django-hope
hope
Pawamoy
django
hope
Timothée
Mazzucotelli
Django
django
-r base.txt
tox
-r base.txt
pytest
pytest-travis-fold
pytest-cov
pytest-django
django-fake-model
# -*- coding: utf-8 -*-
"""
Entry point for Django tests.
This script will setup the basic configuration needed by Django.
"""
import sys
from os.path import abspath, dirname, join
try:
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
'default': {
'NAME': 'default',
'ENGINE': 'django.db.backends.sqlite3',
}
},
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'hope',
],
SITE_ID=1,
MIDDLEWARE_CLASSES=()
)
try:
import django
sys.path.append(abspath(join(dirname(__file__), 'src')))
setup = django.setup
except AttributeError:
pass
else:
setup()
except ImportError:
import traceback
traceback.print_exc()
raise ImportError('To fix this error, maybe run '
'`pip install -r requirements/test.txt`')
def run_tests(*test_args):
"""Discover and run tests."""
if not test_args:
test_args = ['tests']
# Run tests
runner = get_runner(settings)
test_runner = runner()
failures = test_runner.run_tests(test_args)
if failures:
sys.exit(bool(failures))
if __name__ == '__main__':
run_tests(*sys.argv[1:])
#!/bin/bash
rm -rf build
rm -rf dist
rm -rf src/*.egg-info
rm -rf htmlcov
rm -rf __pycache__
rm -rf .tox
rm -rf .cache
rm .coverage
rm .coverage.*
#!/bin/bash
rm -rf build
rm -rf dist
rm -rf src/*.egg-info
read -rp "Are you sure tox is ok? [yN]: " tox_ok
proceed=0
case $tox_ok in
y|Y|yes) proceed=1 ;;
esac
if [ ${proceed} -eq 1 ]; then
python setup.py clean --all sdist bdist_wheel
if twine upload --skip-existing dist/* -r pypitest; then
if ! twine upload --skip-existing dist/* -r pypi; then
echo "Twine upload to PyPi failed" >&2
fi; else echo "Twine upload to PyPiTest failed" >&2
fi; else echo "Then make tox happy." >&2
fi
#!/bin/bash
{ # Force shell to read entire script before executing it, thanks to compound command
if [ $# -lt 2 ]; then
echo "usage: ./update.sh PROJECT_PATH COOKIECUTTER_PATH [COMMIT_MESSAGE]" >&2
exit 1
fi
# Initialize paths
project=$1
cookiecutter=$2
message=${3:-Update cookiecutter branch}
abs_project="$(cd "${project}"; pwd)"
abs_cookiecutter="$(cd "${cookiecutter}"; pwd)"
echo "Absolute path to project: ${abs_project}"
echo "Absolute path to cookiecutter: ${abs_cookiecutter}"
echo "Commit message: ${message}"
echo
# Git checkout cookiecutter branch
cd "${abs_project}"
echo "> git checkout cookiecutter"
git checkout cookiecutter >/dev/null 2>&1 || exit 1
# Regenerate project
echo "> regenerate cookiecutter"
if ! cookiecutter --overwrite-if-exists --no-input \
--config-file ".cookiecutterrc" \
--output-dir .. "${abs_cookiecutter}" >/dev/null; then
echo
echo "Problem during cookiecutter regeneration"
exit 1
fi
# Git status, add, commit and push
echo "> git status -sb"
git status -sb | tail -n+2
echo
echo "> git add and commit"
git add . -A
if git commit -m "${message}"; then
echo
echo "Now checkout your main branch, merge cookiecutter one,"
echo "fix conflicts if any then commit and push!"
fi
exit 0 # Force shell to exit here and not to read anything added after this compound command
}