Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get a subscription from a topic #912

Closed
jgeewax opened this issue Jun 6, 2015 · 4 comments
Closed

Get a subscription from a topic #912

jgeewax opened this issue Jun 6, 2015 · 4 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API.

Comments

@jgeewax
Copy link
Contributor

jgeewax commented Jun 6, 2015

In pubsub-usage.rst we have:

client = pubsub.Client()
topic = client.topic('topic-name')
sub = pubsub.Subscription('sub-name', topic)

I think we should consider changing this to

client = pubsub.Client()
topic = client.topic('topic-name')
sub = topic.subscription('sub-name')
@jgeewax jgeewax added the api: pubsub Issues related to the Pub/Sub API. label Jun 6, 2015
@dhermes
Copy link
Contributor

dhermes commented Jun 6, 2015

I am 👍

@tseaver WDYT?

@tseaver
Copy link
Contributor

tseaver commented Jun 9, 2015

Given that we advertise client.topic() as the "normal" way to instantiate Topic, this would be more consistent.

@dhermes
Copy link
Contributor

dhermes commented Jun 9, 2015

@tseaver I'm trying to incorporate this into #910 and Pylint is not happy about cylic-import. I even move the imports from global down to the methods which use them as

# In topic.py
        # pylint: disable=cyclic-import
        from gcloud.pubsub.subscription import Subscription
        # pylint: enable=cyclic-import
# In subscription.py
        # pylint: disable=cyclic-import
        from gcloud.pubsub.topic import Topic
        # pylint: enable=cyclic-import

and it still complains.

Thoughts?

@dhermes
Copy link
Contributor

dhermes commented Jul 2, 2015

Ended up solving by factoring out the behavior in the from_api_repr factories into a shared helper library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API.
Projects
None yet
Development

No branches or pull requests

3 participants