Skip to content

Commit

Permalink
Merge pull request #219 from jazzband/feature/add-extras-require
Browse files Browse the repository at this point in the history
Add extras for optional requirements
  • Loading branch information
bittner committed Dec 9, 2018
2 parents cfdaf6c + 06f2d57 commit efea222
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 22 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Gilles Fabio
Jannis Leidel
Marc Abramowitz
Michael van Tellingen
Mike Fogel
Mike Fogel
Peter Bittner
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ 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
project's **settings.py** or any other module you're using to store the
settings constants, e.g.:
Expand Down
4 changes: 2 additions & 2 deletions configurations/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def announce(self):
def stylize(text):
return colorize(text, fg='green')

if (self.argv[1] == 'runserver' and
os.environ.get('RUN_MAIN') == 'true'):
if self.argv[1] == 'runserver' \
and os.environ.get('RUN_MAIN') == 'true':

message = ("django-configurations version {0}, using "
"configuration '{1}'".format(__version__,
Expand Down
4 changes: 2 additions & 2 deletions configurations/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def __new__(cls, *args, **kwargs):
instance.late_binding = kwargs.get('late_binding')
if not instance.late_binding:
instance.__init__(*args, **kwargs)
if ((instance.environ and instance.environ_name) or
(not instance.environ and instance.default)):
if (instance.environ and instance.environ_name) \
or (not instance.environ and instance.default):
instance = instance.setup(instance.environ_name)
return instance

Expand Down
19 changes: 17 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ def find_version(*parts):
'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=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
Expand All @@ -49,10 +65,9 @@ def find_version(*parts):
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Utilities',
],
zip_safe=False,
Expand Down
8 changes: 0 additions & 8 deletions tests/requirements.txt

This file was deleted.

13 changes: 6 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
skipsdist = True
usedevelop = True
skipsdist = true
usedevelop = true
minversion = 1.8
whitelist_externals=sphinx-build
whitelist_externals = sphinx-build
envlist =
flake8-py27,
flake8-py36,
Expand All @@ -19,7 +19,6 @@ setenv =
coverage: COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
coverage: _TEST_RUN_PREFIX=coverage run
deps =
-rtests/requirements.txt
dj18: django>=1.8,<1.9
dj110: django>=1.10,<1.11
dj111: django>=1.11,<2.0
Expand All @@ -29,7 +28,7 @@ deps =
py27,pypy: mock
coverage: coverage
coverage: coverage_enable_subprocess

extras = testing
commands =
python --version
{env:_TEST_RUN_PREFIX:} {envbindir}/django-cadmin test -v2 {posargs:tests}
Expand All @@ -49,5 +48,5 @@ commands = flake8 configurations tests
deps = flake8

[flake8]
exclude=.tox
ignore=E501,E127,E128,E124
exclude = .tox
ignore = E501,E127,E128,E124

0 comments on commit efea222

Please sign in to comment.