Skip to main content

codecolor

https://raw.githubusercontent.com/zkneupper/codecolor/master/docs/_static/code_color_logo.png https://img.shields.io/pypi/v/codecolor.svg https://img.shields.io/travis/zkneupper/codecolor.svg Documentation Status

Inspect python object code with colorful syntax highlighting!

Codecolor adds color when inspecting source code of python objects. It applies syntax highlighting to object source code.

The primary function of the codecolor module is the printsource function. The printsource(obj, style=”default”) function prints the syntax-highlighted source code for the python object obj.

Codecolor combines the code inspection functionality of inspect.getsource() and syntax highlighting functionality of the pygments package.

Example

How does the pytorch relu function work under the hood? You can easily inspect the source code of the pytorch relu function by using codecolor.printsource(relu) to to print the source code of the relu function with syntax highlighting.

from codecolor import printsource

from torch.nn.functional import relu

printsource(relu)
# prints the source code of the relu function with syntax highlighting
https://raw.githubusercontent.com/zkneupper/codecolor/master/docs/_static/codecolor-demo.gif

Functions:

  • printsource(obj, style=”default”)

  • getsource(obj, style=”default”)

  • highlight_code(code, style=”default”)

  • get_all_styles()

To-Do

  • Add pytest unit tests

  • Flesh out readme

    • Example usage

    • Motivation

    • Installation

    • Center logo image

  • Deploy to pypi

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.0.1 (2020-09-19)

  • First release on PyPI.

Metadata

Release files for codecolor 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codecolor 0.0.2
File Size Uploaded
codecolor-0.0.2.tar.gz 653.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codecolor 0.0.2
File Interpreter ABI Platform
codecolor-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 659.5 kB

Release files / codecolor-0.0.2.tar.gz

Download URL codecolor-0.0.2.tar.gz
Size 653.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2d50af44a135db210d1f9dff3b55f779d4d1a36607790ca542a64da8ef0b9a0c
BLAKE2b-256 checksum
How to use checksums
3b8fefaf7ef305964998e7b4ada2fc0dfb1f7a87fb77ec3a4c6750040e84a113
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Release files / codecolor-0.0.2-py2.py3-none-any.whl

Download URL codecolor-0.0.2-py2.py3-none-any.whl
Size 6.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
77db8357a5a2393691805a9c86ca9c650ba7f78169a07794dafa8c67e7114e3b
BLAKE2b-256 checksum
How to use checksums
474c01e9d99d2d2ecbbddaf3eff0d2f1f4fb35aa900b63603a6a6fb2fa826a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page