Skip to main content

Read Python source code from the command line

Project description

PyBites Pysource

A command line tool to read Python source code.

Installation

You can install pybites-pysource from PyPI:

pip install pybites-pysource

This tool uses Python 3.x

Usage

You can use pybites-pysource:

  1. From the command line

     $ pysource -m re.match
     def match(pattern, string, flags=0):
     	"""Try to apply the pattern at the start of the string, returning
     	a Match object, or None if no match was found."""
     	return _compile(pattern, flags).match(string)
    

    To show the resulting code with paging call pysource with -p.

  2. From within Vim by selecting a module.callable adding this to your .vimrc:

     autocmd FileType python map <leader>py :exec '!python3.9 $HOME/bin/pysource.py -m <C-R><C-A> -p'<CR>
    

Check out our blog post for a demo.

Tests

To run the tests:

$ python setup.py test

See: Integrating with setuptools / python setup.py test / pytest-runner.


Enjoy!

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

pybites-pysource-1.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

pybites_pysource-1.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pybites-pysource-1.1.0.tar.gz.

File metadata

  • Download URL: pybites-pysource-1.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for pybites-pysource-1.1.0.tar.gz
Algorithm Hash digest
SHA256 80daab196cf75815a6a0544a4c9117937d1a745b150019572ecfc77d1fd353c1
MD5 ad4d1fce770dfd4339a9616a062b9b47
BLAKE2b-256 4f4ec02c1146e70e9d8c5af12b69c3f65132a9ad7db99de0bf3255150992693a

See more details on using hashes here.

File details

Details for the file pybites_pysource-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pybites_pysource-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for pybites_pysource-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13778c2f8a7110b3d9b288fbe098d9e23ac26d21f871f34559678d6d30077ebe
MD5 c1b7769bc502a95d5613a354f9fc4db3
BLAKE2b-256 e3a1223192d4f3592b7111169480908a8a3d855bab348310fcc7f192538a0601

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