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