Skip to main content

Literate package development with Jupyter

Project description

Literary

PyPI version
This package is an exploration of the literate programming idea pioneered by Donald Knuth and implemented in the nbdev package. Although nbdev looks to be a very mature and comprehensive tool, it is quite opinionated. This package is an investigation into what a smaller nbdev might look like.

Philosophy

  1. Low mental overhead
    Realistically, most Python programmers that wish to write packages need to have some familiarity with the Python package development model, including the conventional structure of a package. For this reason, I feel that it is important to design literary such that these skills translate directly to designing libraries with notebooks
  2. Minimal downstream impact
    Users of literary packages should not realise that they are consuming notebook-generated code at runtime. This means that a pure-Python package needs to be generated from the notebooks, and it must use the conventional import model. For this reason, literary should only exist as a development dependency of the package.

Differences with nbdev

  • Use of cell tags instead of comments or magics to dictate exports
  • Use of nbconvert machinery to build the pure-Python lib package
  • Use of import hooks to import other notebooks
    • Maintains a similar programming model to conventional module development
    • Reduces the need to modify notebook contents during conversion
  • Currently no documentation generation
    • Loosely, the plan is to use existing notebook-book tooling to re-use the existing Jupyter ecosystem

Design

The plan for this package is:

  1. Notebooks will be written inside <PACKAGE_NAME>/ in literary project's root directory
  2. Notebooks will respect relative imports and other pure-Python features to minimise the differences between the generated packages and the notebooks
  3. A pure-python generated lib/<PACKAGE_NAME>/ directory will be built before Poetry builds the final project.
    E.g.
    [tool.poetry]
    # ...
    packages = [
      { include = "<PACKAGE_NAME>", from = "lib" },
    ]
    

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

literary-0.2.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

literary-0.2.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file literary-0.2.2.tar.gz.

File metadata

  • Download URL: literary-0.2.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-52-generic

File hashes

Hashes for literary-0.2.2.tar.gz
Algorithm Hash digest
SHA256 bc2094cf3787490d54b2072a0474a6c3577304bdee0bd07f7492fb2c73de5a6e
MD5 e45140ec9b55460c61597257c08d1d9a
BLAKE2b-256 1824af306b3ef6968a753f07338d3b669f5527e8d92186da613b24a70d4a7eba

See more details on using hashes here.

File details

Details for the file literary-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: literary-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-52-generic

File hashes

Hashes for literary-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d143f1b39f39c7ced8efae5a032993377eaacfbfb5057b7aa5406952896e5e3
MD5 9003c25ac25a874667c6bb8f4f58412b
BLAKE2b-256 8a90e6d66386180dc26651f3d2b91c5a893fbe6168d10128f80fb0d587888986

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