Directory move tool to Python package (pycd)

I couldn't find it though it seemed to be terrible, so I made it. → ** pycd: cd to python modules **

When writing a Python package, I often think that if I bring it from another package, it will be over soon. In such a case, the tool for quickly moving to the directory of the package and grep or viewing it with an editor is pycd.

How to use

$ pycd requests

$ pwd
/usr/lib/python2.7/dist-packages/requests

$ grep 'def get(' *
api.py:def get(url, **kwargs):
cookies.py:    def get(self, name, default=None, domain=None, path=None):
sessions.py:    def get(self, url, **kwargs):
structures.py:    def get(self, key, default=None):

Installation method

$ pip install pycd

Add the following to ~ / .bashrc (or .zshrc).

source `which pycd.sh`

Regarding how to specify the package name

At this time, the important thing is to specify the name to be ʻimport as an argument or the name to be specified when installing with pip, but I think that many people are accustomed to import, so that I made it. In that case, I couldn't do it with pip show PAKAGE`, so I decided to make another tool:

$ pip show sklearn  # does not work

$ pip show scikit-learn
---
Name: scikit-learn
Version: 0.16.1
Location: /usr/local/lib/python2.7/dist-packages
Requires: 

That's pypack, but I'll write it because it might be useful:

$ pypack find numpy
/usr/local/lib/python2.7/dist-packages/numpy

$ pypack list
numpy
sklearn
scipy
...

Finally

It's quite handy not only for finding reusable code, but also for finding bugs in dependent packages, so use it if you like.

pycd: cd to python modules

Also, if you have a better tool, please let me know.

Recommended Posts

Directory move tool to Python package (pycd)
[Python] Check the current directory, move the directory
How to package and distribute Python scripts
Pin current directory to script directory in Python
Install Python package management tool pip (Windows)
I want to use Temporary Directory with Python2
List of Python code to move and remember
"Backport" to python 2
Tool to make mask image for ETC in Python
Try to make a command standby tool with python
[Reintroduction to python] How to import via the parent directory
[Python beginner] If __name__ == Move your hand to understand'__main__'.
How to make a Python package using VS Code
Attempt to include machine learning model in python package
python package dependencies and virtual environment management tool Poetry
[Python] File / directory operations
How to install Python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Python package development notes
Rewrite Python2 code to Python3 (2to3)
Python test package memo
How to install python
python decorator to retry
Introduction to Python language
Python ipaddress package notes
Introduction to OpenCV (python)-(2)
Python directory operation summary
Note to daemonize python
Introducing Python 2.7 to CentOS 6.6
[Python] When you want to import and use your own package in the upper directory
Python> __init__.py> Required to handle the specified directory as a package (empty file is acceptable)
Python package manager comparison
[Python MinMaxScaler] Normalize to 0 ~ 1
python> Link> PyUserInput package |
Try to get the function list of Python> os package
Command line tool to put .gitkeep in an empty directory
I can't move to Python3 easily, so let's consider compatibility 2-3
I made a package to filter time series with python
The story of introducing jedi (python auto-completion package) to emacs
How to specify a public directory Python simple HTTP server
[Part.2] Crawling with Python! Click the web page to move!
How to make a Python package (written for an intern)
Create a tool to check scraping rules (robots.txt) in Python