Notebooks

class Notebooks(session_kwargs, client, return_type='raw')

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.notebooks.list(...)

Methods

delete_deployments(notebook_id, deployment_id)

Delete a Notebook deployment

delete_projects(id, project_id)

Remove a Notebook from a project

delete_shares_groups(id, group_id)

Revoke the permissions a group has on this object

delete_shares_users(id, user_id)

Revoke the permissions a user has on this object

get(id)

Get a Notebook

get_deployments(notebook_id, deployment_id)

Get details about a Notebook deployment

get_git_commits(id, commit_hash)

Get file contents at git ref

list(*[, hidden, archived, author, status, ...])

List Notebooks

list_dependencies(id, *[, user_id])

List dependent objects for this object

list_deployments(notebook_id, *[, ...])

List deployments for a Notebook

list_deployments_logs(id, deployment_id, *)

Get the logs for a Notebook deployment

list_git(id)

Get the git metadata attached to an item

list_git_commits(id)

Get the git commits for an item on the current branch

list_projects(id, *[, hidden])

List the projects a Notebook belongs to

list_shares(id)

List users and groups permissioned on this object

list_update_links(id)

Get URLs to update notebook

patch(id, *[, name, language, description, ...])

Update some attributes of this Notebook

patch_git(id, *[, git_ref, git_branch, ...])

Update an attached git file

post(*[, name, language, description, ...])

Create a Notebook

post_clone(id)

Clone this Notebook

post_deployments(notebook_id, *[, deployment_id])

Deploy a Notebook

post_git_checkout(id)

Checkout content that the existing git_ref points to and save to the object

post_git_checkout_latest(id)

Checkout latest commit on the current branch of a script or workflow

post_git_commits(id, content, message, file_hash)

Commit and push a new version of the file

put(id, *[, name, language, description, ...])

Replace all attributes of this Notebook

put_archive(id, status)

Update the archive status of this object

put_git(id, *[, git_ref, git_branch, ...])

Attach an item to a file in a git repo

put_projects(id, project_id)

Add a Notebook to a project

put_shares_groups(id, group_ids, ...[, ...])

Set the permissions groups has on this object

put_shares_users(id, user_ids, ...[, ...])

Set the permissions users have on this object

put_transfer(id, user_id, ...[, email_body, ...])

Transfer ownership of this object to another user

delete_deployments(notebook_id: int, deployment_id: int)

Delete a Notebook deployment

Parameters:
notebook_idint

The ID of the owning Notebook

deployment_idint

The ID for this deployment

Returns:
None

Response code 204: success

delete_projects(id: int, project_id: int)

Remove a Notebook from a project

Parameters:
idint

The ID of the Notebook.

project_idint

The ID of the project.

Returns:
None

Response code 204: success

delete_shares_groups(id: int, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_shares_users(id: int, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID of the resource that is shared.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

get(id: int)

Get a Notebook

Parameters:
idint
Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

get_deployments(notebook_id: int, deployment_id: int)

Get details about a Notebook deployment

Parameters:
notebook_idint

The ID of the owning Notebook

deployment_idint

The ID for this deployment

Returns:
civis.response.Response
  • deployment_idint

    The ID for this deployment.

  • user_idint

    The ID of the owner.

  • hoststr

    Domain of the deployment.

  • namestr

    Name of the deployment.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • display_urlstr

    A signed URL for viewing the deployed item.

  • instance_typestr

    The EC2 instance type requested for the deployment.

  • memoryint

    The memory allocated to the deployment, in MB.

  • cpuint

    The cpu allocated to the deployment, in millicores.

  • statestr

    The state of the deployment.

  • state_messagestr

    A detailed description of the state.

  • max_memory_usagefloat (float)

    If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

  • max_cpu_usagefloat (float)

    If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

  • created_at : str (time)

  • updated_at : str (time)

  • notebook_idint

    The ID of owning Notebook

get_git_commits(id: int, commit_hash: str)

Get file contents at git ref

Parameters:
idint

The ID of the file.

commit_hashstr

The SHA (full or shortened) of the desired git commit.

Returns:
civis.response.Response
  • contentstr

    The file’s contents.

  • typestr

    The file’s type.

  • sizeint

    The file’s size.

  • file_hashstr

    The SHA of the file.

list(*, hidden: bool = None, archived: str = None, author: str = None, status: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List Notebooks

Parameters:
hiddenbool, optional

If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.

archivedstr, optional

The archival status of the requested item(s).

authorstr, optional

If specified, return items from any of these authors. It accepts a comma- separated list of user IDs.

statusstr, optional

If specified, returns notebooks with one of these statuses. It accepts a comma-separated list, possible values are ‘running’, ‘pending’, ‘idle’.

limitint, optional

Number of results to return. Defaults to 20. Maximum allowed is 50.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, name, created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • archivedstr

    The archival status of the requested item(s).

list_dependencies(id: int, *, user_id: int = None)

List dependent objects for this object

Parameters:
idint

The ID of the resource that is shared.

user_idint, optional

ID of target user

Returns:
civis.response.Response
  • object_typestr

    Dependent object type

  • fco_typestr

    Human readable dependent object type

  • idint

    Dependent object ID

  • namestr

    Dependent object name, or nil if the requesting user cannot read this object

  • permission_levelstr

    Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

  • descriptionstr

    Additional information about the dependency, if relevant

  • shareablebool

    Whether or not the requesting user can share this object.

list_deployments(notebook_id: int, *, deployment_id: int = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List deployments for a Notebook

Parameters:
notebook_idint

The ID of the owning Notebook

deployment_idint, optional

The ID for this deployment

limitint, optional

Number of results to return. Defaults to 20. Maximum allowed is 50.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to created_at. Must be one of: created_at.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • deployment_idint

    The ID for this deployment.

  • user_idint

    The ID of the owner.

  • hoststr

    Domain of the deployment.

  • namestr

    Name of the deployment.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type requested for the deployment.

  • memoryint

    The memory allocated to the deployment, in MB.

  • cpuint

    The cpu allocated to the deployment, in millicores.

  • statestr

    The state of the deployment.

  • state_messagestr

    A detailed description of the state.

  • max_memory_usagefloat (float)

    If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

  • max_cpu_usagefloat (float)

    If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

  • created_at : str (time)

  • updated_at : str (time)

  • notebook_idint

    The ID of owning Notebook

list_deployments_logs(id: int, deployment_id: int, *, start_at: str = None, end_at: str = None, limit: int = None)

Get the logs for a Notebook deployment

Parameters:
idint

The ID of the owning Notebook.

deployment_idint

The ID for this deployment.

start_atstr, optional

Log entries with a lower timestamp will be omitted.

end_atstr, optional

Log entries with a higher timestamp will be omitted.

limitint, optional

The maximum number of log messages to return. Default of 10000.

Returns:
civis.response.Response
  • messagestr

    The log message.

  • streamstr

    The stream of the log. One of “stdout”, “stderr”.

  • created_atstr (date-time)

    The time the log was created.

  • sourcestr

    The source of the log. One of “system”, “user”.

list_git(id: int)

Get the git metadata attached to an item

Parameters:
idint

The ID of the file.

Returns:
civis.response.Response
  • git_refstr

    A git reference specifying an unambiguous version of the file. Can be a branch name, tag or the full or shortened SHA of a commit.

  • git_branchstr

    The git branch that the file is on.

  • git_pathstr

    The path of the file in the repository.

  • git_repodict
    • idint

      The ID for this git repository.

    • repo_urlstr

      The URL for this git repository.

    • created_at : str (time)

    • updated_at : str (time)

  • git_ref_typestr

    Specifies if the file is versioned by branch or tag.

  • pull_from_gitbool

    Automatically pull latest commit from git. Only works for scripts and workflows (assuming you have the feature enabled)

list_git_commits(id: int)

Get the git commits for an item on the current branch

Parameters:
idint

The ID of the file.

Returns:
civis.response.Response
  • commit_hashstr

    The SHA of the commit.

  • author_namestr

    The name of the commit’s author.

  • datestr (time)

    The commit’s timestamp.

  • messagestr

    The commit message.

list_projects(id: int, *, hidden: bool = None)

List the projects a Notebook belongs to

Parameters:
idint

The ID of the Notebook.

hiddenbool, optional

If specified to be true, returns hidden items. Defaults to false, returning non-hidden items.

Returns:
civis.response.Response
  • idint

    The ID for this project.

  • authordict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • namestr

    The name of this project.

  • descriptionstr

    A description of the project.

  • usersList[dict]

    Users who can see the project.

    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • auto_share : bool

  • created_at : str (time)

  • updated_at : str (time)

  • archivedstr

    The archival status of the requested item(s).

list_shares(id: int)

List users and groups permissioned on this object

Parameters:
idint

The ID of the resource that is shared.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

Get URLs to update notebook

Parameters:
idint
Returns:
civis.response.Response
  • update_urlstr

    Time-limited URL to PUT new contents of the .ipynb file for this notebook.

  • update_preview_urlstr

    Time-limited URL to PUT new contents of the .htm preview file for this notebook.

patch(id: int, *, name: str = None, language: str = None, description: str = None, file_id: str = None, requirements_file_id: str = None, requirements: str = None, docker_image_name: str = None, docker_image_tag: str = None, instance_type: str = None, memory: int = None, cpu: int = None, credentials: List[int] = None, environment_variables: dict = None, idle_timeout: int = None, partition_label: str = None, git_repo_url: str = None, git_ref: str = None, git_path: str = None)

Update some attributes of this Notebook

Parameters:
idint

The ID for this notebook.

namestr, optional

The name of this notebook.

languagestr, optional

The kernel language of this notebook.

descriptionstr, optional

The description of this notebook.

file_idstr, optional

The file ID for the S3 file containing the .ipynb file.

requirements_file_idstr, optional

The file ID for the S3 file containing the requirements.txt file.

requirementsstr, optional

The requirements txt file.

docker_image_namestr, optional

The name of the docker image to pull from DockerHub.

docker_image_tagstr, optional

The tag of the docker image to pull from DockerHub (default: latest).

instance_typestr, optional

The EC2 instance type to deploy to.

memoryint, optional

The amount of memory allocated to the notebook.

cpuint, optional

The amount of cpu allocated to the the notebook.

credentialsList[int], optional

A list of credential IDs to pass to the notebook.

environment_variablesdict, optional

Environment variables to be passed into the Notebook.

idle_timeoutint, optional

How long the notebook will stay alive without any kernel activity.

partition_labelstr, optional

The partition label used to run this object.

git_repo_urlstr, optional

The url of the git repository

git_refstr, optional

The git reference if git repo is specified

git_pathstr, optional

The path to the .ipynb file in the git repo that will be started up on notebook launch

Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

patch_git(id: int, *, git_ref: str = None, git_branch: str = None, git_path: str = None, git_repo_url: str = None, git_ref_type: str = None, pull_from_git: bool = None)

Update an attached git file

Parameters:
idint

The ID of the file.

git_refstr, optional

A git reference specifying an unambiguous version of the file. Can be a branch name, or the full or shortened SHA of a commit.

git_branchstr, optional

The git branch that the file is on.

git_pathstr, optional

The path of the file in the repository.

git_repo_urlstr, optional

The URL of the git repository.

git_ref_typestr, optional

Specifies if the file is versioned by branch or tag.

pull_from_gitbool, optional

Automatically pull latest commit from git. Only works for scripts.

Returns:
civis.response.Response
  • git_refstr

    A git reference specifying an unambiguous version of the file. Can be a branch name, tag or the full or shortened SHA of a commit.

  • git_branchstr

    The git branch that the file is on.

  • git_pathstr

    The path of the file in the repository.

  • git_repodict
    • idint

      The ID for this git repository.

    • repo_urlstr

      The URL for this git repository.

    • created_at : str (time)

    • updated_at : str (time)

  • git_ref_typestr

    Specifies if the file is versioned by branch or tag.

  • pull_from_gitbool

    Automatically pull latest commit from git. Only works for scripts and workflows (assuming you have the feature enabled)

post(*, name: str = None, language: str = None, description: str = None, file_id: str = None, requirements_file_id: str = None, requirements: str = None, docker_image_name: str = None, docker_image_tag: str = None, instance_type: str = None, memory: int = None, cpu: int = None, credentials: List[int] = None, environment_variables: dict = None, idle_timeout: int = None, partition_label: str = None, git_repo_url: str = None, git_ref: str = None, git_path: str = None, hidden: bool = None)

Create a Notebook

Parameters:
namestr, optional

The name of this notebook.

languagestr, optional

The kernel language of this notebook.

descriptionstr, optional

The description of this notebook.

file_idstr, optional

The file ID for the S3 file containing the .ipynb file.

requirements_file_idstr, optional

The file ID for the S3 file containing the requirements.txt file.

requirementsstr, optional

The requirements txt file.

docker_image_namestr, optional

The name of the docker image to pull from DockerHub.

docker_image_tagstr, optional

The tag of the docker image to pull from DockerHub (default: latest).

instance_typestr, optional

The EC2 instance type to deploy to.

memoryint, optional

The amount of memory allocated to the notebook.

cpuint, optional

The amount of cpu allocated to the the notebook.

credentialsList[int], optional

A list of credential IDs to pass to the notebook.

environment_variablesdict, optional

Environment variables to be passed into the Notebook.

idle_timeoutint, optional

How long the notebook will stay alive without any kernel activity.

partition_labelstr, optional

The partition label used to run this object.

git_repo_urlstr, optional

The url of the git repository

git_refstr, optional

The git reference if git repo is specified

git_pathstr, optional

The path to the .ipynb file in the git repo that will be started up on notebook launch

hiddenbool, optional

The hidden status of the item.

Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

post_clone(id: int)

Clone this Notebook

Parameters:
idint
Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

post_deployments(notebook_id: int, *, deployment_id: int = None)

Deploy a Notebook

Parameters:
notebook_idint

The ID of the owning Notebook

deployment_idint, optional

The ID for this deployment

Returns:
civis.response.Response
  • deployment_idint

    The ID for this deployment.

  • user_idint

    The ID of the owner.

  • hoststr

    Domain of the deployment.

  • namestr

    Name of the deployment.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • display_urlstr

    A signed URL for viewing the deployed item.

  • instance_typestr

    The EC2 instance type requested for the deployment.

  • memoryint

    The memory allocated to the deployment, in MB.

  • cpuint

    The cpu allocated to the deployment, in millicores.

  • statestr

    The state of the deployment.

  • state_messagestr

    A detailed description of the state.

  • max_memory_usagefloat (float)

    If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

  • max_cpu_usagefloat (float)

    If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

  • created_at : str (time)

  • updated_at : str (time)

  • notebook_idint

    The ID of owning Notebook

post_git_checkout(id: int)

Checkout content that the existing git_ref points to and save to the object

Parameters:
idint

The ID of the file.

Returns:
civis.response.Response
  • contentstr

    The file’s contents.

  • typestr

    The file’s type.

  • sizeint

    The file’s size.

  • file_hashstr

    The SHA of the file.

post_git_checkout_latest(id: int)

Checkout latest commit on the current branch of a script or workflow

Parameters:
idint

The ID of the file.

Returns:
civis.response.Response
  • contentstr

    The file’s contents.

  • typestr

    The file’s type.

  • sizeint

    The file’s size.

  • file_hashstr

    The SHA of the file.

post_git_commits(id: int, content: str, message: str, file_hash: str)

Commit and push a new version of the file

Parameters:
idint

The ID of the file.

contentstr

The contents to commit to the file.

messagestr

A commit message describing the changes being made.

file_hashstr

The full SHA of the file being replaced.

Returns:
civis.response.Response
  • contentstr

    The file’s contents.

  • typestr

    The file’s type.

  • sizeint

    The file’s size.

  • file_hashstr

    The SHA of the file.

put(id: int, *, name: str = None, language: str = None, description: str = None, file_id: str = None, requirements_file_id: str = None, requirements: str = None, docker_image_name: str = None, docker_image_tag: str = None, instance_type: str = None, memory: int = None, cpu: int = None, credentials: List[int] = None, environment_variables: dict = None, idle_timeout: int = None, partition_label: str = None, git_repo_url: str = None, git_ref: str = None, git_path: str = None)

Replace all attributes of this Notebook

Parameters:
idint

The ID for this notebook.

namestr, optional

The name of this notebook.

languagestr, optional

The kernel language of this notebook.

descriptionstr, optional

The description of this notebook.

file_idstr, optional

The file ID for the S3 file containing the .ipynb file.

requirements_file_idstr, optional

The file ID for the S3 file containing the requirements.txt file.

requirementsstr, optional

The requirements txt file.

docker_image_namestr, optional

The name of the docker image to pull from DockerHub.

docker_image_tagstr, optional

The tag of the docker image to pull from DockerHub (default: latest).

instance_typestr, optional

The EC2 instance type to deploy to.

memoryint, optional

The amount of memory allocated to the notebook.

cpuint, optional

The amount of cpu allocated to the the notebook.

credentialsList[int], optional

A list of credential IDs to pass to the notebook.

environment_variablesdict, optional

Environment variables to be passed into the Notebook.

idle_timeoutint, optional

How long the notebook will stay alive without any kernel activity.

partition_labelstr, optional

The partition label used to run this object.

git_repo_urlstr, optional

The url of the git repository

git_refstr, optional

The git reference if git repo is specified

git_pathstr, optional

The path to the .ipynb file in the git repo that will be started up on notebook launch

Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

put_archive(id: int, status: bool)

Update the archive status of this object

Parameters:
idint

The ID of the object.

statusbool

The desired archived status of the object.

Returns:
civis.response.Response
  • idint

    The ID for this notebook.

  • namestr

    The name of this notebook.

  • languagestr

    The kernel language of this notebook.

  • descriptionstr

    The description of this notebook.

  • notebook_urlstr

    Time-limited URL to get the .ipynb file for this notebook.

  • notebook_preview_urlstr

    Time-limited URL to get the .htm preview file for this notebook.

  • requirements_urlstr

    Time-limited URL to get the requirements.txt file for this notebook.

  • file_idstr

    The file ID for the S3 file containing the .ipynb file.

  • requirements_file_idstr

    The file ID for the S3 file containing the requirements.txt file.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • docker_image_namestr

    The name of the docker image to pull from DockerHub.

  • docker_image_tagstr

    The tag of the docker image to pull from DockerHub (default: latest).

  • instance_typestr

    The EC2 instance type to deploy to.

  • memoryint

    The amount of memory allocated to the notebook.

  • cpuint

    The amount of cpu allocated to the the notebook.

  • created_at : str (time)

  • updated_at : str (time)

  • most_recent_deploymentdict
    • deployment_idint

      The ID for this deployment.

    • user_idint

      The ID of the owner.

    • hoststr

      Domain of the deployment.

    • namestr

      Name of the deployment.

    • docker_image_namestr

      The name of the docker image to pull from DockerHub.

    • docker_image_tagstr

      The tag of the docker image to pull from DockerHub (default: latest).

    • display_urlstr

      A signed URL for viewing the deployed item.

    • instance_typestr

      The EC2 instance type requested for the deployment.

    • memoryint

      The memory allocated to the deployment, in MB.

    • cpuint

      The cpu allocated to the deployment, in millicores.

    • statestr

      The state of the deployment.

    • state_messagestr

      A detailed description of the state.

    • max_memory_usagefloat (float)

      If the deployment has finished, the maximum amount of memory used during the deployment, in MB.

    • max_cpu_usagefloat (float)

      If the deployment has finished, the maximum amount of cpu used during the deployment, in millicores.

    • created_at : str (time)

    • updated_at : str (time)

    • notebook_idint

      The ID of owning Notebook

  • credentialsList[int]

    A list of credential IDs to pass to the notebook.

  • environment_variablesdict

    Environment variables to be passed into the Notebook.

  • idle_timeoutint

    How long the notebook will stay alive without any kernel activity.

  • partition_labelstr

    The partition label used to run this object.

  • git_repo_idint

    The ID of the git repository.

  • git_repo_urlstr

    The url of the git repository

  • git_refstr

    The git reference if git repo is specified

  • git_pathstr

    The path to the .ipynb file in the git repo that will be started up on notebook launch

  • my_permission_levelstr

    Your permission level on the object. One of “read”, “write”, or “manage”.

  • archivedstr

    The archival status of the requested item(s).

  • hiddenbool

    The hidden status of the item.

put_git(id: int, *, git_ref: str = None, git_branch: str = None, git_path: str = None, git_repo_url: str = None, git_ref_type: str = None, pull_from_git: bool = None)

Attach an item to a file in a git repo

Parameters:
idint

The ID of the file.

git_refstr, optional

A git reference specifying an unambiguous version of the file. Can be a branch name, or the full or shortened SHA of a commit.

git_branchstr, optional

The git branch that the file is on.

git_pathstr, optional

The path of the file in the repository.

git_repo_urlstr, optional

The URL of the git repository.

git_ref_typestr, optional

Specifies if the file is versioned by branch or tag.

pull_from_gitbool, optional

Automatically pull latest commit from git. Only works for scripts.

Returns:
civis.response.Response
  • git_refstr

    A git reference specifying an unambiguous version of the file. Can be a branch name, tag or the full or shortened SHA of a commit.

  • git_branchstr

    The git branch that the file is on.

  • git_pathstr

    The path of the file in the repository.

  • git_repodict
    • idint

      The ID for this git repository.

    • repo_urlstr

      The URL for this git repository.

    • created_at : str (time)

    • updated_at : str (time)

  • git_ref_typestr

    Specifies if the file is versioned by branch or tag.

  • pull_from_gitbool

    Automatically pull latest commit from git. Only works for scripts and workflows (assuming you have the feature enabled)

put_projects(id: int, project_id: int)

Add a Notebook to a project

Parameters:
idint

The ID of the Notebook.

project_idint

The ID of the project.

Returns:
None

Response code 204: success

put_shares_groups(id: int, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_shares_users(id: int, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID of the resource that is shared.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_transfer(id: int, user_id: int, include_dependencies: bool, *, email_body: str = None, send_email: bool = None)

Transfer ownership of this object to another user

Parameters:
idint

The ID of the resource that is shared.

user_idint

ID of target user

include_dependenciesbool

Whether or not to give manage permissions on all dependencies

email_bodystr, optional

Custom body text for e-mail sent on transfer.

send_emailbool, optional

Send email to the target user of the transfer?

Returns:
civis.response.Response
  • dependenciesList[dict]

    Dependent objects for this object

    • object_typestr

      Dependent object type

    • fco_typestr

      Human readable dependent object type

    • idint

      Dependent object ID

    • namestr

      Dependent object name, or nil if the requesting user cannot read this object

    • permission_levelstr

      Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

    • descriptionstr

      Additional information about the dependency, if relevant

    • sharedbool

      Whether dependent object was successfully shared with target user