Skip to main content

Tiny Python library for code demonstrations and small-scale testing

Project description

quickdemo

For when unit tests would be too much!

quickdemo is a tiny Python library for code demonstrations and small-scale testing. If your debugging tool of choice is printing to stdout, this might be the right library for you.

quickdemo allows you to decorate any module-level function with an invocation or testing directive:

import quickdemo as qd

@qd.expect([1, 2], [0, 1], 1)
@qd.run([1, 2, 3], 5)
def add_to_list(input_list, number):
    return [x + number for x in input_list]

The snippet above produces the following output:

add_to_list([1, 2, 3], 5) -> [6, 7, 8]
Passed: add_to_list([0, 1], 1)

Check out the showcase*.py files for more examples!

I developed quickdemo for two reasons:

Firstly, when presenting solutions to other people, I always wrote several print statements per function to demonstrate the correctness of the solution. The print statements always added up quickly, making it difficult to discern which output corresponded to which function. Also, changing any function name implied re-writing the invocation code. This was especially tedious when working with Jupyter Notebooks, where you have to take great care to re-run a cell each time something changes.

Secondly, there is an educational programming language called Pyret, which allows writing short unit tests as part of a function definition. I believe this to be a sensible choice when targeting beginners. Unfortunately, Pyret code is neither readable nor particularly fast, so I decided to introduce this feature to Python as a part of quickdemo.

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

quickdemo-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

quickdemo-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file quickdemo-0.2.0.tar.gz.

File metadata

  • Download URL: quickdemo-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for quickdemo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 57f64441e87c0582e6f1455e0717ef1ea0fdd6c83af56bd0e37458b9e4ec6207
MD5 46c652ecd7abaddf77582a0ca1413a80
BLAKE2b-256 4aca0ccff8fad3e0899212b24ecdaac75c5ffec809f1438a244c7db8b3f5f2ac

See more details on using hashes here.

File details

Details for the file quickdemo-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: quickdemo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for quickdemo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d704596db426d5dabcb3e7a65f50779a17ec00c8418796663aa0a76d62e617
MD5 934d99fd5b6c0062bf2b3dd15ccddbcd
BLAKE2b-256 848029bf5fb2b25ab04fed9d867fe7a9d5383d6fed54381e9809e3359682af2b

See more details on using hashes here.

Supported by

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