{ "info": { "author": "Paperspace Co.", "author_email": "info@paperspace.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries" ], "description": "Paperspace Python\n=================\n\nRelease 0.2.0\n\nSee [releasenotes.md](https://github.com/Paperspace/paperspace-python/blob/master/releasenotes.md) for details on the current release, as well as release history.\n\nGetting Started\n===============\n1. Make sure you have a Paperspace account set up. Go to http://paperspace.com\n to register.\n\n2. Use pip, pipenv, or conda to install the paperspace-python package, e.g.:\n\n `pip install -U paperspace`\n\n To install/update prerelease (Alpha/Beta) version version of paperspace-python, use:\n\n `pip install -U --pre paperspace`\n3. Enable autocomplete:\n \n Add following to your `.bashrc` (or `.zshrc`) to enable autocomplete anytime you activate your shell.\n If paperspace-python was installed in a virtual environment, the following has to be added to the `activate` script:\n \n `eval \"$(_PAPERSPACE_PYTHON_COMPLETE=source paperspace-python)\"`\n \n Alternatively, you can create activation script by:\n \n `(_PAPERSPACE_PYTHON_COMPLETE=source paperspace-python) > ~/paperspace_complete.sh`\n \n and then add `. ~/paperspace_complete.sh` to your `.bashrc`, `.zshrc` or `activate` script.\n\n More: https://click.palletsprojects.com/en/7.x/bashcomplete/\n4. Download your api key by executing the following:\n\n `paperspace-python login`\n\n Follow the prompts to enter your Paperspace email and password.\n\n You can also enter your credentials directly on the command line as follows:\n\n `paperspace-python login []`\n\n Note: your api key is cached in ~/.paperspace/config.json\n You can remove your cached api key by executing:\n\n `paperspace-python logout`\n\n5. Run the sample script hello.py using Python:\n\n `python hello.py`\n\n The source of this sample script shows how a script can automatically run itself on the Paperspace job cluster node:\n\n ```\n import paperspace\n\n paperspace.run()\n\n print('hello paperspace-python!')\n ```\n\n Note: the source is modified before transfer to the job cluster in order to remove imported `paperspace` references.\n\n6. Use paperspace-python to run a python script remotely:\n\n `paperspace-python run myscript.py`\n\n The script will be run on the Paperspace job cluster node, and its output will be logged locally.\n\n\nCreate/create and start experiment\n=================\nTo create new experiment use:\n```\npaperspace-python experiments create [type] [--options]\n```\nThe two available experiment types are `singlenode` and `multinode`.\n\nTo create and immediately start new experiment use:\n```\npaperspace-python experiments createAndStart [type] [--options]\n```\n\nFor a full list of available commands run `paperspace experiments --help`. \nNote that some options are required to create new experiment.\n\n\nSpecifying jobs options within a script\n=======================================\nThis example shows how a script can specify paperspace jobs options for itself, such as `project` name, `machineType`, and a `container` reference:\n\n # tests/test_remote.py - runs itself on paperspace, demonstrates setting jobs create options\n import os\n import paperspace\n\n paperspace.run({'project': 'myproject', 'machineType': 'P5000',\n 'container': 'paperspace/tensorflow-python'})\n\n print(os.getcwd())\n print('something useful')\n\n\nAutomatic running of a python script remotely\n=============================================\nThe above example demonstrates running a python script locally and having that script transmit itself to the paperspace jobs cluster for further execution. To do this a copy of the local script is modified before transmission to the jobs cluster, in order to strip out the `import paperspace` statements and other `paperspace` library references. There are also some limitations on the types of import statements that are supported, and the dependencies that are supported in each environment (local vs. remote):\n\n1. You need to use a bare import statement, `import paperspace`, and not use the `import paperspace as ...` form.\n2. The import form `from paperspace import ...` is currently not supported.\n3. Everything after the `paperspace.run()` function call is ignored when running locally (when no script name is provided). The local script execution stops after the `paperspace.run()` call.\n4. Dependencies that are included before `paperspace.run()` must be available locally.\n5. If you need to reference dependencies that are not available locally but are available remotely, those should be imported after the `paperspace.run()` call.\n6. Dependencies that are needed remotely need to either be already installed in the container used for the job, or need to be installed using one of the techniques below in the section [Dependency Options](#dependency-options)\n\nBecause of these limitations it may not always be appropriate to run python scripts automatically from within the same script file. As an alternative you can run your python scripts unmodified using the techniques below.\n\n\nRunning a python script by name\n===============================\nYou can run an python script on paperspace from the command line as follows:\n\n paperspace-python run myscript.py\n\nYou can also provide additional jobs options on the command line:\n\n paperspace-python run myscript.py --project myproject --machineType P5000 \\\n --container paperspace/tensorflow-python`\n\nAlternatively you can use the `paperspace.run()` fuction in code with a script file name as the first argument:\n\n import paperspace\n\n paperspace.run('myscript.py') # runs myscript on paperspace\n\nIn code you can provide additional paperspace jobs create options in a dict in the second argument to run():\n\n paperspace.run('myscript.py', {'project': 'myproject', 'machineType': 'P5000',\n 'container': 'paperspace/tensorflow-python'})\n\nSee the Paperspace API [jobs create](https://paperspace.github.io/paperspace-node/jobs.html#.create) documentation for the full list of jobs create options that can be specified.\n\n\nUsing paperspace-python run\n===========================\nThe `paperspace-python run` command provides a number of options to run python code and other commands remotely, as well as copy files and set up python dependencies:\n\n paperspace-python run [options] [[-m]