Depending on the installation or uninstall packages, and then edit the requirements file.
Project description
It’s Five O’clock Somewhere
Introduction
Design Concepts
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.
Stand-alone
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.
Installation
Using pip
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 git@github.com:kk6/snake-pit.git
You may want to install in the pip editable mode.
$ pip install -e .
Usage
Installing Packages
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.
Requirements Files
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
Configuration Files
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
Default Configuration
If the configuration file fails to load or did not exist, the default configuration is used. By default, this is as follows.
default:
requirements.in
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
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]:
Aliases
snake-pit You can also use the alias of sub-command.
$ pit i django # install django
$ pit u django # uninstall django
License
Licensed under the MIT, see LICENSE.
Project details
Release history Release notifications | RSS feed
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 snake-pit-0.3.0.tar.gz
.
File metadata
- Download URL: snake-pit-0.3.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59fc546af60f8b082c698c4e27bd734c68b589aae9280e071555183e72d7576 |
|
MD5 | 27bea1480fedd7c3b262061f36e624d2 |
|
BLAKE2b-256 | 2da159373b208c4b0bb0c34d9e04e67ffd3b601f324ea3a707427a30e95dfe5b |
File details
Details for the file snake_pit-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: snake_pit-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc4406647858341e579f394900c4088aae8d8ae1687c3d52d8f6efe2c2d3ac51 |
|
MD5 | b5a6309e1b0989105a6cd30f4b86527d |
|
BLAKE2b-256 | c3d6be19a3fed43113cc348b58af78a4925dfd7b9d134e4c57b6a381fae9aa0f |