Skip to main content

nbagile

Making nbdev more Agile-Friendly

Install

pip install nbagile

Goals:

  • When exporting source code using docments, attach and format the docstring to Numpy format
  • Export tests and throw them into a pytest-compatible file format
  • Make documentation run on Sphynx
  • Tests are exported to a tests folder, source code to a source code folder, and Markdown/Sphynx documentation to a docs folder
  • Individual notebooks can then be recreated from these three items

Current Capabilities

Using the CLI

Replace nbdev_ commands with nbagile_ to use it's capabilities. Currently Supported:

  • nbagile_build_lib: Exports code and converts it to black-style + NumPy docstrings
  • nbagile_diff_nbs: A special version of nbdev_diff_nbs to support how nbagile works
  • nbagile_build_docs: Builds the docs using nbverbose

Exporting code from docments to NumPy

docments is a very efficient way of documenting the parameters for your code, and is akin to how javascript is documented. We utilize comment-blocks and typing to describe how parameters are utilized. For example, we have the following:

def addition(
    a:int, # The first number to add
    b:(int,float), # The second number to add
) -> int: # The sum of a and b
    "Adds a and b"
    return a+b

But this is not the commonly accepted way of documenting our code, and as a whole looks quite ugly.

nbagile supports building your nbdev built libraries to instead automatically convert this code into a more NumPy-styled documentation string and definition, with the added bonus of it mimicing the Black format:

def addition(a,b):
    """Adds a and b
    
    Parameters
    ----------
    a : int
      The first number to add
    b : (int,float)
      The second number to add
      
    Returns
    ----------
    int
      The sum of a and b
    """
    return a+b

This works for functions, classes, as well as functions wrapped around decorators.

Optional __all__ for nbdev

If you are not a fan of nbdev's __all__ format in each file, there is an additional setting you can add to your settings.ini: use_all.

If set to False, you won't get the __all__ being generated in each python file

Download files

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

Source Distribution

nbagile-0.0.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbagile-0.0.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file nbagile-0.0.2.tar.gz.

File metadata

  • Download URL: nbagile-0.0.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for nbagile-0.0.2.tar.gz
Algorithm Hash digest
SHA256 43f9f519fde5a10f62ec527074d3471319abc30e12588d1eac8e4c714370f61f
MD5 3cc909a1dd5b30bef623b57304b7fdf5
BLAKE2b-256 bec593afcfb260fb4ea71f977873b79e55baf84fd25dde0f4b20dab170bb1b1d

See more details on using hashes here.

File details

Details for the file nbagile-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: nbagile-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for nbagile-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ceccba86d6f815f2c15195fb9493980f196540338cbb53cf8c79c311374e310
MD5 56690820247972c16fbe7e250cd098f3
BLAKE2b-256 030a48fd7b7d9fe9296326eb81b02b232599adc519d8b8cfd9cfbba6433709dd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page