Skip to content

Commit

Permalink
Merge pull request #454 from Amertz08/extra-requires
Browse files Browse the repository at this point in the history
Move optional dependencies to extras
  • Loading branch information
mpenkov authored Apr 7, 2020
2 parents 6e880bd + 8c56208 commit 085ab22
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 9 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ Installation
------------
::

pip install smart_open
pip install smart_open // Install with no cloud dependencies
pip install smart_open[aws] // Install AWS deps
pip install smart_open[gcp] // Install GCP deps
pip install smart_open[all] // Installs all cloud dependencies

Or, if you prefer to install from the `source tar.gz <http://pypi.python.org/pypi/smart_open>`_::

Expand All @@ -122,6 +125,11 @@ The tests are also run automatically with `Travis CI <https://travis-ci.org/RaRe

If you're upgrading from ``smart_open`` versions 1.8.0 and below, please check out the `Migration Guide <MIGRATING_FROM_OLDER_VERSIONS.rst>`_.

Version ``2.0`` will introduce a backwards incompatible installation method with regards to the cloud dependencies. A migration path to minimize breaking
was introduced in version ``x.x.x``. If you want to maintain backwards compatibility (installing all dependencies) install this package via ``smart_open[all]`` now
and once the change is made you should not have any issues. If all you care about is AWS dependencies for example you can install via ``smart_open[aws]`` and
once the dependency change is made you will simply drop the unwanted dependencies. You can read more about the motivations `here <https://github.com/RaRe-Technologies/smart_open/issues/443>`_


Built-in help
-------------
Expand Down
15 changes: 12 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ def read(fname):

install_requires = [
'requests',
'boto3',
'google-cloud-storage',
]

aws_deps = ['boto3']
gcp_deps = ['google-cloud-storage']

all_deps = install_requires + aws_deps + gcp_deps

setup(
name='smart_open',
version=__version__,
Expand All @@ -81,10 +84,16 @@ def read(fname):
license='MIT',
platforms='any',

install_requires=install_requires,
# Concatenating the lists together is temporary and will
# eventually simply be install_requires dropping the cloud
# dependencies from being installed without explicitly being declared.
install_requires=install_requires + aws_deps,
tests_require=tests_require,
extras_require={
'test': tests_require,
'aws': aws_deps,
'gcp': gcp_deps,
'all': all_deps,
},

test_suite="smart_open.tests",
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ whitelist_externals =
bash

deps =
.[all]
.[test]

integration: numpy
Expand Down Expand Up @@ -76,6 +77,7 @@ commands = ./travis_ci_helpers.sh disable_moto_server
skip_install = True
recreate = False
deps =
.[all]
.[test]
pytest-cov
coveralls
Expand Down

0 comments on commit 085ab22

Please sign in to comment.