Simplify package setup

This commit is contained in:
Johannes Hoppe 2019-04-08 18:55:31 +02:00
parent 9de7f29815
commit 2f17e21b0b
12 changed files with 159 additions and 387 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
[*.{json,yml,yaml,js,jsx}]
indent_size = 2
[LICENSE]
insert_final_newline = false
[Makefile]
indent_style = tab

View file

@ -1,3 +1,4 @@
- flake8
- pydocstyle
- bandit
- flake8
- isort
- pydocstyle

View file

@ -1,82 +1,78 @@
sudo: true
language: python
dist: xenial
services: redis-server
addons:
apt:
packages:
- chromium-chromedriver
language: python
python:
- 3.6
- 3.7
cache: pip
- "3.6"
- "3.7"
env:
matrix:
- DJANGO=20
- DJANGO=21
- DJANGO=22
- DJANGO=master
- DJANGO=20
- DJANGO=21
- DJANGO=22
- DJANGO=master
matrix:
fast_finish: true
allow_failures:
- env: DJANGO=master
addons:
apt:
packages:
- chromium-chromedriver
install: pip install tox-travis codecov
before_script:
- ln -s /usr/lib/chromium-browser/chromedriver ~/bin/chromedriver
- |
if [[ -z $TOXENV ]]; then
export TOXENV=py$(echo $TRAVIS_PYTHON_VERSION | sed -e 's/\.//g')-dj$DJANGO
fi
- echo $TOXENV
script: tox
after_success: codecov
jobs:
include:
- stage: docs
- python: "3.5"
env: TOXENV=docs
addons:
apt:
packages:
- python3-enchant
- python-enchant
- graphviz
python: "3.5"
script: tox -e docs
- stage: qa
addons:
language: node_js
- language: node_js
addons: {}
install: npm install
script: npm test
node_js: lts/*
cache: npm
states:
- qa
- docs
- test
- deploy
install:
- pip install --upgrade pip tox
- pip install -U codecov
before_script:
- ln -s /usr/lib/chromium-browser/chromedriver ~/bin/chromedriver
- |
if [[ -z $TOXENV ]]; then
export TOXENV=py$(echo $TRAVIS_PYTHON_VERSION | sed -e 's/\.//g')-dj$DJANGO
fi
- echo $TOXENV
script:
- tox -e $TOXENV
after_success:
- codecov
before_deploy:
- git stash --all
- ./set_version.py
_deploy_provider: &_deploy_provider
skip_cleanup: true
on:
tags: true
repo: applegrew/django-select2
deploy:
- <<: *_deploy_provider
provider: pypi
distributions: sdist bdist_wheel
user: codingjoe
password:
secure: fEP9K7y0ZF9fRvQEUN4kgPXQEZvi3Cx3ikUebG2UM/2uhcaUQm0+KpgZ2S+lvOTYcBnNgzPzFsVIZMcVcTxwIKuQDEMq9y2eop2hnisb9KXsIm9qPYSzOnRm74VuiOt4hNOZMe0qVBK2cO3vC9NDXuzdI8A0JynJhthfl4t+kFM=
- <<: *_deploy_provider
provider: npm
email: info@johanneshoppe.com
api_key:
secure: PV38cQx9qhEFkpSdytbM72UzIMCfhpjmRJ8dzT+bCAaOIs5rEcyKN+h1r5ranunCxWyuFsMW4A2iW/SCxnKCR/oPAguuwUbT5ogBXlsskqPFWUxuoTHYMrd+zB+SC6+bMgq+o5ul+kJCYtEkWP6cMlIEzKyTLab7m5PsnDXNVnI=
- stage: deploy
if: tag IS present
python: 3.7
install: skip
script: skip
after_success: skip
before_deploy:
- git stash --all
- ./set_version.py
_deploy_provider: &_deploy_provider
skip_cleanup: true
on:
tags: true
repo: applegrew/django-select2
deploy:
- <<: *_deploy_provider
provider: pypi
distributions: sdist bdist_wheel
user: codingjoe
password:
secure: fEP9K7y0ZF9fRvQEUN4kgPXQEZvi3Cx3ikUebG2UM/2uhcaUQm0+KpgZ2S+lvOTYcBnNgzPzFsVIZMcVcTxwIKuQDEMq9y2eop2hnisb9KXsIm9qPYSzOnRm74VuiOt4hNOZMe0qVBK2cO3vC9NDXuzdI8A0JynJhthfl4t+kFM=
- <<: *_deploy_provider
provider: npm
email: info@johanneshoppe.com
api_key:
secure: PV38cQx9qhEFkpSdytbM72UzIMCfhpjmRJ8dzT+bCAaOIs5rEcyKN+h1r5ranunCxWyuFsMW4A2iW/SCxnKCR/oPAguuwUbT5ogBXlsskqPFWUxuoTHYMrd+zB+SC6+bMgq+o5ul+kJCYtEkWP6cMlIEzKyTLab7m5PsnDXNVnI=

View file

@ -1,218 +0,0 @@
Changelog Summary
=================
Changes for django-select2 v6.0.1 and later are logged on the [github releases page](https://github.com/applegrew/django-select2/releases).
### v6.0.0
* Add Support for Django 2.0
* Drop Python 2 support
* Drop Python 3.5 support
* Drop Django 1.8 support
* Drop Django 1.10 support
### v5.10.0
* Add support for dependent select fields [321](github.com/applegrew/django-select2/pull/321/).
### v5.9.0
* Add support for Django 1.11 LTS
* Drop support for Django 1.9
### v5.8.10
* Fixes tests for Django 1.10+
* retain order of choices [299](https://github.com/applegrew/django-select2/pull/299)
### v5.8.9
* Fixes tests. No functional change from 5.8.8.
### v5.8.8
* Upgrade Select2 to version 4.0.3
### v5.8.7
* Fix #285 -- Do not evaluate queryset in `render_options`.
### v5.8.3
* Remove six dependency -- User django.utils.six instead.
### v5.8.2
* Fixes #260 -- Fixes bug in render choices
### v5.8.0
* Changed signature of `render` and `render_choices` to satisfy Django 1.10 changes.
* Changed widgets' inheritance tree to be more consistent.
### v5.7.1
* Fixes pickle bug of lazy object
### v5.7.0
* Security fix that allows a `field_id` to only be used for the intended JSON endpoint.
Prior to that change you could use any `field_id` on any select2 JSON endpoint.
Even if the id was intended to be used on a private endpoint if could be used on
the default one and therefore leak sensitive data.
* Breaking change on how `Heavy` widgets are being cached.
Heavy widgets used to add themselves to the cache. Now they add a dictionary to
the cache containing themselves and the target url.
```python
{
'widget': self,
'url': self.get_url(),
}
```
### v5.6.0
* Added `label_from_instance` method for model widgets to define custom option labels.
### v5.5.0
* Added settings to delivery static assets from different source.
### v5.4.2
* Fixed initial data not being shown for heavy widgets.
### v5.4.1
* Fixed memory leak in `ModelSelect2Mixin` and subclasses
### v5.4.0
* Added `Select2TagWidget` a light widget with tagging support
### v5.3.0
* Added djangoSelect2 jQuery plugin to support
dynamic field initialisation
### v5.2.0
* Added pagination
### v5.1.0
* Added search term splitting
* Model widgets get smarter pickling to reduce size and avoid pickling issues
### v5.0.0
Version 5 is a complete rewrite of the package to drastically reduce
the code base and to ensure a future maintainability.
While we feature set remained unchanged, the API changed completely.
Major changes:
* Fields have been removed in favor of widgets.
* All version 4 settings have been removed.
* Template tags have been removed.
* 3rd party javascript is served by a CDN.
* No more inline javascript code.
### v4.3.2
* Use `django.contrib.staticfiles.templatetags.staticfiles.static` over `django.templatetags.static.static` to allow hashing.
* Py23 unicode fixes
### v4.3.1
* Build failure fix.
### v4.3.0
* Now the package supports both Python2 and Python3.
* Django 1.8 support added.
* Many bug fixes.
### v4.2.2
* Misc fixes and enhancements - [61](https://github.com/applegrew/django-select2/pull/61), [64](https://github.com/applegrew/django-select2/issues/64).
### v4.2.1
* Finally fixed performance issue[#54](https://github.com/applegrew/django-select2/issues/54) (and issue[#41](https://github.com/applegrew/django-select2/issues/41)) in widgets when backing field is based on models and the field has an initial value.
### v4.2.0
* Updated Select2 to version 3.4.2. **Please note**, that if you need any of the Select2 locale files, then you need to download them yourself from http://ivaynberg.github.com/select2/ and add to your project.
* Tagging support added. See [Field API reference](http://django-select2.readthedocs.org/en/latest/ref_fields.html) in documentation.
### v4.1.0
* Updated Select2 to version 3.4.1. **Please note**, that if you need any of the Select2 locale files, then you need to download them yourself from http://ivaynberg.github.com/select2/ and add to your project.
* Address isssue[#36](https://github.com/applegrew/django-select2/issues/36) - Fix importerror under django1.6.
* Fixed the way `setup.py` handles Unicode files while minifying them during package build.
* Address isssue[#39](https://github.com/applegrew/django-select2/issues/39) - MultipleSelect2HiddenInput.render() should use mark_safe().
* Address isssue[#45](https://github.com/applegrew/django-select2/issues/45) - MultipleSelect2HiddenInput returns bad has_changed value.
### v4.0.0
* Main version number bumped to bring your attention to the fact that the default Id generation scheme has now changed. Now Django Select2 will use hashed paths of fields to generate their Ids. The old scheme of generating random Ids are still there. You can enable that by setting `GENERATE_RANDOM_SELECT2_ID` to `True`.
### v3.3.1
* Addressed issue[#30](https://github.com/applegrew/django-select2/issues/30).
* Merged pull request[#31](https://github.com/applegrew/django-select2/issues/31).
* Added `light` parameter to `import_django_select2_js`, `import_django_select2_css` and `import_django_select2_js_css` template tags. Please see doc's "Getting Started", for more details.
### v3.3.0
* Updated Select2 to version 3.3.1.
* Added multi-process support. ([Issue#28](https://github.com/applegrew/django-select2/issues/28)).
* Addressed issue[#26](https://github.com/applegrew/django-select2/issues/26).
* Addressed issue[#24](https://github.com/applegrew/django-select2/issues/24).
* Addressed issue[#23](https://github.com/applegrew/django-select2/issues/23).
* Addressed some typos.
### v3.2.0
* Fixed issue[#20](https://github.com/applegrew/django-select2/issues/20). Infact while fixing that I realised that heavy components do not need the help of cookies, infact due to a logic error in previous code the cookies were not being used anyway. Now Django Select2 does not use cookies etc.
* Few more bugs fixed in `heav_data.js`.
* Now production code will use minimized versions of js and css files.
* Codes added in `setup.py` to automate the task of minimizing js and css files, using a web service.
### v3.1.5
* Merged pull request (issue[#17](https://github.com/applegrew/django-select2/issues/17)). Which allows the user to pass some extra data to Select2 clients-side component.
* Updated License. The previous one was inadequently worded. Now this project use Apache 2.0 license.
### v3.1.4
* Manually merged changes from pull request (issue[#16](https://github.com/applegrew/django-select2/issues/16)).
* Django Select2 widgets now allow passing of any Select2 Js options. Previously it used to allow only white-listed options. Now it will block only black-listed options. For example, Light Select2 widgets won't allow you to set `multiple` option, since it is an error to set them when Select2 Js is bound to `<select>` fields.
### v3.1.3
* Addressed enhancement issue[#12](https://github.com/applegrew/django-select2/issues/12).
* Addressed enhancement issue[#11](https://github.com/applegrew/django-select2/issues/11).
* Addressed performance issue[#8](https://github.com/applegrew/django-select2/issues/8).
### v3.1.2
* Fixed issue[#7](https://github.com/applegrew/django-select2/issues/7).
### v3.1.1
* Bumping up minor version since Select2 JS has been updated to version 3.2. It seems Select2 JS now includes new higher resolution icons for [Retina displays](http://en.wikipedia.org/wiki/Retina_Display).
* Fixed an issue in `setup.py` because of which `templatetags` directory was not included in last PIP releases' tar file.
### v3.0.2
* Added `AUTO_RENDER_SELECT2_STATICS` settings. This, when specified and set to `False` in `settings.py` then Django_Select2 widgets won't automatically include the required scripts and stylesheets. When this setting is `True` (default) then every Select2 field on the page will output `<script>` and `<link>` tags to include the required JS and CSS files. This is convinient but will output the same JS and CSS files multiple times if there are more than one Select2 fields on the page.
* Added `django_select2_tags` template tags to manually include the required JS and CSS files, when `AUTO_RENDER_SELECT2_STATICS` is turned off.
### v3.0.1
* Revised the design of heavy fields. The previous design didn't quite make it easy to back heavy fields by big data sources. See `fields.HeavyChoiceField` class and its methods' docs for more info.
* Updated docs.
* Some more fixes for issue[#4](https://github.com/applegrew/django-select2/issues/4).
* Updated Select2 JS to version 3.1.
### v3.0
* Added docs.
* Some bug fixes. See issue[#4](https://github.com/applegrew/django-select2/issues/4).
* `widgets.Select2Mixin.__init__` now accepts `select2_options` kwarg to override its `options` settings. Previously `attrs` were being used for this too. This means backward compatibility has been broken here. `attrs` will no longer override `options` values. **The major release version has been changed to 3, because of this backward incompatible change.**
### v2.0.1
* Auto id registration fixes.
### v2.0
* Mostly major bug fixes in code and design. The changes were many, raising the possibility of backward incompatibility. However, the backward incompatibility would be subtle.
* Auto fields (sub-classes of AutoViewFieldMixin) now accepts `auto_id` parameter. This can be used to provide custom id for the field. The default is 'module.field_class_name'. Ideally only the first instance of an auto field is registered. This parameter can be used to force registration of additional instances by passing a unique value.

28
LICENSE
View file

@ -1,13 +1,21 @@
Copyright 2017 Johannes Hoppe
MIT License
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Copyright (c) 2017 Johannes Hoppe
http://www.apache.org/licenses/LICENSE-2.0
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,4 +1,3 @@
import datetime
import os
import sys
@ -20,7 +19,7 @@ extensions = [
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.spelling',
'sphinx.ext.doctest',
]
intersphinx_mapping = {
@ -29,17 +28,6 @@ intersphinx_mapping = {
'https://docs.djangoproject.com/en/stable/_objects/'),
}
# spell check
spelling_word_list_filename = 'spelling_wordlist.txt'
spelling_show_suggestions = True
master_doc = 'index'
# General information about the project.
project = 'django-select2'
year = datetime.datetime.now().strftime("%Y")
copyright = '%s, Johannes Hoppe' % year
autodoc_default_flags = ['members', 'show-inheritance']
autodoc_member_order = 'bysource'
@ -49,5 +37,3 @@ inheritance_node_attrs = dict(shape='rect', fontsize=14, fillcolor='gray90',
color='gray30', style='filled')
inheritance_edge_attrs = dict(penwidth=0.75)
html_theme = 'sphinx_rtd_theme'

View file

@ -1,11 +0,0 @@
coverage
django-appconf
isort
pytest
pytest-django
selenium
sphinx
sphinx_rtd_theme
sphinxcontrib-spelling
pyenchant
django-redis

View file

@ -1 +0,0 @@
django-appconf>=0.6.0

View file

@ -1,11 +1,12 @@
[metadata]
name = django-select2
author = Johannes Hoppe
author-email = info@johanneshoppe.com
summary = Select2 option fields for Django.
description-file = README.rst
home-page = https://github.com/applegrew/django-select2
license = Apache-2
author_email = info@johanneshoppe.com
description = Select2 option fields for Django
long_description = file: README.rst
url = https://github.com/applegrew/django-select2
license = MIT
license_file = LICENSE
classifier =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
@ -16,44 +17,77 @@ classifier =
Programming Language :: Python :: 3
Framework :: Django
[files]
packages =
django_select2
[options]
include_package_data = True
packages = find:
install_requires =
django>=2.0
django-appconf>=0.6.0
setup_requires =
very-good-setuptools-git-version
sphinx
pytest-runner
tests_require =
pytest
pytest-cov
pytest-django
selenium
[pbr]
skip_authors = true
skip_changelog = true
[options.package_data]
* = *.txt, *.rst, *.html, *.po
[options.packages.find]
exclude =
tests
[bdist_wheel]
universal = 1
[bdist_rpm]
requires =
python-django-appconf >= 2.0
python-django-appconf >= 0.6
[aliases]
test = pytest
[build_sphinx]
builders = spelling,html
source-dir = docs
build-dir = docs/_build
warning-is-error = 1
project = Django-Select2
copyright = 2017 Johannes Hoppe
[tool:pytest]
norecursedirs = env docs .eggs
addopts = --tb=short -rxs
addopts = --cov=django_select2 --cov-report xml
DJANGO_SETTINGS_MODULE=tests.testapp.settings
[tox:tox]
envlist = py{35,36,37}-dj{22,21,20,master},docs
[testenv]
passenv=CI
deps =
dj20: https://github.com/django/django/archive/stable/2.0.x.tar.gz#egg=django
dj21: https://github.com/django/django/archive/stable/2.1.x.tar.gz#egg=django
dj22: https://github.com/django/django/archive/stable/2.2.x.tar.gz#egg=django
djmaster: https://github.com/django/django/archive/master.tar.gz#egg=django
commands = python setup.py test
[testenv:docs]
commands = python setup.py build_sphinx -W -b doctest -b html
[flake8]
max-line-length = 120
max-complexity = 10
statistics = true
show-source = true
exclude = docs,runtests.py,setup.py,.tox,env
[pep257]
match = (?!setup).*.py
match-dir = (?!tests|env|docs|\.).*
[pydocstyle]
add_ignore = D1
[isort]
atomic = true
multi_line_output = 5
line_length = 79
skip = manage.py,docs,.tox,env
known_first_party = django_select2, tests
known_third_party = django
default_section=THIRDPARTY
combine_as_imports = true
[bdist_rpm]
requires = python-django-appconf >= 0.6

View file

@ -2,7 +2,4 @@
from setuptools import setup
setup(
setup_requires=['pbr'],
pbr=True,
)
setup(version_format='{tag}')

View file

@ -20,12 +20,6 @@ INSTALLED_APPS = (
'tests.testapp',
)
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
@ -50,14 +44,3 @@ SECRET_KEY = '123456'
USE_L10N = True
USE_I18N = True
if os.environ.get('TRAVIS'):
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}

23
tox.ini
View file

@ -1,23 +0,0 @@
[tox]
envlist = py{35,36,37}-dj{20,21,22,master},docs
[testenv]
setenv=
PYTHONPATH = {toxinidir}
passenv=CI
deps=
-rrequirements-dev.txt
dj20: https://github.com/django/django/archive/stable/2.0.x.tar.gz#egg=django
dj21: https://github.com/django/django/archive/stable/2.1.x.tar.gz#egg=django
dj22: https://github.com/django/django/archive/stable/2.2.x.tar.gz#egg=django
djmaster: https://github.com/django/django/archive/master.tar.gz#egg=django
commands=
coverage run --source=django_select2 -m 'pytest' \
--basetemp={envtmpdir} \
--ignore=.tox \
{posargs}
[testenv:docs]
deps=
-rrequirements-dev.txt
https://github.com/django/django/archive/stable/2.2.x.tar.gz#egg=django
commands=python setup.py build_sphinx