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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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