Merge pull request #219 from jazzband/feature/add-extras-require

Add extras for optional requirements
This commit is contained in:
Peter Bittner 2018-12-09 16:14:45 +01:00 committed by GitHub
commit efea2224da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 22 deletions

View file

@ -3,4 +3,5 @@ Gilles Fabio
Jannis Leidel Jannis Leidel
Marc Abramowitz Marc Abramowitz
Michael van Tellingen Michael van Tellingen
Mike Fogel Mike Fogel
Peter Bittner

View file

@ -32,6 +32,12 @@ Install django-configurations:
pip install django-configurations pip install django-configurations
or, alternatively, if you want to use URL-based values:
.. code-block:: console
pip install django-configurations[cache,database,email,search]
Then subclass the included ``configurations.Configuration`` class in your Then subclass the included ``configurations.Configuration`` class in your
project's **settings.py** or any other module you're using to store the project's **settings.py** or any other module you're using to store the
settings constants, e.g.: settings constants, e.g.:

View file

@ -124,8 +124,8 @@ class ConfigurationImporter(object):
def stylize(text): def stylize(text):
return colorize(text, fg='green') return colorize(text, fg='green')
if (self.argv[1] == 'runserver' and if self.argv[1] == 'runserver' \
os.environ.get('RUN_MAIN') == 'true'): and os.environ.get('RUN_MAIN') == 'true':
message = ("django-configurations version {0}, using " message = ("django-configurations version {0}, using "
"configuration '{1}'".format(__version__, "configuration '{1}'".format(__version__,

View file

@ -52,8 +52,8 @@ class Value(object):
instance.late_binding = kwargs.get('late_binding') instance.late_binding = kwargs.get('late_binding')
if not instance.late_binding: if not instance.late_binding:
instance.__init__(*args, **kwargs) instance.__init__(*args, **kwargs)
if ((instance.environ and instance.environ_name) or if (instance.environ and instance.environ_name) \
(not instance.environ and instance.default)): or (not instance.environ and instance.default):
instance = instance.setup(instance.environ_name) instance = instance.setup(instance.environ_name)
return instance return instance

View file

@ -41,6 +41,22 @@ setup(
'django-cadmin = configurations.management:execute_from_command_line', 'django-cadmin = configurations.management:execute_from_command_line',
], ],
}, },
extras_require={
'cache': ['django-cache-url'],
'database': ['dj-database-url'],
'email': ['dj-email-url'],
'search': ['dj-search-url'],
'testing': [
'django-discover-runner',
'mock',
'django-cache-url>=1.0.0',
'dj-database-url',
'dj-email-url',
'dj-search-url',
'six',
'Sphinx>=1.4',
],
},
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Framework :: Django', 'Framework :: Django',
@ -49,10 +65,9 @@ setup(
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Utilities', 'Topic :: Utilities',
], ],
zip_safe=False, zip_safe=False,

View file

@ -1,8 +0,0 @@
django-discover-runner
mock
dj-database-url
dj-email-url
dj-search-url
django-cache-url>=1.0.0
six
Sphinx>=1.4

13
tox.ini
View file

@ -1,8 +1,8 @@
[tox] [tox]
skipsdist = True skipsdist = true
usedevelop = True usedevelop = true
minversion = 1.8 minversion = 1.8
whitelist_externals=sphinx-build whitelist_externals = sphinx-build
envlist = envlist =
flake8-py27, flake8-py27,
flake8-py36, flake8-py36,
@ -19,7 +19,6 @@ setenv =
coverage: COVERAGE_PROCESS_START = {toxinidir}/setup.cfg coverage: COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
coverage: _TEST_RUN_PREFIX=coverage run coverage: _TEST_RUN_PREFIX=coverage run
deps = deps =
-rtests/requirements.txt
dj18: django>=1.8,<1.9 dj18: django>=1.8,<1.9
dj110: django>=1.10,<1.11 dj110: django>=1.10,<1.11
dj111: django>=1.11,<2.0 dj111: django>=1.11,<2.0
@ -29,7 +28,7 @@ deps =
py27,pypy: mock py27,pypy: mock
coverage: coverage coverage: coverage
coverage: coverage_enable_subprocess coverage: coverage_enable_subprocess
extras = testing
commands = commands =
python --version python --version
{env:_TEST_RUN_PREFIX:} {envbindir}/django-cadmin test -v2 {posargs:tests} {env:_TEST_RUN_PREFIX:} {envbindir}/django-cadmin test -v2 {posargs:tests}
@ -49,5 +48,5 @@ commands = flake8 configurations tests
deps = flake8 deps = flake8
[flake8] [flake8]
exclude=.tox exclude = .tox
ignore=E501,E127,E128,E124 ignore = E501,E127,E128,E124