Skip to main content

Jupyter support for Pants projects and PEX files.

Project description

Overview

This repo contains a set of Jupyter Notebook plugins that enable interop with pex and pants.

Installation

To install this plugin, simply invoke pip install like so:

pip install pants-jupyter-plugin

Plugin Loading

To load the plugin in your Jupyter Notebook environment, use the %load_ext command in a Notebook cell like so:

%load_ext pants_jupyter_plugin

Magics

This package provides 3 primary magics for python environment loading from pex and/or pants targets. All of these will scrub and replace the existing sys.path/environment so it's best to do this before you import any modules to avoid cached imports.

%pex_load

This magic allows you to load an existing pex file that exists on disk into the python environment.

Usage:

%pex_load <path to pex file>

%requirements_load

This magic allows you to load a transitive closure of arbitrary requirements into the environment using pex(1).

Usage:

%requirements_load <requirements>

%pants_load

This magic allows you to build and load a pants python_binary target into the environment. It works in conjunction with the %pants_repo magic, which is how you point the plugin to a given pants-compatible repo.

%pants_repo <path to pants repo>
...
%pants_load <pants target>

Development

This repo uses tox for testing and project automation. To test your changes before sending them off for review just invoke tox:

$ tox

This will auto-format code and run tests. Tests accept passthough args and pytest-xdist is installed, so you could run the full test suite with maximum parallelism via:

$ tox -p -epy{py3,3{6,7,8,9}} -- -n auto

Here you run tests against all interpreters the project supports (assuming you have these all installed on your machine and on the $PATH) in parallel (the tox -p flag) and for each parallel run of tox you run the individual test methods in parallel (via passthrough args to pytest-xdist: -- -n auto).

To find out all available tox environments use tox -a or inspect tox.ini.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pants-jupyter-plugin-0.0.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

pants_jupyter_plugin-0.0.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file pants-jupyter-plugin-0.0.1.tar.gz.

File metadata

  • Download URL: pants-jupyter-plugin-0.0.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for pants-jupyter-plugin-0.0.1.tar.gz
Algorithm Hash digest
SHA256 836d6834f99c356ba10b10453ccaba172b0529c836523973e2e7f9ad72b6fa35
MD5 76432a4641e290d3d20737bf4797197a
BLAKE2b-256 6fa6cc9a8a0ba4b4459f03ba950d37b298ff603657e39507a179a488bfbe7807

See more details on using hashes here.

File details

Details for the file pants_jupyter_plugin-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pants_jupyter_plugin-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 358bd3ce790e7e2d0ef7c46c0c99b485c34b362e8480b3a286efea9123a9858b
MD5 fef83f6b7bf7f373725ff1244c06f218
BLAKE2b-256 aaae026742acd1f02e0fa8db8cc0c929901c8920fd9cd3aafa39944ff2c70ea5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page