Depending on the installation or uninstall packages, and then edit the requirements file.
It’s Five O’clock Somewhere
I’m using ordinary pip-tools . pip-tools is great, but the package of installation, is to edit the requirements.in file every time the uninstall in the editor it was somewhat cumbersome. So, I have developed a snake-pit. snake-pit, which takes you by writing automatically package name to requirements.in After the installation of the package is successful. Even when the uninstall, will remove the automatically package name from requirements.in.
snake-pit is desirable to use in combination with a pip-tools, but it does not mean that its never dependent to pip-tools. snake-pit is available in stand-alone. It is a good idea to use instead of pip freeze> requirements.txt.
snake-pit is possible to install pip.
$ pip install snake-pit
Get the Code
It is also possible to get the source code from Github.
$ git clone email@example.com:kk6/snake-pit.git
You may want to install in the pip editable mode.
$ pip install -e .
To install the Python package using the snake-pit, do the following. It is only different character and if you use a pip.
$ pit install flask
Unlike pip, snake-pit will write the package name to automatically requirements file. Once you have successfully installed the package.
Although I mentioned earlier, snake-pit has been designed to be aware of the combination of the pip-tools. Therefore, the Requirements file to say here, as that term is pip-tools, is a file, such as a specified to requirements.in to pip-tools’s pip-compile command.
As below, it is possible to specify a file path to reference --requirements, in -r option. This is priority than the set of configuration files, which will be described later.
$ pit install pytest -r dev-requirements.in
If the --requirements option is not specified, snake-pit uses the configuration file to search for the requirements file.
Config file is intended to be managed by a name in the path to the requirements file. Please describe in YAML format file.In hash it will describe as <name of the file path> : <path to file>. The only required key is default. This is referred to by default when --name, -n option is not specified.
If there is no configuration file, or if the configuration file can not be read, the default configuration is used. By default, it will read and write requirements.in.
For example, you are managing by dividing the requirements file as follows:
requirements ├── base.in └── dev ├── base.in └── mysql.in
As follows, It is troublesome to specify the long file path for each installation.
$ pit install mycli -r requirements/dev/mysql.in
So, we will use the configuration file. Let’s described as follows:
default: requirements/base.in dev: requirements/dev/base.in mysql: requirements/dev/mysql.in
Save as pit.yml. By default, snake-pit enforce this file name, but this can be changed by setting environment variables (see below).
Now you need only to specify the name to --name option.
$ pit install mycli -n mysql ... Successfully installed PyMySQL-0.6.7 Pygments-2.0.2 configobj-5.0.6 mycli-1.5.2 prompt-toolkit-0.46 pycrypto-2.6.1 six-1.10.0 sqlparse-0.1.18 wcwidth-0.1.5 Append the following packages in requirements/dev/mysql.in: mycli requirements/dev/mysql.in has been updated as follows: # requirements.mysql.in mycli
If the configuration file fails to load or did not exist, the default configuration is used. By default, this is as follows.
Set the configuration file name in the environment variable
It is possible to set the path to the configuration file in the environment variable PIT_CONFIG_PATH. If this environment variable is set, snake-pit looks for a there instead of pit.yml immediately below.
$ mv pit.yml .pitrc $ export PIT_CONFIG_PATH=.pitrc
Uninstall Packages also, is almost the same as the installation.
$ pit uninstall nose
As well as the installation, --requirements, -r and --name, -n options are available.
$ pit uninstall pytest -n test
Further, by using the --auto, -a options, of all the packages to the specified package depends, is possible to remove at once what is unnecessary.
$ pit uninstall bpython httpie --auto Specified package and becomes unnecessary by which they are removed, it will remove the following packages: curtsies httpie greenlet blessings bpython Are you sure? [y/N]:
snake-pit You can also use the alias of sub-command.
$ pit i django # install django $ pit u django # uninstall django
Licensed under the MIT, see LICENSE.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|snake_pit-0.3.0-py2.py3-none-any.whl (17.7 kB) Copy SHA256 hash SHA256||Wheel||3.5|
|snake-pit-0.3.0.tar.gz (20.5 kB) Copy SHA256 hash SHA256||Source||None|