GithubHelp home page GithubHelp logo

blakejc94 / envy Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

A simple bash program to spawn subshells for python venvs (otherwise known as "poor persons poetry")

License: GNU General Public License v3.0

Shell 100.00%

envy's Introduction

envy

A simple bash program to spawn subshells for python venvs

Inspired by the poetry shell and aws-sso exec commands, this command invokes a subshell and automatically sources .venv/bin/activate in the current directory (or searches for a valid venv up the directory tree, for the dozens of us who like using git worktree). Also enables creating venvs in one command as well.

TLDR: Replace $ python -m venv .venv; source .venv/bin/activate with $ envy. No more fumbling with stupid typos, ain't got time to hit all those keys! I just want a shell that's ready to go!

NOTE: This only supports bash at the moment.

Installation

Use your preferred way of installing an executable to your PATH. I suggest using curl:

$ mkdir -p ~/.local/bin
$ [[ ":$PATH:" != *":~/.local/bin:"* ]] && PATH="~/.local/bin:${PATH}"
$ curl https://raw.githubusercontent.com/BlakeJC94/envy/main/envy --output ~/.local/bin/envy
$ chmod a+x ~/.local/bin/envy

Usage

Documentation can be viewed with $ envy --help:

envy
Subshell spawner for Python

This utility searches the current directory for a virtual environment
in the current directory, travels up the directory tree (up to the
users home directory) until a virtual env is found, then spawns a
subshell that sources '.bashrc' and the virtual environment (and sets
a value for 'ENVY').

By default, searches for a virtual environment called '.venv', can be
specified in the first argument.

If a virtual environment is not found, a new virtual environment is
created at the current directory and a subshell sourcing the new venv
is invoked.

Different venvs can be targeted/created via first positional arg (e.g.
look for '.venv-foo' by using 'envy foo').

USAGE:
    envy [OPTIONS] [NAME]

ARGS:
    NAME            Virtual env suffix to search/create (default: '')

OPTIONS:
    -h, --help                                     Show documentation
    -n, --new         Skip search and create/activate new virtual env

TODO

  • zsh and fish support?

envy's People

Contributors

blakejc94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.