Merge lp:~leonardr/launchpadlib/multiversion into lp:launchpadlib

Proposed by Leonard Richardson
Status: Merged
Approved by: Eleanor Berger
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~leonardr/launchpadlib/multiversion
Merge into: lp:launchpadlib
Diff against target: 225 lines (+39/-26)
7 files modified
setup.py (+1/-1)
src/launchpadlib/__init__.py (+1/-1)
src/launchpadlib/docs/introduction.txt (+1/-1)
src/launchpadlib/launchpad.py (+18/-10)
src/launchpadlib/testing/helpers.py (+8/-4)
src/launchpadlib/tests/test_launchpad.py (+3/-2)
src/launchpadlib/uris.py (+7/-7)
To merge this branch: bzr merge lp:~leonardr/launchpadlib/multiversion
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Review via email: mp+19343@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote :

This branch changes launchpadlib to take advantage of lazr.restful's 'version' constructor argument. Instead of a service root of http://api.launchpad.net/beta/, you now use a service root of http://api.launchpad.net/ and a version of "beta". This makes it much easier to specify which version of a web service you want to use.

This branch also changes the default version of the web service to 'devel'. Here is the plan (not yet ratified by distro developers):

1. We get a launchpadlib release based on this branch into Lucid before the feature freeze. At this point anyone who writes launchpadlib scripts with beta versions of Lucid will be using the unstable 'devel' version of the web service.

2. Before Lucid is released, we make some changes to the Launchpad web service and freeze a '1.0' release.

3. We make a small launchpadlib release that does nothing but change the default web service version to '1.0'. Anyone who writes launchpadlib scripts with the released
version of Lucid will be using the frozen '1.0' version of the web service.

This is flacoste's plan; I would prefer to change the default web service version to '1.0' in this branch, and not mess with Lucid any more after this.

Either way, by releasing a '1.0' version of the web service and tying it to Lucid, we will be able to retire the 'beta' version when we retire Karmic. If we don't get this done, we won't be able to retire the 'beta' version until we retire Lucid.

Revision history for this message
Leonard Richardson (leonardr) wrote :

s/lazr.restful/lazr.restfulclient/ in the above.

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve (code)
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

On February 15, 2010, Leonard Richardson wrote:
> Leonard Richardson has proposed merging
> lp:~leonardr/launchpadlib/multiversion into lp:launchpadlib.
>
> Requested reviews:
> LAZR Developers (lazr-developers)
>
>
> This branch changes launchpadlib to take advantage of lazr.restful's
> 'version' constructor argument. Instead of a service root of
> http://api.launchpad.net/beta/, you now use a service root of
> http://api.launchpad.net/ and a version of "beta". This makes it much
> easier to specify which version of a web service you want to use.
>
> This branch also changes the default version of the web service to 'devel'.
> Here is the plan (not yet ratified by distro developers):
>
> 1. We get a launchpadlib release based on this branch into Lucid before the
> feature freeze. At this point anyone who writes launchpadlib scripts with
> beta versions of Lucid will be using the unstable 'devel' version of the
> web service.
>
> 2. Before Lucid is released, we make some changes to the Launchpad web
> service and freeze a '1.0' release.
>
> 3. We make a small launchpadlib release that does nothing but change the
> default web service version to '1.0'. Anyone who writes launchpadlib
> scripts with the released version of Lucid will be using the frozen '1.0'
> version of the web service.
>
> This is flacoste's plan; I would prefer to change the default web service
> version to '1.0' in this branch, and not mess with Lucid any more after
> this.
>
> Either way, by releasing a '1.0' version of the web service and tying it to
> Lucid, we will be able to retire the 'beta' version when we retire Karmic.
> If we don't get this done, we won't be able to retire the 'beta' version
> until we retire Lucid.
>

The default for production should still be beta, at least until this code is
deployed to production. Otherwise, anybody will get breakage when they try
launchpadlib on lpnet.

--
Francis J. Lacoste
<email address hidden>

Revision history for this message
Leonard Richardson (leonardr) wrote :

"The default for production should still be beta, at least until this code is
deployed to production. Otherwise, anybody will get breakage when they try
launchpadlib on lpnet."

Then maybe the launchpadlib default should continue to be "beta", and once we're ready, we can change it to "1.0". Rather than changing it to "devel" and then to "1.0".

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

On February 16, 2010, Leonard Richardson wrote:
> "The default for production should still be beta, at least until this code
> is deployed to production. Otherwise, anybody will get breakage when they
> try launchpadlib on lpnet."
>
> Then maybe the launchpadlib default should continue to be "beta", and once
> we're ready, we can change it to "1.0". Rather than changing it to "devel"
> and then to "1.0".

It's really something to discuss with the Ubuntu release team. Each scenario
has different trade-off in expectations management.

--
Francis J. Lacoste
<email address hidden>

Revision history for this message
Leonard Richardson (leonardr) wrote :

On further reflection I believe this point is moot. Right now, the "devel" version isn't deployed any more than the "1.0" version is. https://edge.launchpad.net/api/devel leads to a 404. If we want Lucid developers to be able to use launchpadlib, we have to give them "beta" by default until "1.0" and "devel" are deployed. At that point we might as well give them "1.0".

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2009-11-03 13:50:27 +0000
+++ setup.py 2010-02-15 16:44:17 +0000
@@ -60,7 +60,7 @@
60 license='LGPL v3',60 license='LGPL v3',
61 install_requires=[61 install_requires=[
62 'httplib2',62 'httplib2',
63 'lazr.restfulclient>=0.9.10',63 'lazr.restfulclient>=0.9.11',
64 'lazr.uri',64 'lazr.uri',
65 'oauth',65 'oauth',
66 'setuptools',66 'setuptools',
6767
=== modified file 'src/launchpadlib/__init__.py'
--- src/launchpadlib/__init__.py 2009-12-17 13:13:42 +0000
+++ src/launchpadlib/__init__.py 2010-02-15 16:44:17 +0000
@@ -14,4 +14,4 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with launchpadlib. If not, see <http://www.gnu.org/licenses/>.15# along with launchpadlib. If not, see <http://www.gnu.org/licenses/>.
1616
17__version__ = '1.5.4'17__version__ = '1.5.5'
1818
=== modified file 'src/launchpadlib/docs/introduction.txt'
--- src/launchpadlib/docs/introduction.txt 2009-12-17 17:26:30 +0000
+++ src/launchpadlib/docs/introduction.txt 2010-02-15 16:44:17 +0000
@@ -299,7 +299,7 @@
299service. Earlier we used 'test_dev' as shorthand for the website URL,299service. Earlier we used 'test_dev' as shorthand for the website URL,
300and like in that earlier case, launchpadlib will internally300and like in that earlier case, launchpadlib will internally
301dereference 'test_dev' into the service root URL, defined in the301dereference 'test_dev' into the service root URL, defined in the
302'uris' module as "http://api.launchpad.dev:8085/beta".302'uris' module as "http://api.launchpad.dev:8085/".
303303
304 >>> consumer_name = 'launchpadlib'304 >>> consumer_name = 'launchpadlib'
305 >>> launchpad = Launchpad.get_token_and_login(305 >>> launchpad = Launchpad.get_token_and_login(
306306
=== modified file 'src/launchpadlib/launchpad.py'
--- src/launchpadlib/launchpad.py 2009-12-17 20:27:18 +0000
+++ src/launchpadlib/launchpad.py 2010-02-15 16:44:17 +0000
@@ -76,6 +76,8 @@
76 :type credentials: `Credentials`76 :type credentials: `Credentials`
77 """77 """
7878
79 DEFAULT_VERSION = 'devel'
80
79 RESOURCE_TYPE_CLASSES = {81 RESOURCE_TYPE_CLASSES = {
80 'bugs': BugSet,82 'bugs': BugSet,
81 'distributions': PillarSet,83 'distributions': PillarSet,
@@ -86,7 +88,8 @@
86 }88 }
8789
88 def __init__(self, credentials, service_root=uris.STAGING_SERVICE_ROOT,90 def __init__(self, credentials, service_root=uris.STAGING_SERVICE_ROOT,
89 cache=None, timeout=None, proxy_info=None):91 cache=None, timeout=None, proxy_info=None,
92 version=DEFAULT_VERSION):
90 """Root access to the Launchpad API.93 """Root access to the Launchpad API.
9194
92 :param credentials: The credentials used to access Launchpad.95 :param credentials: The credentials used to access Launchpad.
@@ -96,12 +99,13 @@
96 """99 """
97 service_root = uris.lookup_service_root(service_root)100 service_root = uris.lookup_service_root(service_root)
98 super(Launchpad, self).__init__(101 super(Launchpad, self).__init__(
99 credentials, service_root, cache, timeout, proxy_info)102 credentials, service_root, cache, timeout, proxy_info, version)
100103
101 @classmethod104 @classmethod
102 def login(cls, consumer_name, token_string, access_secret,105 def login(cls, consumer_name, token_string, access_secret,
103 service_root=uris.STAGING_SERVICE_ROOT,106 service_root=uris.STAGING_SERVICE_ROOT,
104 cache=None, timeout=None, proxy_info=None):107 cache=None, timeout=None, proxy_info=None,
108 version=DEFAULT_VERSION):
105 """Convenience for setting up access credentials.109 """Convenience for setting up access credentials.
106110
107 When all three pieces of credential information (the consumer111 When all three pieces of credential information (the consumer
@@ -125,14 +129,16 @@
125 access_token = AccessToken(token_string, access_secret)129 access_token = AccessToken(token_string, access_secret)
126 credentials = Credentials(130 credentials = Credentials(
127 consumer_name=consumer_name, access_token=access_token)131 consumer_name=consumer_name, access_token=access_token)
128 return cls(credentials, service_root, cache, timeout, proxy_info)132 return cls(credentials, service_root, cache, timeout, proxy_info,
133 version)
129134
130 @classmethod135 @classmethod
131 def get_token_and_login(cls, consumer_name,136 def get_token_and_login(cls, consumer_name,
132 service_root=uris.STAGING_SERVICE_ROOT,137 service_root=uris.STAGING_SERVICE_ROOT,
133 cache=None, timeout=None, proxy_info=None,138 cache=None, timeout=None, proxy_info=None,
134 authorizer_class=AuthorizeRequestTokenWithBrowser,139 authorizer_class=AuthorizeRequestTokenWithBrowser,
135 allow_access_levels=[], max_failed_attempts=3):140 allow_access_levels=[], max_failed_attempts=3,
141 version=DEFAULT_VERSION):
136 """Get credentials from Launchpad and log into the service root.142 """Get credentials from Launchpad and log into the service root.
137143
138 This is a convenience method which will open up the user's preferred144 This is a convenience method which will open up the user's preferred
@@ -170,19 +176,21 @@
170 max_failed_attempts)176 max_failed_attempts)
171 authorizer()177 authorizer()
172 credentials.exchange_request_token_for_access_token(web_root)178 credentials.exchange_request_token_for_access_token(web_root)
173 return cls(credentials, service_root, cache, timeout, proxy_info)179 return cls(credentials, service_root, cache, timeout, proxy_info,
180 version)
174181
175 @classmethod182 @classmethod
176 def login_anonymously(183 def login_anonymously(
177 cls, consumer_name, service_root=uris.STAGING_SERVICE_ROOT,184 cls, consumer_name, service_root=uris.STAGING_SERVICE_ROOT,
178 launchpadlib_dir=None, timeout=None, proxy_info=None):185 launchpadlib_dir=None, timeout=None, proxy_info=None,
186 version=DEFAULT_VERSION):
179 """Get access to Launchpad without providing any credentials."""187 """Get access to Launchpad without providing any credentials."""
180 (service_root, launchpadlib_dir, cache_path,188 (service_root, launchpadlib_dir, cache_path,
181 service_root_dir) = cls._get_paths(service_root, launchpadlib_dir)189 service_root_dir) = cls._get_paths(service_root, launchpadlib_dir)
182 token = AnonymousAccessToken()190 token = AnonymousAccessToken()
183 credentials = Credentials(consumer_name, access_token=token)191 credentials = Credentials(consumer_name, access_token=token)
184 return cls(credentials, service_root=service_root, cache=cache_path,192 return cls(credentials, service_root=service_root, cache=cache_path,
185 timeout=timeout, proxy_info=proxy_info)193 timeout=timeout, proxy_info=proxy_info, version=version)
186194
187 @classmethod195 @classmethod
188 def login_with(cls, consumer_name,196 def login_with(cls, consumer_name,
@@ -190,7 +198,7 @@
190 launchpadlib_dir=None, timeout=None, proxy_info=None,198 launchpadlib_dir=None, timeout=None, proxy_info=None,
191 authorizer_class=AuthorizeRequestTokenWithBrowser,199 authorizer_class=AuthorizeRequestTokenWithBrowser,
192 allow_access_levels=[], max_failed_attempts=3,200 allow_access_levels=[], max_failed_attempts=3,
193 credentials_file=None):201 credentials_file=None, version=DEFAULT_VERSION):
194 """Log in to Launchpad with possibly cached credentials.202 """Log in to Launchpad with possibly cached credentials.
195203
196 This is a convenience method for either setting up new login204 This is a convenience method for either setting up new login
@@ -247,7 +255,7 @@
247 timeout=timeout, proxy_info=proxy_info,255 timeout=timeout, proxy_info=proxy_info,
248 authorizer_class=authorizer_class,256 authorizer_class=authorizer_class,
249 allow_access_levels=allow_access_levels,257 allow_access_levels=allow_access_levels,
250 max_failed_attempts=max_failed_attempts)258 max_failed_attempts=max_failed_attempts, version=version)
251 launchpad.credentials.save_to_path(consumer_credentials_path)259 launchpad.credentials.save_to_path(consumer_credentials_path)
252 os.chmod(consumer_credentials_path, stat.S_IREAD | stat.S_IWRITE)260 os.chmod(consumer_credentials_path, stat.S_IREAD | stat.S_IWRITE)
253 return launchpad261 return launchpad
254262
=== modified file 'src/launchpadlib/testing/helpers.py'
--- src/launchpadlib/testing/helpers.py 2009-12-17 16:52:54 +0000
+++ src/launchpadlib/testing/helpers.py 2010-02-15 16:44:17 +0000
@@ -39,9 +39,11 @@
39 """A base class for talking to the testing root service."""39 """A base class for talking to the testing root service."""
4040
41 def __init__(self, credentials, service_root=None,41 def __init__(self, credentials, service_root=None,
42 cache=None, timeout=None, proxy_info=None):42 cache=None, timeout=None, proxy_info=None,
43 version=Launchpad.DEFAULT_VERSION):
43 super(TestableLaunchpad, self).__init__(44 super(TestableLaunchpad, self).__init__(
44 credentials, 'test_dev', cache, timeout, proxy_info)45 credentials, 'test_dev', cache, timeout, proxy_info,
46 version=version)
4547
4648
47class KnownTokens:49class KnownTokens:
@@ -51,11 +53,13 @@
51 self.token_string = token_string53 self.token_string = token_string
52 self.access_secret = access_secret54 self.access_secret = access_secret
5355
54 def login(self, cache=None, timeout=None, proxy_info=None):56 def login(self, cache=None, timeout=None, proxy_info=None,
57 version=Launchpad.DEFAULT_VERSION):
55 """Login using these credentials."""58 """Login using these credentials."""
56 return TestableLaunchpad.login(59 return TestableLaunchpad.login(
57 'launchpad-library', self.token_string, self.access_secret,60 'launchpad-library', self.token_string, self.access_secret,
58 cache=cache, timeout=timeout, proxy_info=proxy_info)61 cache=cache, timeout=timeout, proxy_info=proxy_info,
62 version=version)
5963
6064
61salgado_with_full_permissions = KnownTokens('salgado-change-anything', 'test')65salgado_with_full_permissions = KnownTokens('salgado-change-anything', 'test')
6266
=== modified file 'src/launchpadlib/tests/test_launchpad.py'
--- src/launchpadlib/tests/test_launchpad.py 2009-12-17 18:45:49 +0000
+++ src/launchpadlib/tests/test_launchpad.py 2010-02-15 16:44:17 +0000
@@ -164,7 +164,8 @@
164 service_root=service_root,164 service_root=service_root,
165 timeout=timeout,165 timeout=timeout,
166 proxy_info=proxy_info,166 proxy_info=proxy_info,
167 cache=os.path.join(self.temp_dir, 'api.example.com', 'cache'))167 cache=os.path.join(self.temp_dir, 'api.example.com', 'cache'),
168 version='devel')
168 self.assertEqual(launchpad.passed_in_kwargs, expected_arguments)169 self.assertEqual(launchpad.passed_in_kwargs, expected_arguments)
169170
170 def test_anonymous_login(self):171 def test_anonymous_login(self):
@@ -287,7 +288,7 @@
287 launchpad = NoNetworkLaunchpad.login_with('app name', 'staging')288 launchpad = NoNetworkLaunchpad.login_with('app name', 'staging')
288 self.assertEqual(289 self.assertEqual(
289 launchpad.passed_in_kwargs['service_root'],290 launchpad.passed_in_kwargs['service_root'],
290 'https://api.staging.launchpad.net/beta/')291 'https://api.staging.launchpad.net/')
291292
292 # A full URL as the service name is left alone.293 # A full URL as the service name is left alone.
293 launchpad = NoNetworkLaunchpad.login_with(294 launchpad = NoNetworkLaunchpad.login_with(
294295
=== modified file 'src/launchpadlib/uris.py'
--- src/launchpadlib/uris.py 2009-12-17 16:52:54 +0000
+++ src/launchpadlib/uris.py 2010-02-15 16:44:17 +0000
@@ -17,7 +17,7 @@
17"""Launchpad-specific URIs and convenience lookup functions.17"""Launchpad-specific URIs and convenience lookup functions.
1818
19The code in this module lets users say "edge" when they mean19The code in this module lets users say "edge" when they mean
20"https://api.edge.launchpad.net/beta".20"https://api.edge.launchpad.net/".
21"""21"""
2222
23__metaclass__ = type23__metaclass__ = type
@@ -28,12 +28,12 @@
2828
29from urlparse import urlparse29from urlparse import urlparse
3030
31LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'31LPNET_SERVICE_ROOT = 'https://api.launchpad.net/'
32EDGE_SERVICE_ROOT = 'https://api.edge.launchpad.net/beta/'32EDGE_SERVICE_ROOT = 'https://api.edge.launchpad.net/'
33STAGING_SERVICE_ROOT = 'https://api.staging.launchpad.net/beta/'33STAGING_SERVICE_ROOT = 'https://api.staging.launchpad.net/'
34DEV_SERVICE_ROOT = 'https://api.launchpad.dev/beta/'34DEV_SERVICE_ROOT = 'https://api.launchpad.dev/'
35DOGFOOD_SERVICE_ROOT = 'https://api.dogfood.launchpad.net/beta/'35DOGFOOD_SERVICE_ROOT = 'https://api.dogfood.launchpad.net/'
36TEST_DEV_SERVICE_ROOT = 'http://api.launchpad.dev:8085/beta/'36TEST_DEV_SERVICE_ROOT = 'http://api.launchpad.dev:8085/'
3737
38LPNET_WEB_ROOT = 'https://launchpad.net/'38LPNET_WEB_ROOT = 'https://launchpad.net/'
39EDGE_WEB_ROOT = 'https://edge.launchpad.net/'39EDGE_WEB_ROOT = 'https://edge.launchpad.net/'

Subscribers

People subscribed via source and target branches