Debian Codegraph @

third_party/python/taskcluster_urls/taskcluster_urls-13.0.1.dist-info/METADATA

raw
1 Metadata-Version: 2.1
2 Name: taskcluster-urls
3 Version: 13.0.1
4 Summary: Standardized url generator for taskcluster resources.
5 Home-page: https://github.com/taskcluster/taskcluster-lib-urls
6 Author: Brian Stack
7 Author-email: [email protected]
8 License: MPL2
9 Platform: UNKNOWN
10 Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
11 Classifier: Programming Language :: Python :: 2
12 Classifier: Programming Language :: Python :: 2.7
13 Classifier: Programming Language :: Python :: 3
14 Classifier: Programming Language :: Python :: 3.5
15 Classifier: Programming Language :: Python :: 3.6
16 Description-Content-Type: text/markdown
17
18 # Taskcluster URL Building Library
19
20 [![License](https://img.shields.io/badge/license-MPL%202.0-orange.svg)](http://mozilla.org/MPL/2.0)
21
22 A simple library to generate URLs for various Taskcluster resources across our various deployment methods.
23
24 This serves as both a simple shim for projects that use JavaScript but also is the reference implementation for
25 how we define these paths.
26
27 URLs are defined in the '[Taskcluster URL Format](https://docs.taskcluster.net/docs/reference/url-structure).
28
29 Changelog
30 ---------
31 View the changelog on the [releases page](https://github.com/taskcluster/taskcluster-lib-urls/releases).
32
33 Requirements
34 ------------
35
36 This is tested on and should run on any of Node.js `{8, 10}`.
37
38 General Usage
39 -------------
40
41 While the capitalization and punctunation of the function names varies depending on the language, each language provides the following methods:
42
43 | method | result |
44 | --- | --- |
45 | api(rootUrl, service, version, path) -> | `<rootUrl>/api/<service>/<version>/<path>` |
46 | apiReference(rootUrl, service, version) -> | `<rootUrl>/references/<service>/<version>/api.json` |
47 | docs(rootUrl, path) -> | `<rootUrl>/docs/<path>` |
48 | exchangeReference(rootUrl, service, version) -> | `<rootUrl>/references/<service>/<version>/exchanges.json` |
49 | schema(rootUrl, service, schema) -> | `<rootUrl>/schemas/<service>/<schema>` |
50 | apiSchema(rootUrl, version) -> | `<rootUrl>/schemas/common/api-reference-<version>.json` |
51 | exchangesSchema(rootUrl, version) -> | `<rootUrl>/schemas/common/exchanges-reference-<version>.json` |
52 | apiManifestSchema(rootUrl, version) -> | `<rootUrl>/schemas/common/manifest-<version>.json` |
53 | metadataMchema(rootUrl) -> | `<rootUrl>/schemas/common/metadata-metaschema.json` |
54 | ui(rootUrl, path) -> | `<rootUrl>/<path>` |
55 | apiManifest(rootUrl) -> | `<rootUrl>/references/manifest.json` |
56 | normalizeRootUrl(rootUrl) -> | the normal form of the given rootUrl |
57 | testRootUrl() -> | `https://tc-tests.example.com` |
58
59 `testRootUrl()` is used to share a common fake `rootUrl` between various Taskcluster mocks in testing.
60 The URL does not resolve.
61
62 JS Usage
63 --------
64 [![Node.js Build Status](https://travis-ci.org/taskcluster/taskcluster-lib-urls.svg?branch=master)](https://travis-ci.org/taskcluster/taskcluster-lib-urls)
65 [![npm](https://img.shields.io/npm/v/taskcluster-lib-urls.svg?maxAge=2592000)](https://www.npmjs.com/package/taskcluster-lib-urls)
66
67 This package exports several methods for generating URLs conditionally based on
68 a root URL, as well as a few helper classes for generating URLs for a pre-determined
69 root URL:
70
71 * `api(rootUrl, service, version, path)` -> `String`
72 * `apiReference(rootUrl, service, version)` -> `String`
73 * `docs(rootUrl, path)` -> `String`
74 * `exchangeReference(rootUrl, service, version)` -> `String`
75 * `schema(rootUrl, service, schema)` -> `String`
76 * `apiManifestSchema(rootUrl, version)` -> `String`
77 * `apiReferenceSchema(rootUrl, version)` -> `String`
78 * `exchangesReferenceSchema(rootUrl, version)` -> `String`
79 * `metadataMetaschema(rootUrl)` -> `String`
80 * `ui(rootUrl, path)` -> `String`
81 * `apiManifest(rootUrl)` -> `String`
82 * `testRootUrl()` -> `String`
83 * `withRootUrl(rootUrl)` -> `Class` instance for above methods
84 * `normalizeRootUrl(rootUrl)` -> `String` (the "normalized" form of the given rootUrl)
85
86 ```js
87 // Specifying root URL every time:
88 const libUrls = require('taskcluster-lib-urls');
89
90 libUrls.api(rootUrl, 'auth', 'v1', 'foo/bar');
91 libUrls.schema(rootUrl, 'auth', 'v1/foo.yml'); // Note that schema names have versions in them
92 libUrls.apiReference(rootUrl, 'auth', 'v1');
93 libUrls.exchangeReference(rootUrl, 'auth', 'v1');
94 libUrls.ui(rootUrl, 'foo/bar');
95 libUrls.apiManifest(rootUrl);
96 libUrls.docs(rootUrl, 'foo/bar');
97 ```
98
99 ```js
100 // Specifying root URL in advance:
101 const libUrls = require('taskcluster-lib-urls');
102
103 const urls = libUrls.withRoot(rootUrl);
104
105 urls.api('auth', 'v1', 'foo/bar');
106 urls.schema('auth', 'v1/foo.yml');
107 urls.apiReference('auth', 'v1');
108 urls.exchangeReference('auth', 'v1');
109 urls.ui('foo/bar');
110 urls.apiManifest();
111 urls.docs('foo/bar');
112 ```
113
114 If you would like, you can set this up via [taskcluster-lib-loader](https://github.com/taskcluster/taskcluster-lib-loader) as follows:
115
116 ```js
117 {
118 libUrlss: {
119 require: ['cfg'],
120 setup: ({cfg}) => withRootUrl(cfg.rootURl),
121 },
122 }
123 ```
124
125 Test with:
126
127 ```
128 yarn install
129 yarn test
130 ```
131
132
133 Go Usage
134 --------
135
136 [![GoDoc](https://godoc.org/github.com/taskcluster/taskcluster-lib-urls?status.svg)](https://godoc.org/github.com/taskcluster/taskcluster-lib-urls)
137
138 The go package exports the following functions:
139
140 ```go
141 func API(rootURL string, service string, version string, path string) string
142 func APIReference(rootURL string, service string, version string) string
143 func Docs(rootURL string, path string) string
144 func ExchangeReference(rootURL string, service string, version string) string
145 func Schema(rootURL string, service string, name string) string
146 func APIManifestSchema(rootURL string, version string) string
147 func APIReferenceSchema(rootURL string, version string) string
148 func ExchangesReferenceSchema(rootURL string, version string) string
149 func MetadataMetaschema(rootURL string) string
150 func UI(rootURL string, path string) string
151 func APIManifest(rootURL string) string
152 func NormalizeRootURL(rootURL string) string
153 ```
154
155 Install with:
156
157 ```
158 go install ./..
159 ```
160
161 Test with:
162
163 ```
164 go test -v ./...
165 ```
166
167 Python Usage
168 ------------
169
170 You can install the python client with `pip install taskcluster-urls`;
171
172 ```python
173 import taskcluster_urls
174
175 taskcluster_urls.api(root_url, 'auth', 'v1', 'foo/bar')
176 taskcluster_urls.schema(root_url, 'auth', 'v1/foo.yml') # Note that schema names have versions in them
177 taskcluster_urls.api_manifest_schema(root_url, 'v1')
178 taskcluster_urls.api_reference_schema(root_url, 'v1')
179 taskcluster_urls.exchanges_reference_schema(root_url, 'v1')
180 taskcluster_urls.metadata_metaschema(root_url, 'v1')
181 taskcluster_urls.api_reference(root_url, 'auth', 'v1')
182 taskcluster_urls.exchange_reference(root_url, 'auth', 'v1')
183 taskcluster_urls.ui(root_url, 'foo/bar')
184 taskcluster_urls.apiManifest(root_url)
185 taskcluster_urls.docs(root_url, 'foo/bar')
186 taskcluster_urls.normalize_root_url(root_url)
187 taskcluster_urls.test_root_url()
188 ```
189
190 Test with:
191
192 ```
193 tox
194 ```
195
196 Java Usage
197 ----------
198
199 [![JavaDoc](https://img.shields.io/badge/javadoc-reference-blue.svg)](http://taskcluster.github.io/taskcluster-lib-urls/apidocs)
200
201 In order to use this library from your maven project, simply include it as a project dependency:
202
203 ```
204 <project>
205 ...
206 <dependencies>
207 ...
208 <dependency>
209 <groupId>org.mozilla.taskcluster</groupId>
210 <artifactId>taskcluster-lib-urls</artifactId>
211 <version>1.0.0</version>
212 </dependency>
213 </dependencies>
214 </project>
215 ```
216
217 The taskcluster-lib-urls artifacts are now available from the [maven central repository](http://central.sonatype.org/):
218
219 * [Search Results](http://search.maven.org/#search|gav|1|g%3A%22org.mozilla.taskcluster%22%20AND%20a%3A%22taskcluster-lib-urls%22)
220 * [Directory Listing](https://repo1.maven.org/maven2/org/mozilla/taskcluster/taskcluster-lib-urls/)
221
222 To use the library, do as follows:
223
224 ```java
225 import org.mozilla.taskcluster.urls.*;
226
227 ...
228
229 URLProvider urlProvider = URLs.provider("https://mytaskcluster.acme.org");
230
231 String fooBarAPI = urlProvider.api("auth", "v1", "foo/bar");
232 String fooSchema = urlProvider.schema("auth", "v1/foo.yml"); // Note that schema names have versions in them
233 String apiSchema = urlProvider.apiReferenceSchema("v1");
234 String exchangesSchema = urlProvider.exchangesReferenceSchema("v1");
235 String manifestSchema = urlProvider.apiManifestSchema("v1");
236 String metaschema = urlProvider.metadataMetaschema();
237 String authAPIRef = urlProvider.apiReference("auth", "v1");
238 String authExchangesRef = urlProvider.exchangeReference("auth", "v1");
239 String uiFooBar = urlProvider.ui("foo/bar");
240 String apiManifest = urlProvider.apiManifest();
241 String docsFooBar = urlProvider.docs("foo/bar");
242
243 ...
244 ```
245
246 Install with:
247
248 ```
249 mvn install
250 ```
251
252 Test with:
253
254 ```
255 mvn test
256 ```
257
258
259 Releasing
260 ---------
261
262 New releases should be tested on Travis and Taskcluster to allow for all supported versions of various languages to be tested. Once satisfied that it works, new versions should be created with
263 `npm version` rather than by manually editing `package.json` and tags should be pushed to Github.
264
265 Make the Node release first, as Python's version depends on its `package.json`. This follows the typical tag-and-push-to-publish approach:
266
267 ```sh
268 $ npm version minor # or patch, or major
269 $ git push upstream
270 ```
271
272 Once that's done, build the Python sdists (only possible by the [maintainers on pypi](https://pypi.org/project/taskcluster-urls/#files)):
273
274 ```sh
275 rm -rf dist/*
276 pip install -U wheel
277 python setup.py sdist bdist_wheel
278 pip3 install -U wheel
279 python3 setup.py bdist_wheel
280 pip install twine
281 twine upload dist/*
282 ```
283
284 Make sure to update [the changelog](https://github.com/taskcluster/taskcluster-lib-urls/releases)!
285
286 License
287 -------
288
289 [Mozilla Public License Version 2.0](https://github.com/taskcluster/taskcluster-lib-urls/blob/master/LICENSE)
290
291