This file outlines the API specifications for the endpoints used by Jupyter Package Manager
This API endpoint lists down all the projects created with this extension.
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8888/api/packagemanager/projects
Sample Output:
{
"projects": [
{
"name": "swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16",
"dir": "/home/akash/.conda/envs/swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16"
}
]
}
This API endpoint lets you delete multiple projects at once.
Endpoint:
Method: DELETE
Type: RAW
URL: http://localhost:8888/api/packagemanager/projects
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": ["/MySwanProjectA", "/MySwanProjectB"]
}
Sample Output:
{
"response":
[
{
"prefix": "/home/akash/.conda/envs/swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16",
"success": true,
"actions": {
"PREFIX": "/home/akash/.conda/envs/swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16",
"UNLINK": [
{
"dist_name": "ipython_genutils-0.2.0-py37_0",
"build_number": 0,
"name": "ipython_genutils",
"build_string": "py37_0",
"base_url": "https://repo.anaconda.com/pkgs/main",
"platform": "linux-64",
"version": "0.2.0",
"channel": "pkgs/main"
}
],
"FETCH": []
}
}
]
}
The extension installs the package onto the corresponding project.
The .swanproject gets updated with the new package and respective version.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8888/api/packagemanager/packages
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectA",
"packages": ["pyyaml=3.13"]
}
The extension removes the package from the corresponding project.
The .swanproject gets updated with the current set of packages and respective versions.
Endpoint:
Method: DELETE
Type: RAW
URL: http://localhost:8888/api/packagemanager/packages
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectA",
"packages": ["pyyaml"]
}
This API endpoint returns the list of packages that can be updated in the corresponding project.
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8888/api/packagemanager/packages/check_update
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Query params:
Key | Value | Description |
---|---|---|
project | /MySwanProjectA |
The API endpoint installs the latest versions of packages onto the corresponding project.
The .swanproject gets updated with the new packages and respective versions.
Endpoint:
Method: PATCH
Type: RAW
URL: http://localhost:8888/api/packagemanager/packages
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectA",
"packages": ["pyyaml"]
}
This API endpoint lets you search a package name for installation.
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8888/api/packagemanager/packages/search
Query params:
Key | Value | Description |
---|---|---|
q | pyyaml=3.13 |
The API endpoint creates a conda environment with a Python kernel installed (ipykernel).
The .swanproject file gets filled with the swanproject-UUID (name of the environment internally) and the installed packages.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8888/api/packagemanager/projects
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectA",
"env_type": "python3"
}
Sample Output:
{
"prefix": "/home/akash/.conda/envs/swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16",
"success": true,
"actions": {
"PREFIX": "/home/akash/.conda/envs/swanproject-ad4d7f04-98c6-11e9-830c-ac2b6ebe8a16",
"LINK": [
{
"dist_name": "ipython_genutils-0.2.0-py37_0",
"build_number": 0,
"name": "ipython_genutils",
"build_string": "py37_0",
"base_url": "https://repo.anaconda.com/pkgs/main",
"platform": "linux-64",
"version": "0.2.0",
"channel": "pkgs/main"
}
],
"FETCH": []
}
}
The API endpoint deletes the conda environment corresponding to a project.
The 'kernel.json' for the environment corresponding to the project is removed.
Note that the project directory has to exist while calling this endpoint, and it is left unmodified by invoking this API.
Endpoint:
Method: DELETE
Type: RAW
URL: http://localhost:8888/api/packagemanager/projects
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": ["/MySwanProjectA"]
}
The API endpoint exports the details of the conda environment corresponding to a project.
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8888/api/packagemanager/project_info
Headers:
Key | Value | Description |
---|---|---|
Content-Type | text/plain |
Query params:
Key | Value | Description |
---|---|---|
project | /MySwanProjectA |
Sample Output:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=main
backcall=0.1.0=py37_0
blas=1.0=mkl
The API endpoint outlines the details of the conda environment corresponding to a project.
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8888/api/packagemanager/project_info
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Query params:
Key | Value | Description |
---|---|---|
project | /MySwanProjectA |
Sample Output:
{
"packages": [
{
"status": "installed",
"version": "3.28.0",
"build_string": "h7b6447c_0",
"name": "sqlite"
}
],
"env": "swanproject-729350f4-9e8f-11e9-b575-ac2b6ebe8a16"
}
This API endpoint updates a project with all the packages obtained from an export file.
Endpoint:
Method: PUT
Type: FORMDATA
URL: http://localhost:8888/api/packagemanager/project_info
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/x-www-form-urlencoded |
Body:
Key | Value | Description |
---|---|---|
file | ||
project | /MySwanProjectA |
This API endpoint syncs a .swanproject file and the corresponding conda env.
Endpoint:
Method: PATCH
Type: RAW
URL: http://localhost:8888/api/packagemanager/project_info
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectA"
}
This enpoint creates a new env for a folder that has just been cloned.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8888/api/packagemanager/project_clone
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Body:
{
"project": "/MySwanProjectB"
}