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
1=== modified file 'setup.py'
2--- setup.py 2009-11-03 13:50:27 +0000
3+++ setup.py 2010-02-15 16:44:17 +0000
4@@ -60,7 +60,7 @@
5 license='LGPL v3',
6 install_requires=[
7 'httplib2',
8- 'lazr.restfulclient>=0.9.10',
9+ 'lazr.restfulclient>=0.9.11',
10 'lazr.uri',
11 'oauth',
12 'setuptools',
13
14=== modified file 'src/launchpadlib/__init__.py'
15--- src/launchpadlib/__init__.py 2009-12-17 13:13:42 +0000
16+++ src/launchpadlib/__init__.py 2010-02-15 16:44:17 +0000
17@@ -14,4 +14,4 @@
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with launchpadlib. If not, see <http://www.gnu.org/licenses/>.
20
21-__version__ = '1.5.4'
22+__version__ = '1.5.5'
23
24=== modified file 'src/launchpadlib/docs/introduction.txt'
25--- src/launchpadlib/docs/introduction.txt 2009-12-17 17:26:30 +0000
26+++ src/launchpadlib/docs/introduction.txt 2010-02-15 16:44:17 +0000
27@@ -299,7 +299,7 @@
28 service. Earlier we used 'test_dev' as shorthand for the website URL,
29 and like in that earlier case, launchpadlib will internally
30 dereference 'test_dev' into the service root URL, defined in the
31-'uris' module as "http://api.launchpad.dev:8085/beta".
32+'uris' module as "http://api.launchpad.dev:8085/".
33
34 >>> consumer_name = 'launchpadlib'
35 >>> launchpad = Launchpad.get_token_and_login(
36
37=== modified file 'src/launchpadlib/launchpad.py'
38--- src/launchpadlib/launchpad.py 2009-12-17 20:27:18 +0000
39+++ src/launchpadlib/launchpad.py 2010-02-15 16:44:17 +0000
40@@ -76,6 +76,8 @@
41 :type credentials: `Credentials`
42 """
43
44+ DEFAULT_VERSION = 'devel'
45+
46 RESOURCE_TYPE_CLASSES = {
47 'bugs': BugSet,
48 'distributions': PillarSet,
49@@ -86,7 +88,8 @@
50 }
51
52 def __init__(self, credentials, service_root=uris.STAGING_SERVICE_ROOT,
53- cache=None, timeout=None, proxy_info=None):
54+ cache=None, timeout=None, proxy_info=None,
55+ version=DEFAULT_VERSION):
56 """Root access to the Launchpad API.
57
58 :param credentials: The credentials used to access Launchpad.
59@@ -96,12 +99,13 @@
60 """
61 service_root = uris.lookup_service_root(service_root)
62 super(Launchpad, self).__init__(
63- credentials, service_root, cache, timeout, proxy_info)
64+ credentials, service_root, cache, timeout, proxy_info, version)
65
66 @classmethod
67 def login(cls, consumer_name, token_string, access_secret,
68 service_root=uris.STAGING_SERVICE_ROOT,
69- cache=None, timeout=None, proxy_info=None):
70+ cache=None, timeout=None, proxy_info=None,
71+ version=DEFAULT_VERSION):
72 """Convenience for setting up access credentials.
73
74 When all three pieces of credential information (the consumer
75@@ -125,14 +129,16 @@
76 access_token = AccessToken(token_string, access_secret)
77 credentials = Credentials(
78 consumer_name=consumer_name, access_token=access_token)
79- return cls(credentials, service_root, cache, timeout, proxy_info)
80+ return cls(credentials, service_root, cache, timeout, proxy_info,
81+ version)
82
83 @classmethod
84 def get_token_and_login(cls, consumer_name,
85 service_root=uris.STAGING_SERVICE_ROOT,
86 cache=None, timeout=None, proxy_info=None,
87 authorizer_class=AuthorizeRequestTokenWithBrowser,
88- allow_access_levels=[], max_failed_attempts=3):
89+ allow_access_levels=[], max_failed_attempts=3,
90+ version=DEFAULT_VERSION):
91 """Get credentials from Launchpad and log into the service root.
92
93 This is a convenience method which will open up the user's preferred
94@@ -170,19 +176,21 @@
95 max_failed_attempts)
96 authorizer()
97 credentials.exchange_request_token_for_access_token(web_root)
98- return cls(credentials, service_root, cache, timeout, proxy_info)
99+ return cls(credentials, service_root, cache, timeout, proxy_info,
100+ version)
101
102 @classmethod
103 def login_anonymously(
104 cls, consumer_name, service_root=uris.STAGING_SERVICE_ROOT,
105- launchpadlib_dir=None, timeout=None, proxy_info=None):
106+ launchpadlib_dir=None, timeout=None, proxy_info=None,
107+ version=DEFAULT_VERSION):
108 """Get access to Launchpad without providing any credentials."""
109 (service_root, launchpadlib_dir, cache_path,
110 service_root_dir) = cls._get_paths(service_root, launchpadlib_dir)
111 token = AnonymousAccessToken()
112 credentials = Credentials(consumer_name, access_token=token)
113 return cls(credentials, service_root=service_root, cache=cache_path,
114- timeout=timeout, proxy_info=proxy_info)
115+ timeout=timeout, proxy_info=proxy_info, version=version)
116
117 @classmethod
118 def login_with(cls, consumer_name,
119@@ -190,7 +198,7 @@
120 launchpadlib_dir=None, timeout=None, proxy_info=None,
121 authorizer_class=AuthorizeRequestTokenWithBrowser,
122 allow_access_levels=[], max_failed_attempts=3,
123- credentials_file=None):
124+ credentials_file=None, version=DEFAULT_VERSION):
125 """Log in to Launchpad with possibly cached credentials.
126
127 This is a convenience method for either setting up new login
128@@ -247,7 +255,7 @@
129 timeout=timeout, proxy_info=proxy_info,
130 authorizer_class=authorizer_class,
131 allow_access_levels=allow_access_levels,
132- max_failed_attempts=max_failed_attempts)
133+ max_failed_attempts=max_failed_attempts, version=version)
134 launchpad.credentials.save_to_path(consumer_credentials_path)
135 os.chmod(consumer_credentials_path, stat.S_IREAD | stat.S_IWRITE)
136 return launchpad
137
138=== modified file 'src/launchpadlib/testing/helpers.py'
139--- src/launchpadlib/testing/helpers.py 2009-12-17 16:52:54 +0000
140+++ src/launchpadlib/testing/helpers.py 2010-02-15 16:44:17 +0000
141@@ -39,9 +39,11 @@
142 """A base class for talking to the testing root service."""
143
144 def __init__(self, credentials, service_root=None,
145- cache=None, timeout=None, proxy_info=None):
146+ cache=None, timeout=None, proxy_info=None,
147+ version=Launchpad.DEFAULT_VERSION):
148 super(TestableLaunchpad, self).__init__(
149- credentials, 'test_dev', cache, timeout, proxy_info)
150+ credentials, 'test_dev', cache, timeout, proxy_info,
151+ version=version)
152
153
154 class KnownTokens:
155@@ -51,11 +53,13 @@
156 self.token_string = token_string
157 self.access_secret = access_secret
158
159- def login(self, cache=None, timeout=None, proxy_info=None):
160+ def login(self, cache=None, timeout=None, proxy_info=None,
161+ version=Launchpad.DEFAULT_VERSION):
162 """Login using these credentials."""
163 return TestableLaunchpad.login(
164 'launchpad-library', self.token_string, self.access_secret,
165- cache=cache, timeout=timeout, proxy_info=proxy_info)
166+ cache=cache, timeout=timeout, proxy_info=proxy_info,
167+ version=version)
168
169
170 salgado_with_full_permissions = KnownTokens('salgado-change-anything', 'test')
171
172=== modified file 'src/launchpadlib/tests/test_launchpad.py'
173--- src/launchpadlib/tests/test_launchpad.py 2009-12-17 18:45:49 +0000
174+++ src/launchpadlib/tests/test_launchpad.py 2010-02-15 16:44:17 +0000
175@@ -164,7 +164,8 @@
176 service_root=service_root,
177 timeout=timeout,
178 proxy_info=proxy_info,
179- cache=os.path.join(self.temp_dir, 'api.example.com', 'cache'))
180+ cache=os.path.join(self.temp_dir, 'api.example.com', 'cache'),
181+ version='devel')
182 self.assertEqual(launchpad.passed_in_kwargs, expected_arguments)
183
184 def test_anonymous_login(self):
185@@ -287,7 +288,7 @@
186 launchpad = NoNetworkLaunchpad.login_with('app name', 'staging')
187 self.assertEqual(
188 launchpad.passed_in_kwargs['service_root'],
189- 'https://api.staging.launchpad.net/beta/')
190+ 'https://api.staging.launchpad.net/')
191
192 # A full URL as the service name is left alone.
193 launchpad = NoNetworkLaunchpad.login_with(
194
195=== modified file 'src/launchpadlib/uris.py'
196--- src/launchpadlib/uris.py 2009-12-17 16:52:54 +0000
197+++ src/launchpadlib/uris.py 2010-02-15 16:44:17 +0000
198@@ -17,7 +17,7 @@
199 """Launchpad-specific URIs and convenience lookup functions.
200
201 The code in this module lets users say "edge" when they mean
202-"https://api.edge.launchpad.net/beta".
203+"https://api.edge.launchpad.net/".
204 """
205
206 __metaclass__ = type
207@@ -28,12 +28,12 @@
208
209 from urlparse import urlparse
210
211-LPNET_SERVICE_ROOT = 'https://api.launchpad.net/beta/'
212-EDGE_SERVICE_ROOT = 'https://api.edge.launchpad.net/beta/'
213-STAGING_SERVICE_ROOT = 'https://api.staging.launchpad.net/beta/'
214-DEV_SERVICE_ROOT = 'https://api.launchpad.dev/beta/'
215-DOGFOOD_SERVICE_ROOT = 'https://api.dogfood.launchpad.net/beta/'
216-TEST_DEV_SERVICE_ROOT = 'http://api.launchpad.dev:8085/beta/'
217+LPNET_SERVICE_ROOT = 'https://api.launchpad.net/'
218+EDGE_SERVICE_ROOT = 'https://api.edge.launchpad.net/'
219+STAGING_SERVICE_ROOT = 'https://api.staging.launchpad.net/'
220+DEV_SERVICE_ROOT = 'https://api.launchpad.dev/'
221+DOGFOOD_SERVICE_ROOT = 'https://api.dogfood.launchpad.net/'
222+TEST_DEV_SERVICE_ROOT = 'http://api.launchpad.dev:8085/'
223
224 LPNET_WEB_ROOT = 'https://launchpad.net/'
225 EDGE_WEB_ROOT = 'https://edge.launchpad.net/'

Subscribers

People subscribed via source and target branches