Enabling pip Installation on PySearch

pySearch is a command line interface tool created to open search queries in a web browser from the command line.

Ever since pySearch’s inception it has been my intention to add pySearch to the system PATH or add a bash profile alias so pySearch could be accessed with a simple call regardless of the current working directory. Currently pySearch has to be called from the directory it currently resides in. Typing in the path is cumbersome and it is counter intuitive as it wastes more time as typing in the full path for pySearch can take more time then it would to navigate to the browser and execute a search normally.

My original plan to remedy this was to create a script which added or updated the appropriate variables however after looking at the httpie I realized project I realized this could be achieved with pip and implementing pip would also simplify pySearch’s installation process and pave the way to publishing pySearch on pip’s package index.

So I followed the Packaging Python Projects tutorial on the Python documentation to create my initial `setup.py` file.

Luckily the code was refactored into modules when I implemented the test framework which took care of the code organization.

I looked at how httpie handled their command entrypoint and copied applied similar logic to the pySearch project to create the initial pySearch package.

Unfortunately nothing’s ever easy and Python had a hard time finding the `main` function with my original implementation.

Unfortunately examples were rather sparse so I tested different entrypoint calls as I could verify the existence of the pySearch module so I knew it existed and pySearch would run in the Python interactive interpreter so I knew it was installed correctly. The only issue was finding the right path.

After a bit of trial and error with the entrypoint and verifying the package installed by pip I found the correct entrypoint was pySearch = pySearch:main.

Let’s do a quick search to verify everything works!

Looks good!