Skip to content

timofurrer/try

Repository files navigation

try - It's never been easier to try Python packages

Latest version released on PyPi Package license Package is available as wheel

try is an easy-to-use cli tool to try out Python packages.

Demo

Features

  • 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

Usage

Usage examples

Note: most of the following cli options can also be configured in the configuration file!

Try single python package:

Try multiple python packages in one session:

Try specific version of a package:

Try package from GitHub repository:

Try package but import with different name than package name:

Try package in already existing virtualenv:

⇢ see virtualenv config value in env section in configuration file.

Try package with specific python version:

⇢ see python config value in env section in configuration file.

Try package with specific shell/repl:

⇢ see shell config value in env section in configuration file.

Try package writing a little script instead of opening shell:

⇢ see always_use_editor config value in env section in configuration file.

Keep virtualenv files after try run:

⇢ see keep config value in env section in configuration file.

Use a specific location for the virtualenv files:

⇢ see tmpdir config value in env section in configuration file.

Configuration

try can be configured to your preferences - like always use ipython as a shell or always use python3.5. The configuration file is located in your users application configuration directory in a file called config.ini. This location is OS dependent and is specified here: http://click.pocoo.org/5/api/#click.get_app_dir

The following config.ini file shows all available configuration options:

Installation

Use pip to install try:

pip3 install trypackage

Help

try comes with an awesome CLI interface thanks to click.

Usage: try [OPTIONS] [PACKAGES]...

  Easily try out python packages.

Options:
  --virtualenv TEXT  Use already existing virtualenv.
  -p, --python TEXT  The python version to use.
  --ipython          Use ipython instead of python.
  --shell TEXT       Specify the python shell to use. (This will override
                     --ipython
  -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.

try was inspired by https://github.com/VictorBjelkholm/trymodule.