Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 6062d69

Browse files
committed
update README
1 parent c96dc66 commit 6062d69

File tree

1 file changed

+67
-5
lines changed

1 file changed

+67
-5
lines changed

README.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,78 @@
11
Paperspace API for Python
22
=========================
33

4-
Sample usage:
4+
Sample usage
5+
============
6+
1. Make sure you have a Paperspace account set up. Go to http://paperspace.com
7+
to register.
8+
9+
2. Send an email message to support@paperspace.com to request access to the
10+
Paperspace API Beta program.
11+
12+
Wait for an email confirmation indicating your account has been approved
13+
before proceeding.
14+
15+
3. Use pip or pipenv to install the paperspace-python package:
16+
17+
pip install paperspace
18+
19+
4. Download your api key by executing the following:
20+
21+
python -m paperspace.login
22+
23+
Follow the prompts to enter your Paperspace email and password.
24+
25+
You can also enter your credentials directly on the command line as follows:
26+
27+
python -m paperspace.login <email> <password> [<api_token_name>]
28+
29+
Note: your api key is cached in ~/.paperspace/config.json
30+
You can remove your cached api key by executing:
31+
32+
python -m paperspace.logout
33+
34+
5. Execute the sample script hello.py:
35+
36+
python hello.py
37+
38+
The script will be run on the remote job cluster node, and its output will be
39+
logged locally.
40+
41+
42+
A slightly more complex example
43+
===============================
44+
# tests/test_remote.py
45+
import os
46+
import paperspace
47+
48+
paperspace.jobs.runas_job({'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'})
49+
50+
print(os.getcwd())
51+
print('something useful')
52+
53+
54+
Other examples
55+
==============
56+
See the scripts in the test folder for other examples.
57+
58+
59+
Other Authentication options
60+
============================
61+
1. Specify your apiKey explicitly on any of the paperspace.jobs methods, e.g.:
62+
63+
paperspace.jobs.create({'apiKey': '1qks1hKsU7e1k...', 'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'})
64+
65+
2. Set the package paperspace.config option in your python code:
566

6-
import paperspace
67+
paperspace.config.PAPERSPACE_API_KEY = '1qks1hKsU7e1k...'
768

8-
paperspace.config.PAPERSPACE_API_KEY = '14a4bc1cbc414...'
969

10-
paperspace.jobs.runas_job({'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'})
70+
3. Set the PAPERSPACE_API_KEY environment variable:
1171

12-
print('hello paperspace!')
72+
(on linux:) export PAPERSPACE_API_KEY=1qks1hKsU7e1k...
1373

74+
Note: the above methods take precedence over use of the cached api key in
75+
~/.paperspace/config.json
1476

1577
Contributing
1678
============

0 commit comments

Comments
 (0)