Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Dead simple CLI tool to try Python packages - It's never been easier! 📦

License

NotificationsYou must be signed in to change notification settings

timofurrer/try

Repository files navigation

Latest version released on PyPiPackage licensePackage 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

try requeststry requests --ipythontry requests --shell ptipythontry requests -p 3.5try requests -p /usr/bin/python3.4.1try requests==2.8.1try kennethreitz/requests --ipythontry click-didyoumean:click_didyoumean# if python package name is different then pip package nametry requests --editor

Usage examples

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

Try single python package:

try requeststry 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 exampletry 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 exampletry 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 python3.5 in virtualenvtry requests -p 2.7# use python2.7 in virtualenvtry requests -p~/work/cpython/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 ipython# use ipythontry requests --shell ptpython# use ptpythontry requests --shell ptipython# use ptipythontry requests --shell bpython# use bpythontry requests --ipython# use ipython - an alias for --shell ipython

⇢ 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.

Configuration

try can be configured to your preferences - like always useipython as a shell or always usepython3.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/sandboxpython=3.5shell=ipythonkeep=falsealways_use_editor=falsetmpdir=~/.try

Installation

Usepip to installtry:

pip3 install trypackage

Help

try comes 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.  --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 byhttps://github.com/VictorBjelkholm/trymodule.

About

Dead simple CLI tool to try Python packages - It's never been easier! 📦

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp