tryis an easy-to-use cli tool to try out Python packages.
- Install specific package version from PyPI
- Install package from GitHub
- Install in virtualenv using specific version of Python
- Specify alternative Python package import name
- Keep try environment after interactive session
- Launch interactive Python console with already imported package
- Launch editor instead of interpreter
- Launch arbitrary Python shell instead of default Python shell
try requests
try requests --i Python
try requests --shell pti Python
try requests -p 3.5
try requests -p /usr/bin/ Python 3.4.1
try requests==2.8.1
try kennethreitz/requests --i Python
try click-didyoumean:click_didyoumean#if Python package name is different then pip package name
try requests --editor
Note: most of the following cli options can also be configured in theconfigurationfile!
Try single Python package:
try requests
try flask
Try multiple Python packages in one session:
try requests flask
Try specific version of a package:
try requests==2.8.1#tries version 2.8.1 of requests instead of latest
Try package from GitHub repository:
try<user>/<repo>#syntax example
try kennethreitz/requests#installs master branch of Kenneth's requests package from GitHub
Try package but import with different name than package name:
try<package_name>:<import_name>#syntax example
try click-didyoumean:click_didyoumean#install click-didyoumean but import click_didyoumean
Try package in already existing virtualenv:
try requests --virtualenv~/.try/sandbox#use virtualenv at ~/.try/sandbox
⇢ see virtualenv config value in env section inconfigurationfile.
Try package with specific Python version:
try requests -- Python 3.5#use Python 3.5 in virtualenv
try requests -p 2.7#use Python 2.7 in virtualenv
try requests -p~/work/c Python /bin/ Python#use Python binary from specific location
⇢ see Python config value in env section inconfigurationfile.
Try package with specific shell/repl:
try requests --shell Python#use Python repl (default value)
try requests --shell i Python#use i Python
try requests --shell pt Python#use pt Python
try requests --shell pti Python#use pti Python
try requests --shell b Python#use b Python
try requests --i Python#use i Python - an alias for --shell i Python
⇢ see shell config value in env section inconfigurationfile.
Try package writing a little script instead of opening shell:
try requests --editor#opens $EDITOR or editor instead of shell
⇢ see always_use_editor config value in env section inconfigurationfile.
Keep virtualenv files after try run:
try requests --keep
⇢ see keep config value in env section inconfigurationfile.
Use a specific location for the virtualenv files:
try requests --tmpdir~/.try
⇢ see tmpdir config value in env section inconfigurationfile.
try
can be configured to your preferences - like always usei Python
as a shell or always usePython 3.5
.
The configuration file is located in your users application configuration directory in a file calledconfig.ini
.
This location is OS dependent and is specified here:http://click.pocoo.org/5/api/#click.get_app_dir
The followingconfig.ini
file shows all available configuration options:
[env]
virtualenv=~/.try/sandbox
Python=3.5
shell=i Python
keep=false
always_use_editor=false
tmpdir=~/.try
Usepipto installtry:
pip3 install trypackage
trycomes with an awesome CLI interface thanks toclick.
Usage: try [OPTIONS] [PACKAGES]... Easily try out Python packages. Options: --virtualenv TEXT Use already existing virtualenv. -p, -- Python TEXT The Python version to use. --i Python Use i Python instead of Python. --shell TEXT Specify the Python shell to use. (This will override --i Python -k, --keep Keep try environment files. -e, --editor Try with editor instead of interpreter. --tmpdir TEXT Specify location for temporary directory. --version Show the version and exit. --help Show this message and exit.
trywas inspired byhttps://github /VictorBjelkholm/trymodule.