Skip to content

Commit

Permalink
breaking: Remove deprecated contrib redirections
Browse files Browse the repository at this point in the history
After this commit the following imports will no longer work

    import luigi.s3
    import luigi.postgres

Instead use

    import luigi.contrib.{s3,postgres}

This is a continution on spotify#1997
  • Loading branch information
Tarrasch committed Jul 12, 2017
1 parent c87e32b commit 64f8d98
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 71 deletions.
2 changes: 1 addition & 1 deletion doc/workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In practice, implementing Target subclasses is rarely needed.
Luigi comes with a toolbox of several useful Targets.
In particular, :class:`~luigi.file.LocalTarget` and :class:`~luigi.contrib.hdfs.target.HdfsTarget`,
but there is also support for other file systems:
:class:`luigi.s3.S3Target`,
:class:`luigi.contrib.s3.S3Target`,
:class:`luigi.contrib.ssh.RemoteTarget`,
:class:`luigi.contrib.ftp.RemoteTarget`,
:class:`luigi.contrib.mysqldb.MySqlTarget`,
Expand Down
2 changes: 1 addition & 1 deletion examples/pyspark_wc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#
import luigi
from luigi.s3 import S3Target
from luigi.contrib.s3 import S3Target
from luigi.contrib.spark import SparkSubmitTask, PySparkTask


Expand Down
7 changes: 4 additions & 3 deletions examples/top_artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,13 @@ def _input_iterator(self):

class ArtistToplistToDatabase(luigi.contrib.postgres.CopyToTable):
"""
This task runs a :py:class:`luigi.postgres.CopyToTable` task
This task runs a :py:class:`luigi.contrib.postgres.CopyToTable` task
over the target data returned by :py:meth:`~/.Top10Artists.output` and
writes the result into its :py:meth:`~.ArtistToplistToDatabase.output` target which,
by default, is :py:class:`luigi.postgres.PostgresTarget` (a table in PostgreSQL).
by default, is :py:class:`luigi.contrib.postgres.PostgresTarget` (a table in PostgreSQL).
This class uses :py:meth:`luigi.postgres.CopyToTable.run` and :py:meth:`luigi.postgres.CopyToTable.output`.
This class uses :py:meth:`luigi.contrib.postgres.CopyToTable.run`
and :py:meth:`luigi.contrib.postgres.CopyToTable.output`.
"""

date_interval = luigi.DateIntervalParameter()
Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from luigi.file import LocalTarget
from luigi.mock import MockTarget
from luigi.s3 import S3Target
from luigi.contrib.s3 import S3Target
from luigi.target import FileSystemException
from six.moves.urllib.parse import urlsplit, parse_qs

Expand Down
4 changes: 2 additions & 2 deletions luigi/contrib/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import os

import luigi
from luigi import postgres
from luigi.contrib import postgres
from luigi.contrib import rdbms
from luigi.s3 import S3PathTask, S3Target
from luigi.contrib.s3 import S3PathTask, S3Target

logger = logging.getLogger('luigi-interface')

Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def __copy_multipart(self, pool, src_bucket, src_key, dst_bucket, dst_key, part_
"""
Copy a single S3 object to another S3 object, falling back to multipart copy where necessary
NOTE: This is a private method and should only be called from within the `luigi.s3.copy` method
NOTE: This is a private method and should only be called from within the `s3.copy` method
:param pool: The threadpool to put the s3 copy processes onto
:param src_bucket: source bucket name
Expand Down
26 changes: 0 additions & 26 deletions luigi/postgres.py

This file was deleted.

26 changes: 0 additions & 26 deletions luigi/s3.py

This file was deleted.

4 changes: 2 additions & 2 deletions luigi/tools/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
from __future__ import print_function
import luigi.interface
from luigi.contrib.ssh import RemoteTarget
from luigi.postgres import PostgresTarget
from luigi.s3 import S3Target
from luigi.contrib.postgres import PostgresTarget
from luigi.contrib.s3 import S3Target
from luigi.target import FileSystemTarget
from luigi.task import flatten
from luigi import parameter
Expand Down
4 changes: 2 additions & 2 deletions test/contrib/opener_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_local_tmp_target(self, lt_del_patch, lt_init_patch):
OpenerTarget(local_file)
lt_init_patch.assert_called_with(self.local_file, is_tmp=True)

@mock.patch('luigi.s3.S3Target.__init__')
@mock.patch('luigi.contrib.s3.S3Target.__init__')
def test_s3_parse(self, s3_init_patch):
'''Verify basic s3 target url
Expand All @@ -100,7 +100,7 @@ def test_s3_parse(self, s3_init_patch):
OpenerTarget(local_file)
s3_init_patch.assert_called_with("s3://zefr/foo/bar.txt")

@mock.patch('luigi.s3.S3Target.__init__')
@mock.patch('luigi.contrib.s3.S3Target.__init__')
def test_s3_parse_param(self, s3_init_patch):
'''Verify s3 target url with params
Expand Down
6 changes: 3 additions & 3 deletions test/contrib/postgres_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import datetime
import luigi
import luigi.postgres
import luigi.contrib.postgres
from luigi.tools.range import RangeDaily
from helpers import unittest
import mock
Expand Down Expand Up @@ -44,7 +44,7 @@ def fetchone(self):
return self.fetchone_result


class DummyPostgresImporter(luigi.postgres.CopyToTable):
class DummyPostgresImporter(luigi.contrib.postgres.CopyToTable):
date = luigi.DateParameter()

host = 'dummy_host'
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_bulk_complete(self, mock_connect):
self.assertFalse(task.complete())


class DummyPostgresQuery(luigi.postgres.PostgresQuery):
class DummyPostgresQuery(luigi.contrib.postgres.PostgresQuery):
date = luigi.DateParameter()

host = 'dummy_host'
Expand Down
2 changes: 1 addition & 1 deletion test/contrib/postgres_with_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import luigi
import luigi.notifications
from luigi import postgres
from luigi.contrib import postgres

"""
Typical use cases that should be tested:
Expand Down
2 changes: 1 addition & 1 deletion test/contrib/s3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from moto import mock_sts

from luigi import configuration
from luigi.s3 import FileNotFoundException, InvalidDeleteException, S3Client, S3Target
from luigi.contrib.s3 import FileNotFoundException, InvalidDeleteException, S3Client, S3Target
from luigi.target import MissingParentDirectory

if (3, 4, 0) <= sys.version_info[:3] < (3, 4, 3):
Expand Down
2 changes: 1 addition & 1 deletion test/redshift_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from luigi.contrib import redshift
from moto import mock_s3
from boto.s3.key import Key
from luigi.s3 import S3Client
from luigi.contrib.s3 import S3Client


if (3, 4, 0) <= sys.version_info[:3] < (3, 4, 3):
Expand Down

0 comments on commit 64f8d98

Please sign in to comment.