1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
%global _empty_manifest_terminate_build 0
Name: python-tapipy
Version: 1.3.6
Release: 1
Summary: Python lib for interacting with an instance of the Tapis API Framework
License: BSD-4-Clause
URL: https://github.com/tapis-project/tapipy
Source0: https://mirrors.aliyun.com/pypi/web/packages/1f/19/dde9c7b6f476c1b297012dba6423b96f8ea5823987d10d5996674eaaaff1/tapipy-1.3.6.tar.gz
BuildArch: noarch
Requires: python3-certifi
Requires: python3-six
Requires: python3-python_dateutil
Requires: python3-setuptools
Requires: python3-urllib3
Requires: python3-PyJWT
Requires: python3-openapi_core
Requires: python3-openapi_spec_validator
Requires: python3-requests
Requires: python3-atomicwrites
Requires: python3-cryptography
Requires: python3-jsonschema
Requires: python3-pyyaml
Requires: python3-cloudpickle
%description
# tapipy - Tapis V3 Python SDK
Python library for interacting with an instance of the Tapis API Framework.
The library is automatically generated by referencing the OpenAPI spec files which a `Tapis` object built from the OpenAPI spec files from TACC's Tapis services. With this functionality a user is able to authorize itself with the `Tapis` object and have a 'live' library in order to interact with Tapis services.
## Development
This project is under active development, exploring different approaches to SDK generation.
## Installation
Tapipy is packaged on [pypi](https://pypi.org/project/tapipy/) and can be installed with pip.
```
pip install tapipy
```
## Usage
Tapipy's Tapis object first must be initialized in order to be used.
A basic example of logging in with a user account is below.
```
# Import the Tapis object
from tapipy.tapis import Tapis
# Log into you the Tapis service by providing user/pass and the base url of your tenant. For example, to interact with the tacc tenant --
t = Tapis(base_url='https://tacc.tapis.io',
username='myuser',
password='mypass')
# Get tokens that will be used for authentication function calls
t.get_tokens()
```
Now you have a Tapis object that is authenticated and able to call Tapis service endpoints. It's useful to know that the Tapis object will automatically refresh it's token if it is deemed appropriate, so the object should stay in the good graces of Tapis indefinitely.
Now in order to use the Tapis object you can reference the [Tapis Framework](https://tapis-project.github.io/live-docs/) to browse all functions. For example, if I wanted to use the SK service in order to check if a user has a specific role I would find the function on the site (which is just a better way to look at the json specs).
With the site I can see that I need to use my Tapis object, initialized as `t`, access `sk`, and then use the `hasRole` function with the required inputs as follows.
```
t.sk.hasRole(tenant='dev', user='_testuser', roleName='Do you have this role?')
```
### Special Query Parameters and Headers
For the most part, arguments that can or should be passed to a Tapis endpoint are described in the OpenAPI
definition files and recognized automatically by `tapipy`. However, due to limitations in what can be expressed
in OpenAPI, there are some paramaters that are not defined in the definition files; for example, the search
parameters for various endpoints.
To accommodate these cases, `tapipy` recognizes two special keyword arguments to all of its methods that
correspond to Tapis API calls (i.e., all of its "operations"). They are:
* `_tapis_headers` -- dictionary-like object of header names (keys) and vales.
* `_tapis_query_parameters` -- dictionary-like object of query parameter names (keys) and values.
Use the above two special arguments for passing headers (respectively, query parameters) that are not specified
in the OpenAPI definition of an endpoint.
For example, I can issue a search using the following syntax:
```
t.jobs.getJobSearchList(limit=5, orderBy='lastUpdated(desc),name(asc)', _tapis_query_parameters={'key': 'value'})
```
# Development Docs
## Running the tests
Tests resources are contained within the `test` directory. `Dockerfile-tests` is at root.
1. Build the test docker image: `docker build -t tapis/tapipy-tests -f Dockerfile-tests .`
2. Run these tests using the built docker image: `docker run -it --rm -e username=<dev_user> -e password=<dev_pass> tapis/tapipy-tests`
## Important Parameters to Know
The `tapipy` package allows for spec file customization in Tapis object initialization:
* resource_set: str
* Determines which set of resource to use, master or dev, defaults to master.
* Important to note that if a custom_spec_dictionary is used, it is appended to this resource_set.
* For example, you would set master and then specify a custom specs that will be added on.
* custom_spec_dict: {resource_name: str, resource_url: str}
* Allows users to modify the base resource set urls.
* e.g. I can specify actor as a resource name and change the url.
* Also allows users to add new resources to the set.
* e.g. I can add a new resource named "test" with a custom url.
* Important that know that any new specs will be downloaded and added to the cache
* No need to specify download_latest_specs or update spec files.
* ALLOWS LOCAL RESOURCES!
* Specify an absolute path in the dict with `local:` prefixing it and tapipy will load in a local OpenAPI v3 yml spec file.
* `custom_spec_dict={'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'}`
* download_latest_specs: bool
* Allows users to re-download all specs regardless on if they already exist in the cache. Defaulted to False
* This will happen every time the Tapis object is initialized, it's a tad slower, and can cause live updates to specs.
* As such, be warned. There are functions to update spec files below.
* spec_dir: str
* Allows users to specify folder to save specs to. Defaults to none which uses Tapipy's package folder.
* If you are updating specs it's wise to use a different folder in order to not modify the base specs.
The following is an example of some custom parameter setting. As you can see, the abaco resource will now use the spec at `URL#1`, overwriting the resource definition in the master resource set, it'll download it if it doesn't exist. The same for the longhorn resource. This means that the Tapis object will now have access to all specs in master like normal, but with a modified abaco and with a new longhorn resource. All of these are stored at the new spec_dir because I don't want to accidentally overwrite any base specs if I call `update_spec_cache()` later (talked about in the next section).
```
from tapipy.tapis import Tapis
t = Tapis(base_url='https://admin.develop.tapis.io',
tenant_id='admin',
username='username',
account_type='user',
password='password',
resource_set='admin',
custom_spec_dict={'abaco': 'URL#1',
'longhorn': 'URL#2'},
'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'},
spec_dir='/home/username/tapipy_specs')
t.get_tokens()
```
## Update Specs Files
The Tapipy package now uses a cache to organize spec dictionaries as pickled files and has the ability to accept custom spec files. By default Tapipy keeps a set of base spec files in the `%tapipy%/specs` folder. These specs are pre-pickled at package creation time.
In order to update all default spec files a user can use the `update_spec_cache()` function. Said function's definition is below. If no resources are provided the function will download all default spec urls in the RESOURCES object in `%tapipy%/tapipy/tapis.py` file.
```
Resources = Dict[ResourceName, ResourceUrl]
update_spec_cache(resources: Resources = None, spec_dir: str = None)
```
Users are able to specify custom resources to download by providing their own resource dictionary. For example, providing `{'actors': 'URLToMyActorDictionary'}` would update that spec.
Users can also specify here where to update the spec with the `spec_dir` variable.
The Tapis object itself also has a `update_spec_cache()` function that takes the Tapis parameters given at startup and updates the spec cache. Meaning that if the Tapis object was given a custom dictionary, the `update_spec_cache()` function would update it without the need for setting parameters.
```
t.update_spec_cache()
```
## Build instructions
Building is done with poetry as follows:
```
pip install poetry
poetry install
```
This installs `tapipy` to a virtual environment. Run a shell in this environment with:
```
poetry shell
```
To install locally (not in a virtual environment):
```
pip install poetry
poetry build
cd dists
pip install *.whl
```
## PyPi Push Instructions
```
poetry build
poetry publish
```
## Archive Usage
TODO - provide working examples, e.g.,
```
import tapipy
t = tapipy.Tapis(base_url='http://localhost:5001')
req = t.tokens.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
t.tokens.create_token(req)
import openapi_client
configuration = openapi_client.Configuration()
configuration.host = 'http://localhost:5001'
api_instance = openapi_client.TokensApi(openapi_client.ApiClient(configuration))
new_token = openapi_client.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
resp = api_instance.create_token(new_token)
jwt = resp.get('result').get('access_token').get('access_token')
```
%package -n python3-tapipy
Summary: Python lib for interacting with an instance of the Tapis API Framework
Provides: python-tapipy
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-tapipy
# tapipy - Tapis V3 Python SDK
Python library for interacting with an instance of the Tapis API Framework.
The library is automatically generated by referencing the OpenAPI spec files which a `Tapis` object built from the OpenAPI spec files from TACC's Tapis services. With this functionality a user is able to authorize itself with the `Tapis` object and have a 'live' library in order to interact with Tapis services.
## Development
This project is under active development, exploring different approaches to SDK generation.
## Installation
Tapipy is packaged on [pypi](https://pypi.org/project/tapipy/) and can be installed with pip.
```
pip install tapipy
```
## Usage
Tapipy's Tapis object first must be initialized in order to be used.
A basic example of logging in with a user account is below.
```
# Import the Tapis object
from tapipy.tapis import Tapis
# Log into you the Tapis service by providing user/pass and the base url of your tenant. For example, to interact with the tacc tenant --
t = Tapis(base_url='https://tacc.tapis.io',
username='myuser',
password='mypass')
# Get tokens that will be used for authentication function calls
t.get_tokens()
```
Now you have a Tapis object that is authenticated and able to call Tapis service endpoints. It's useful to know that the Tapis object will automatically refresh it's token if it is deemed appropriate, so the object should stay in the good graces of Tapis indefinitely.
Now in order to use the Tapis object you can reference the [Tapis Framework](https://tapis-project.github.io/live-docs/) to browse all functions. For example, if I wanted to use the SK service in order to check if a user has a specific role I would find the function on the site (which is just a better way to look at the json specs).
With the site I can see that I need to use my Tapis object, initialized as `t`, access `sk`, and then use the `hasRole` function with the required inputs as follows.
```
t.sk.hasRole(tenant='dev', user='_testuser', roleName='Do you have this role?')
```
### Special Query Parameters and Headers
For the most part, arguments that can or should be passed to a Tapis endpoint are described in the OpenAPI
definition files and recognized automatically by `tapipy`. However, due to limitations in what can be expressed
in OpenAPI, there are some paramaters that are not defined in the definition files; for example, the search
parameters for various endpoints.
To accommodate these cases, `tapipy` recognizes two special keyword arguments to all of its methods that
correspond to Tapis API calls (i.e., all of its "operations"). They are:
* `_tapis_headers` -- dictionary-like object of header names (keys) and vales.
* `_tapis_query_parameters` -- dictionary-like object of query parameter names (keys) and values.
Use the above two special arguments for passing headers (respectively, query parameters) that are not specified
in the OpenAPI definition of an endpoint.
For example, I can issue a search using the following syntax:
```
t.jobs.getJobSearchList(limit=5, orderBy='lastUpdated(desc),name(asc)', _tapis_query_parameters={'key': 'value'})
```
# Development Docs
## Running the tests
Tests resources are contained within the `test` directory. `Dockerfile-tests` is at root.
1. Build the test docker image: `docker build -t tapis/tapipy-tests -f Dockerfile-tests .`
2. Run these tests using the built docker image: `docker run -it --rm -e username=<dev_user> -e password=<dev_pass> tapis/tapipy-tests`
## Important Parameters to Know
The `tapipy` package allows for spec file customization in Tapis object initialization:
* resource_set: str
* Determines which set of resource to use, master or dev, defaults to master.
* Important to note that if a custom_spec_dictionary is used, it is appended to this resource_set.
* For example, you would set master and then specify a custom specs that will be added on.
* custom_spec_dict: {resource_name: str, resource_url: str}
* Allows users to modify the base resource set urls.
* e.g. I can specify actor as a resource name and change the url.
* Also allows users to add new resources to the set.
* e.g. I can add a new resource named "test" with a custom url.
* Important that know that any new specs will be downloaded and added to the cache
* No need to specify download_latest_specs or update spec files.
* ALLOWS LOCAL RESOURCES!
* Specify an absolute path in the dict with `local:` prefixing it and tapipy will load in a local OpenAPI v3 yml spec file.
* `custom_spec_dict={'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'}`
* download_latest_specs: bool
* Allows users to re-download all specs regardless on if they already exist in the cache. Defaulted to False
* This will happen every time the Tapis object is initialized, it's a tad slower, and can cause live updates to specs.
* As such, be warned. There are functions to update spec files below.
* spec_dir: str
* Allows users to specify folder to save specs to. Defaults to none which uses Tapipy's package folder.
* If you are updating specs it's wise to use a different folder in order to not modify the base specs.
The following is an example of some custom parameter setting. As you can see, the abaco resource will now use the spec at `URL#1`, overwriting the resource definition in the master resource set, it'll download it if it doesn't exist. The same for the longhorn resource. This means that the Tapis object will now have access to all specs in master like normal, but with a modified abaco and with a new longhorn resource. All of these are stored at the new spec_dir because I don't want to accidentally overwrite any base specs if I call `update_spec_cache()` later (talked about in the next section).
```
from tapipy.tapis import Tapis
t = Tapis(base_url='https://admin.develop.tapis.io',
tenant_id='admin',
username='username',
account_type='user',
password='password',
resource_set='admin',
custom_spec_dict={'abaco': 'URL#1',
'longhorn': 'URL#2'},
'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'},
spec_dir='/home/username/tapipy_specs')
t.get_tokens()
```
## Update Specs Files
The Tapipy package now uses a cache to organize spec dictionaries as pickled files and has the ability to accept custom spec files. By default Tapipy keeps a set of base spec files in the `%tapipy%/specs` folder. These specs are pre-pickled at package creation time.
In order to update all default spec files a user can use the `update_spec_cache()` function. Said function's definition is below. If no resources are provided the function will download all default spec urls in the RESOURCES object in `%tapipy%/tapipy/tapis.py` file.
```
Resources = Dict[ResourceName, ResourceUrl]
update_spec_cache(resources: Resources = None, spec_dir: str = None)
```
Users are able to specify custom resources to download by providing their own resource dictionary. For example, providing `{'actors': 'URLToMyActorDictionary'}` would update that spec.
Users can also specify here where to update the spec with the `spec_dir` variable.
The Tapis object itself also has a `update_spec_cache()` function that takes the Tapis parameters given at startup and updates the spec cache. Meaning that if the Tapis object was given a custom dictionary, the `update_spec_cache()` function would update it without the need for setting parameters.
```
t.update_spec_cache()
```
## Build instructions
Building is done with poetry as follows:
```
pip install poetry
poetry install
```
This installs `tapipy` to a virtual environment. Run a shell in this environment with:
```
poetry shell
```
To install locally (not in a virtual environment):
```
pip install poetry
poetry build
cd dists
pip install *.whl
```
## PyPi Push Instructions
```
poetry build
poetry publish
```
## Archive Usage
TODO - provide working examples, e.g.,
```
import tapipy
t = tapipy.Tapis(base_url='http://localhost:5001')
req = t.tokens.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
t.tokens.create_token(req)
import openapi_client
configuration = openapi_client.Configuration()
configuration.host = 'http://localhost:5001'
api_instance = openapi_client.TokensApi(openapi_client.ApiClient(configuration))
new_token = openapi_client.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
resp = api_instance.create_token(new_token)
jwt = resp.get('result').get('access_token').get('access_token')
```
%package help
Summary: Development documents and examples for tapipy
Provides: python3-tapipy-doc
%description help
# tapipy - Tapis V3 Python SDK
Python library for interacting with an instance of the Tapis API Framework.
The library is automatically generated by referencing the OpenAPI spec files which a `Tapis` object built from the OpenAPI spec files from TACC's Tapis services. With this functionality a user is able to authorize itself with the `Tapis` object and have a 'live' library in order to interact with Tapis services.
## Development
This project is under active development, exploring different approaches to SDK generation.
## Installation
Tapipy is packaged on [pypi](https://pypi.org/project/tapipy/) and can be installed with pip.
```
pip install tapipy
```
## Usage
Tapipy's Tapis object first must be initialized in order to be used.
A basic example of logging in with a user account is below.
```
# Import the Tapis object
from tapipy.tapis import Tapis
# Log into you the Tapis service by providing user/pass and the base url of your tenant. For example, to interact with the tacc tenant --
t = Tapis(base_url='https://tacc.tapis.io',
username='myuser',
password='mypass')
# Get tokens that will be used for authentication function calls
t.get_tokens()
```
Now you have a Tapis object that is authenticated and able to call Tapis service endpoints. It's useful to know that the Tapis object will automatically refresh it's token if it is deemed appropriate, so the object should stay in the good graces of Tapis indefinitely.
Now in order to use the Tapis object you can reference the [Tapis Framework](https://tapis-project.github.io/live-docs/) to browse all functions. For example, if I wanted to use the SK service in order to check if a user has a specific role I would find the function on the site (which is just a better way to look at the json specs).
With the site I can see that I need to use my Tapis object, initialized as `t`, access `sk`, and then use the `hasRole` function with the required inputs as follows.
```
t.sk.hasRole(tenant='dev', user='_testuser', roleName='Do you have this role?')
```
### Special Query Parameters and Headers
For the most part, arguments that can or should be passed to a Tapis endpoint are described in the OpenAPI
definition files and recognized automatically by `tapipy`. However, due to limitations in what can be expressed
in OpenAPI, there are some paramaters that are not defined in the definition files; for example, the search
parameters for various endpoints.
To accommodate these cases, `tapipy` recognizes two special keyword arguments to all of its methods that
correspond to Tapis API calls (i.e., all of its "operations"). They are:
* `_tapis_headers` -- dictionary-like object of header names (keys) and vales.
* `_tapis_query_parameters` -- dictionary-like object of query parameter names (keys) and values.
Use the above two special arguments for passing headers (respectively, query parameters) that are not specified
in the OpenAPI definition of an endpoint.
For example, I can issue a search using the following syntax:
```
t.jobs.getJobSearchList(limit=5, orderBy='lastUpdated(desc),name(asc)', _tapis_query_parameters={'key': 'value'})
```
# Development Docs
## Running the tests
Tests resources are contained within the `test` directory. `Dockerfile-tests` is at root.
1. Build the test docker image: `docker build -t tapis/tapipy-tests -f Dockerfile-tests .`
2. Run these tests using the built docker image: `docker run -it --rm -e username=<dev_user> -e password=<dev_pass> tapis/tapipy-tests`
## Important Parameters to Know
The `tapipy` package allows for spec file customization in Tapis object initialization:
* resource_set: str
* Determines which set of resource to use, master or dev, defaults to master.
* Important to note that if a custom_spec_dictionary is used, it is appended to this resource_set.
* For example, you would set master and then specify a custom specs that will be added on.
* custom_spec_dict: {resource_name: str, resource_url: str}
* Allows users to modify the base resource set urls.
* e.g. I can specify actor as a resource name and change the url.
* Also allows users to add new resources to the set.
* e.g. I can add a new resource named "test" with a custom url.
* Important that know that any new specs will be downloaded and added to the cache
* No need to specify download_latest_specs or update spec files.
* ALLOWS LOCAL RESOURCES!
* Specify an absolute path in the dict with `local:` prefixing it and tapipy will load in a local OpenAPI v3 yml spec file.
* `custom_spec_dict={'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'}`
* download_latest_specs: bool
* Allows users to re-download all specs regardless on if they already exist in the cache. Defaulted to False
* This will happen every time the Tapis object is initialized, it's a tad slower, and can cause live updates to specs.
* As such, be warned. There are functions to update spec files below.
* spec_dir: str
* Allows users to specify folder to save specs to. Defaults to none which uses Tapipy's package folder.
* If you are updating specs it's wise to use a different folder in order to not modify the base specs.
The following is an example of some custom parameter setting. As you can see, the abaco resource will now use the spec at `URL#1`, overwriting the resource definition in the master resource set, it'll download it if it doesn't exist. The same for the longhorn resource. This means that the Tapis object will now have access to all specs in master like normal, but with a modified abaco and with a new longhorn resource. All of these are stored at the new spec_dir because I don't want to accidentally overwrite any base specs if I call `update_spec_cache()` later (talked about in the next section).
```
from tapipy.tapis import Tapis
t = Tapis(base_url='https://admin.develop.tapis.io',
tenant_id='admin',
username='username',
account_type='user',
password='password',
resource_set='admin',
custom_spec_dict={'abaco': 'URL#1',
'longhorn': 'URL#2'},
'cactus': 'local: /home/tapis/myfolder/cactusSpec.yml'},
spec_dir='/home/username/tapipy_specs')
t.get_tokens()
```
## Update Specs Files
The Tapipy package now uses a cache to organize spec dictionaries as pickled files and has the ability to accept custom spec files. By default Tapipy keeps a set of base spec files in the `%tapipy%/specs` folder. These specs are pre-pickled at package creation time.
In order to update all default spec files a user can use the `update_spec_cache()` function. Said function's definition is below. If no resources are provided the function will download all default spec urls in the RESOURCES object in `%tapipy%/tapipy/tapis.py` file.
```
Resources = Dict[ResourceName, ResourceUrl]
update_spec_cache(resources: Resources = None, spec_dir: str = None)
```
Users are able to specify custom resources to download by providing their own resource dictionary. For example, providing `{'actors': 'URLToMyActorDictionary'}` would update that spec.
Users can also specify here where to update the spec with the `spec_dir` variable.
The Tapis object itself also has a `update_spec_cache()` function that takes the Tapis parameters given at startup and updates the spec cache. Meaning that if the Tapis object was given a custom dictionary, the `update_spec_cache()` function would update it without the need for setting parameters.
```
t.update_spec_cache()
```
## Build instructions
Building is done with poetry as follows:
```
pip install poetry
poetry install
```
This installs `tapipy` to a virtual environment. Run a shell in this environment with:
```
poetry shell
```
To install locally (not in a virtual environment):
```
pip install poetry
poetry build
cd dists
pip install *.whl
```
## PyPi Push Instructions
```
poetry build
poetry publish
```
## Archive Usage
TODO - provide working examples, e.g.,
```
import tapipy
t = tapipy.Tapis(base_url='http://localhost:5001')
req = t.tokens.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
t.tokens.create_token(req)
import openapi_client
configuration = openapi_client.Configuration()
configuration.host = 'http://localhost:5001'
api_instance = openapi_client.TokensApi(openapi_client.ApiClient(configuration))
new_token = openapi_client.NewTokenRequest(token_type='service', token_tenant_id='dev', token_username='admin')
resp = api_instance.create_token(new_token)
jwt = resp.get('result').get('access_token').get('access_token')
```
%prep
%autosetup -n tapipy-1.3.6
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-tapipy -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.6-1
- Package Spec generated
|