Shell-like tool to make it easier to develop python code
Project description
devshell
devshell is my python development workflow helper.
Navigating Code Trees
There's normal basic shell navigation with cd, ls, pwd, and then there are python versions of those for navigating through a code tree: pcd, pls, ppwd.
What is a code tree? It is the following types of code blocks:
- Package
- Module
- Class
- Function/Method/Coroutine
$ cd ~/projects/statopy
$ ls
LICENSE __pycache__ statopy.py
$ python3 -m devshell
Starting devshell command line interface...
devshell version 0.0.3
Welcome to devshell. Type help or ? to list commands. Start a line with ! to execute a shell command in a sub-shell (does not retain environmental variables).
(devshell)$
If a package or module in your current working directory (the normal type affected by cd and reported with pwd), then those will show up when you type pls. You can enter your "python location" into it via pcd and check your current python location with ppwd.
Autocompletion works as usual for cd and ls. For the python versions, autocompletion shows you what your options are in terms of child code blocks (e.g. methods in the current class).
(devshell)$ pls
statopy module directory
(devshell)$ pcd statopy
(devshell)$ pls
ScalarProbModel class directory
ScalarRegression class directory
ScalarStats class directory
VectorStats class directory
(devshell)$ pcd ScalarStats
(devshell)$ pls
__add__ function non-directory
__init__ function non-directory
__setattr__ function non-directory
consume function non-directory
update function non-directory
(devshell)$ ppwd
/statopy.ScalarStats (class)
(devshell)$
Commands
That's nice, but what can you do besides inspecting what code blocks exist?
Type help to see a list of commands. Calling programs with arguments/redirection works as usual.
(devshell)$ help
Documented commands (type help <topic>):
========================================
EOF deactivate edit help pcd pytest restart venv
activate debug editvim interactive pip python rm
cd doc exit ls pls q rmtree
coverage doctest grep mkdir ppwd quit run
cp doctestify h mv pwd read source
Doctests
If you navigate to a code block, you can examine the docstring and function definition using the bash doc
command.
You can run any doctests present in that code block by using the bash doctest
command.
You can call bash doctestify
to enter into an interactive session with the module's contents imported. All input and output in this session is recorded, and when the session is closed via CTRL+D, the input/output is appended to the docstring of the current code block as an additional set of doctests.
bash doctestify resume
will open the interactive session and execute all existing doctest commands in the current docstring before turning interactive control over to you. This is useful if you are tweaking code while repeatedly running some test. You don't have to rewrite any setup code multiple times, just use what is in the docstring.
Pytest/Coverage
bash pytest
and bash coverage
- pretty self-explanatory. Coverage runs pytest and doctests and produces a combined report.
Debugging
bash debug(5,10)
takes the current function or class and calls it with those arguments, entering debug mode on the first line.
If the current code block is a module or package, it will ens
Looking at code
bash grep pattern [OPTIONS]
runs a grep-like function that is filtered on the current code block.
bash editvim
opens vim to the line corresponding to the currently targeted code block.
bash source
opens a paginated view with the text of the current code block
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
Built Distribution
File details
Details for the file devshell-0.0.4.tar.gz
.
File metadata
- Download URL: devshell-0.0.4.tar.gz
- Upload date:
- Size: 101.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eba0353fb2c5bc4c26b8fb9e7c01582f9170c9a57397110cab2854491a0d0f15 |
|
MD5 | 3606147d51f4fe92ee50cf65e31769f7 |
|
BLAKE2b-256 | c079e3c0ad589628c6e2df15fa06e9a0e121f1927d0c027e5956293b9801187b |
File details
Details for the file devshell-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: devshell-0.0.4-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 314aded4576c539adc15c3a0fbb79a510fb946ca63c5c4b12ef82e25dd39d138 |
|
MD5 | 2313b8ffd433c86e5f76d5af942b3c37 |
|
BLAKE2b-256 | a153a238ef0bba7cd2d35f0f48474508e2ea38683a0dcfb3700bf7933d0fb84c |