Back to Article
Testing Python Jupyter Features
Download Notebook

Testing Python Jupyter Features

Pip

Most everything in the environments will be installed with pip/poetry for convenience’s sake.

In [1]:
!pip list
Package                   Version
------------------------- ---------
anyio                     4.0.0
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.0
async-lru                 2.0.4
attrs                     23.1.0
Babel                     2.13.0
backcall                  0.2.0
beautifulsoup4            4.12.2
bleach                    6.1.0
certifi                   2023.7.22
cffi                      1.16.0
charset-normalizer        3.3.0
comm                      0.1.4
debugpy                   1.8.0
decorator                 5.1.1
defusedxml                0.7.1
executing                 2.0.0
fastjsonschema            2.18.1
fqdn                      1.4.0
idna                      3.4
importlib-metadata        6.8.0
ipykernel                 6.25.2
ipython                   8.16.1
isoduration               20.11.0
jedi                      0.19.1
Jinja2                    3.1.2
json5                     0.9.14
jsonpointer               2.4
jsonschema                4.19.1
jsonschema-specifications 2023.7.1
jupyter_client            8.4.0
jupyter_core              5.4.0
jupyter-events            0.8.0
jupyter-lsp               2.2.0
jupyter_server            2.8.0
jupyter_server_terminals  0.4.4
jupyterlab                4.0.7
jupyterlab-pygments       0.2.2
jupyterlab_server         2.25.0
MarkupSafe                2.1.3
matplotlib-inline         0.1.6
mistune                   3.0.2
nbclient                  0.8.0
nbconvert                 7.9.2
nbformat                  5.9.2
nest-asyncio              1.5.8
notebook_shim             0.2.3
overrides                 7.4.0
packaging                 23.2
pandocfilters             1.5.0
parso                     0.8.3
pexpect                   4.8.0
pickleshare               0.7.5
pip                       23.2.1
platformdirs              3.11.0
prometheus-client         0.17.1
prompt-toolkit            3.0.39
psutil                    5.9.6
ptyprocess                0.7.0
pure-eval                 0.2.2
pycparser                 2.21
Pygments                  2.16.1
python-dateutil           2.8.2
python-json-logger        2.0.7
PyYAML                    6.0.1
pyzmq                     25.1.1
referencing               0.30.2
requests                  2.31.0
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rpds-py                   0.10.6
Send2Trash                1.8.2
setuptools                68.2.2
six                       1.16.0
sniffio                   1.3.0
soupsieve                 2.5
stack-data                0.6.3
terminado                 0.17.1
tinycss2                  1.2.1
tornado                   6.3.3
traitlets                 5.11.2
types-python-dateutil     2.8.19.14
uri-template              1.3.0
urllib3                   2.0.7
watermark                 2.4.3
wcwidth                   0.2.8
webcolors                 1.13
webencodings              0.5.1
websocket-client          1.6.4
wheel                     0.41.2
zipp                      3.17.0

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip

Poetry:

Pip and poetry should show the same things by virtue of poetry environments just being pipenvs under the hood:

In [2]:
!poetry config --list
cache-dir = "/home/vscode/.cache/pypoetry"  # /home/vscode/poetry-cache
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/vscode/poetry-cache/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
In [3]:
!poetry env list
python-coding-interview-LMl0r2r8-py3.11 (Activated)
In [6]:
!poetry show
anyio                     4.0.0     High level compatibility layer for mult...
argon2-cffi               23.1.0    Argon2 for Python
argon2-cffi-bindings      21.2.0    Low-level CFFI bindings for Argon2
arrow                     1.3.0     Better dates & times for Python
asttokens                 2.4.0     Annotate AST trees with source code pos...
async-lru                 2.0.4     Simple LRU cache for asyncio
attrs                     23.1.0    Classes Without Boilerplate
babel                     2.13.0    Internationalization utilities
backcall                  0.2.0     Specifications for callback functions p...
beautifulsoup4            4.12.2    Screen-scraping library
bleach                    6.1.0     An easy safelist-based HTML-sanitizing ...
certifi                   2023.7.22 Python package for providing Mozilla's ...
cffi                      1.16.0    Foreign Function Interface for Python c...
charset-normalizer        3.3.0     The Real First Universal Charset Detect...
comm                      0.1.4     Jupyter Python Comm implementation, for...
debugpy                   1.8.0     An implementation of the Debug Adapter ...
decorator                 5.1.1     Decorators for Humans
defusedxml                0.7.1     XML bomb protection for Python stdlib m...
executing                 2.0.0     Get the currently executing AST node of...
fastjsonschema            2.18.1    Fastest Python implementation of JSON s...
fqdn                      1.4.0     Validate fully-qualified domain names c...
idna                      3.4       Internationalized Domain Names in Appli...
importlib-metadata        6.8.0     Read metadata from Python packages
ipykernel                 6.25.2    IPython Kernel for Jupyter
ipython                   8.16.1    IPython: Productive Interactive Computing
isoduration               20.11.0   Operations with ISO 8601 durations
jedi                      0.19.1    An autocompletion tool for Python that ...
jinja2                    3.1.2     A very fast and expressive template eng...
json5                     0.9.14    A Python implementation of the JSON5 da...
jsonpointer               2.4       Identify specific nodes in a JSON docum...
jsonschema                4.19.1    An implementation of JSON Schema valida...
jsonschema-specifications 2023.7.1  The JSON Schema meta-schemas and vocabu...
jupyter-client            8.4.0     Jupyter protocol implementation and cli...
jupyter-core              5.4.0     Jupyter core package. A base package on...
jupyter-events            0.8.0     Jupyter Event System library
jupyter-lsp               2.2.0     Multi-Language Server WebSocket proxy f...
jupyter-server            2.8.0     The backend—i.e. core services, APIs, a...
jupyter-server-terminals  0.4.4     A Jupyter Server Extension Providing Te...
jupyterlab                4.0.7     JupyterLab computational environment
jupyterlab-pygments       0.2.2     Pygments theme using JupyterLab CSS var...
jupyterlab-server         2.25.0    A set of server components for JupyterL...
markupsafe                2.1.3     Safely add untrusted strings to HTML/XM...
matplotlib-inline         0.1.6     Inline Matplotlib backend for Jupyter
mistune                   3.0.2     A sane and fast Markdown parser with us...
nbclient                  0.8.0     A client library for executing notebook...
nbconvert                 7.9.2     Converting Jupyter Notebooks
nbformat                  5.9.2     The Jupyter Notebook format
nest-asyncio              1.5.8     Patch asyncio to allow nested event loops
notebook-shim             0.2.3     A shim layer for notebook traits and co...
overrides                 7.4.0     A decorator to automatically detect mis...
packaging                 23.2      Core utilities for Python packages
pandocfilters             1.5.0     Utilities for writing pandoc filters in...
parso                     0.8.3     A Python Parser
pexpect                   4.8.0     Pexpect allows easy control of interact...
pickleshare               0.7.5     Tiny 'shelve'-like database with concur...
platformdirs              3.11.0    A small Python package for determining ...
prometheus-client         0.17.1    Python client for the Prometheus monito...
prompt-toolkit            3.0.39    Library for building powerful interacti...
psutil                    5.9.6     Cross-platform lib for process and syst...
ptyprocess                0.7.0     Run a subprocess in a pseudo terminal
pure-eval                 0.2.2     Safely evaluate AST nodes without side ...
pycparser                 2.21      C parser in Python
pygments                  2.16.1    Pygments is a syntax highlighting packa...
python-dateutil           2.8.2     Extensions to the standard Python datet...
python-json-logger        2.0.7     A python library adding a json log form...
pyyaml                    6.0.1     YAML parser and emitter for Python
pyzmq                     25.1.1    Python bindings for 0MQ
referencing               0.30.2    JSON Referencing + Python
requests                  2.31.0    Python HTTP for Humans.
rfc3339-validator         0.1.4     A pure python RFC3339 validator
rfc3986-validator         0.1.1     Pure python rfc3986 validator
rpds-py                   0.10.6    Python bindings to Rust's persistent da...
send2trash                1.8.2     Send file to trash natively under Mac O...
setuptools                68.2.2    Easily download, build, install, upgrad...
six                       1.16.0    Python 2 and 3 compatibility utilities
sniffio                   1.3.0     Sniff out which async library your code...
soupsieve                 2.5       A modern CSS selector implementation fo...
stack-data                0.6.3     Extract data from python stack frames a...
terminado                 0.17.1    Tornado websocket backend for the Xterm...
tinycss2                  1.2.1     A tiny CSS parser
tornado                   6.3.3     Tornado is a Python web framework and a...
traitlets                 5.11.2    Traitlets Python configuration system
types-python-dateutil     2.8.19.14 Typing stubs for python-dateutil
uri-template              1.3.0     RFC 6570 URI Template Processor
urllib3                   2.0.7     HTTP library with thread-safe connectio...
watermark                 2.4.3     IPython magic function to print date/ti...
wcwidth                   0.2.8     Measures the displayed width of unicode...
webcolors                 1.13      A library for working with the color fo...
webencodings              0.5.1     Character encoding aliases for legacy w...
websocket-client          1.6.4     WebSocket client for Python with low le...
zipp                      3.17.0    Backport of pathlib-compatible object w...

I didn’t do this programmatically, but it seems clear that poetry and pip are on the same page, but poetry gives more detailed information.

Container specifics

In [5]:
!cat /proc/cpuinfo
In [6]:
!cat /etc/os-release

Watermark

This is a helpful tool in summarising Python environment from what might have been missed in previous output.

TODO: Use options from watermark…

In [12]:
%load_ext watermark
In [13]:
%watermark
Last updated: 2023-10-21T17:23:58.134068+00:00

Python implementation: CPython
Python version       : 3.11.6
IPython version      : 8.16.1

Compiler    : GCC 12.2.0
OS          : Linux
Release     : 5.15.90.1-microsoft-standard-WSL2
Machine     : x86_64
Processor   : 
CPU cores   : 8
Architecture: 64bit