Skip to main content

with repr value as comment

Project description

pycomment Python package PyPi version Code style: black

Inserting repr value on comment with marker (marker is # =>). This is heavily inspired by xmpfilter of ruby's rocodetools.

install

$ pip install pycomment

how to use

code.py

import sys

print("stderr", file=sys.stderr)
print("hello")
1 + 2 + 3 + 3 + 4 + 5  # =>
1 + 2 + 3 + 3 + 4 + 5  # =>
print("bye")
$ pycomment --inplace code.py
import sys

print("stderr", file=sys.stderr)
print("hello")
1 + 2 + 3 + 3 + 4 + 5  # => 18
1 + 2 + 3 + 3 + 4 + 5  # => 18
print("bye")


# -- stdout --------------------
# >> hello
# >> bye

multi-line output

import numpy as np

np.arange(9).reshape((3, 3))  # => multi-line..
# array([[0, 1, 2],
#        [3, 4, 5],
#        [6, 7, 8]])
# ..multi-line

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

pycomment-0.2.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

pycomment-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycomment-0.2.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pycomment-0.2.0.tar.gz
Algorithm Hash digest
SHA256 beeeecbc61eeadd89f20451591673a291aa7063be5be17b886960babd950e77e
MD5 49e4565762980ff80aa5ebc5c28cb4f1
BLAKE2b-256 8682963ebc71fad2cc47be6bad7f281733db11ccbca65ea6f4164342a66d285c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycomment-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pycomment-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2476c0be56adae578d63ef84c64757644ba3f7caa0e2b50a830704bbf2f56091
MD5 cc0d8ca3072a998d81245259c6b6ff94
BLAKE2b-256 e9becce49a7093087eaea80bcf309e4eee9e59b1b80f715d6cc182d78c8b1304

See more details on using hashes here.

Supported by

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