• Stars
    star
    721
  • Rank 62,814 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

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

Usage examples

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

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 in configuration file.

Try package with specific python version:

try requests --python 3.5  # use python3.5 in virtualenv
try requests -p 2.7  # use python2.7 in virtualenv
try requests -p ~/work/cpython/bin/python  # use python binary from specific location

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

Try package with specific shell/repl:

try requests --shell python  # use python repl (default value)
try requests --shell ipython  # use ipython
try requests --shell ptpython  # use ptpython
try requests --shell ptipython  # use ptipython
try requests --shell bpython  # use bpython
try requests --ipython  # use ipython - an alias for --shell ipython

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

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 in configuration file.

Keep virtualenv files after try run:

try requests --keep

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

Use a specific location for the virtualenv files:

try requests --tmpdir ~/.try

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

[env]
virtualenv=~/.try/sandbox
python=3.5
shell=ipython
keep=false
always_use_editor=false
tmpdir=~/.try

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.

More Repositories

1

awesome-asyncio

A curated list of awesome Python asyncio frameworks, libraries, software and resources
4,607
star
2

colorful

Terminal string styling done right, in Python 🐍 🎉
Python
523
star
3

w1thermsensor

A Python package and CLI tool to work with w1 temperature sensors like DS1822, DS18S20 & DS18B20 on the Raspberry Pi, Beagle Bone and other devices.
Python
485
star
4

russian-roulette

🍀 You want to push your luck? ... Go ahead and try your best with this CLI russian roulette! 💥
Shell
112
star
5

pandoc-plantuml-filter

Pandoc filter for PlantUML code blocks
Python
104
star
6

shellfuncs

Python API to execute shell functions as they would be Python functions
Python
101
star
7

observable

minimalist event system for Python
Python
86
star
8

WOL

C program to send wol magic packets
C
79
star
9

pandoc-mermaid-filter

Pandoc filter for mermaid code blocks
Python
76
star
10

devheart

Listen to Tux's heartbeat with this awesome Linux Kernel Module ❤️
C
57
star
11

git-russian-roulette

🍀 play russian roulette in your git repository. 🔫
Shell
44
star
12

minion-ci

minimalist, decentralized, flexible Continuous Integration Server for hackers.
Python
43
star
13

javascript-style-guide

Ein vernünftiger Ansatz für einen JavaScript-Style-Guide
35
star
14

securityheaders

🔒 CLI application to analyse Security Headers from a given URL using securityheaders.io
Python
19
star
15

musichaos

tool to tidy up your music chaos
Python
17
star
16

dropbox-cli

cli to manage your dropbox account
Python
10
star
17

ariseem

Minimalistic REST API for wake-on-lan
Python
10
star
18

leaked

Find leaked information in different kind of services
Python
9
star
19

retry-cmd

Retry commands on the command line without all the loops you always used!
Rust
9
star
20

confluo

➰ Minimalist scalable microservice framework for distributed systems using AMQP/RabbitMQ.
Python
9
star
21

ptipython-meta

Metapackage to install ptpython and ipython.
Python
7
star
22

idn-homograph-attack

Resources for "IDN Homograph Attack" for HSLU FKOM blog post testat
HTML
7
star
23

.vim

vim configuration for myself.
Vim Script
6
star
24

ramlient

Access to a RAML API done right, in Python. (Feasibility)
RAML
6
star
25

embedeval

NLP Embeddings Evaluation Tool
Python
5
star
26

avra-atmega2560

This repository is a clone of avra version 1.3.0 with additional fixes to support the ATmega2560 chip
C
5
star
27

dotfiles.attic

My personal dotfiles
Shell
4
star
28

broadcom-wl-monitormode

This is a source mirror for the broadcom wl driver version 6.30.223.141 with fixed monitor mode
C
4
star
29

hslu-pren-fs19

Implementation of the PREN FS2019 challenge at @ HSLU
Jupyter Notebook
4
star
30

saythanks-cli

Say Thanks via CLI. Uses @kennethreitz's great saythanks.io
Python
4
star
31

tag-expressions

Python implementation of Shunting-yard Algorithm to evaluate logical tag expressions
Python
3
star
32

dotfiles-2

Vim Script
3
star
33

hslu-pren-digit-cnn

Convolutional Neural Network to recognize digits used in the PREN class @ HSLU
Jupyter Notebook
3
star
34

python3.10-pattern-matching

Python 3.10 demos
Jupyter Notebook
3
star
35

pylemon

python daemon to monitor specific directories and react on changes
2
star
36

advent-of-code

My solutions for the Advent of Code puzzles
Python
2
star
37

java-dev

Java dev environment (Vagrant, Ansible, VirtualBox, Ubuntu 16.04) for HSLU
2
star
38

hslu-webtec-testat

HSLU WebTec Testat
JavaScript
2
star
39

pysingleton

module which provides a decorator to create thread-safe singleton classes
Python
2
star
40

lightning-talk-linux-kernel-module-examples

Examples for my "Linux Kernel Modules 101" Lightning Talk ⚡
C
2
star
41

timofurrer.github.io

Personal website and blog
HTML
2
star
42

edelweiss

edelweiss. A delightful color scheme for my personal terminal stack
Lua
2
star
43

asciitable

print formatted ascii table on console
C
1
star
44

hslu-roblab-behavior

Python
1
star
45

sudoku.vim

vim plugin to solve sudoku files
Python
1
star
46

coverage-importlib-test

Python
1
star
47

.tmux

my tmux configuration
1
star
48

clicore

small cli to use in python programs
Python
1
star
49

schoolcli

This is a very useful command line interface to manage your school marks
Python
1
star
50

hslu-xml-technologies

HSLU - XML Technologies - Projektarbeit
XSLT
1
star
51

hslu-ipcv

Exercises for the IPCV class @ HSLU
Jupyter Notebook
1
star
52

hslu-dbs

HSLU - DBS
TypeScript
1
star
53

hslu-aiso

HSLU AISO Class Exercises
Jupyter Notebook
1
star
54

dotfiles

Lua
1
star