https://github.com/vigo/lsvirtualenvs
Small commandline tool for `virtualenvwrapper`
https://github.com/vigo/lsvirtualenvs
golang virtualenvwrapper
Last synced: 11 months ago
JSON representation
Small commandline tool for `virtualenvwrapper`
- Host: GitHub
- URL: https://github.com/vigo/lsvirtualenvs
- Owner: vigo
- License: mit
- Created: 2018-06-29T12:01:44.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-09-18T02:31:22.000Z (over 2 years ago)
- Last Synced: 2025-03-31T13:05:04.063Z (12 months ago)
- Topics: golang, virtualenvwrapper
- Language: Go
- Size: 82 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README


[](https://pkg.go.dev/github.com/vigo/lsvirtualenvs)
[](https://goreportcard.com/report/github.com/vigo/lsvirtualenvs)
[](https://travis-ci.org/vigo/lsvirtualenvs)


[](https://github.com/vigo/lsvirtualenvs/actions/workflows/verify-docker-build.yml)

[](https://codecov.io/gh/vigo/lsvirtualenvs)

# List Virtual Environments for `virtualenvwrapper`
If you use `virtualenvwrapper` you’ll love this :)
Due to `virtualenvwrapper`’s `lsvirtualenv`’s super slow speed and lack of
information, I made this simple cli-tool with `golang`.
---
## Requirements
I’m assuming that you are already using [virtualenvwrapper][virtualenvwrapper]
and you have `WORKON_HOME` environment variable is already exists in your
shell environment.
---
## Installation
You can install from the source;
```bash
$ go install github.com/vigo/lsvirtualenvs@latest
```
This will build and install binary of `lsvirtualenvs` under `$GOPATH/bin` path.
or, you can install from `brew`:
```bash
$ brew tap vigo/lsvirtualenvs
$ brew install lsvirtualenvs
```
### Build from source
Check your `go env GOPATH` then check sources;
```bash
$ ls "$(go env GOPATH)/src/"
cloud.google.com github.com go.opencensus.io golang.org google.golang.org
# if github.com does not exists, create the folder via
# $ mkdir "$(go env GOPATH)/src/github.com"
$ mkdir "$(go env GOPATH)/src/github.com/vigo" # need for run/build operations
$ cd "$(go env GOPATH)/src/github.com/vigo"
$ git clone git@github.com:vigo/lsvirtualenvs.git
$ cd lsvirtualenvs/
$ go build
$ ls "$(go env GOPATH)/bin" # you should see `lsvirtualenvs` binary
$ lsvirtualenvs -h
```
## Usage
```bash
$ lsvirtualenvs -h
usage: lsvirtualenvs [-flags]
lists existing virtualenvs which are created via "mkvirtualenv" command.
flags:
-c, -color enable colored output
-s, -simple just list environment names, overrides -c, -i
-i, -index add index number to output
-version display version information (X.X.X)
```
Usage examples:
```bash
$ lsvirtualenvs -h
$ lsvirtualenvs -c
$ lsvirtualenvs -color
$ lsvirtualenvs -c -i
$ lsvirtualenvs -color -index
$ lsvirtualenvs -s
$ lsvirtualenvs -simple
```
Example output:
```bash
$ lsvirtualenvs
you have 2 environments available
textmate................... 3.8.0
trash...................... 3.8.0
$ lsvirtualenvs -i
you have 2 environments available
[0001] textmate................... 3.8.0
[0002] trash...................... 3.8.0
$ lsvirtualenvs -c -i # colored output with index
```
Run tests via;
```bash
$ go test -v ./...
```
---
## Docker
https://hub.docker.com/r/vigo/lsvirtualenvs/
Note that, `lsvirtualenvs` requires `WORKON_HOME` environment variable which is
not available inside of the docker container :) This is just an example / concept
of dockerized version of the application :)
```bash
$ docker run --read-only -v "${WORKON_HOME}":/venvs --env WORKON_HOME=/venvs vigo/lsvirtualenvs
$ docker run --read-only -v "${WORKON_HOME}":/venvs --env WORKON_HOME=/venvs vigo/lsvirtualenvs -h
```
If you run it from container, currently, it’s not possible to get python
versions of the existing environments.
---
## Rake Tasks
```bash
$ rake -T
rake default # show avaliable tasks (default task)
rake docker:lint # lint Dockerfile
rake release[revision] # release new version major,minor,patch, default: patch
rake test[verbose] # run tests
```
---
## Change Log
**2022-07-09**
- Add docker build/push action
- Fix docker platform issue
**2022-02-24**
- `Dockerfile` is lint-free now!
- `lsvirtualenvs` runs perfectly from container now!
**2022-02-15**
- Add `LSVIRTUALENVS_COLOR_ALWAYS` environment variable check. Set `LSVIRTUALENVS_COLOR_ALWAYS=1` for
colored output all the time
- Add GolangCI-Lint checker
**2021-05-09**
- Add github action for go build status
- Changed `master` branch to `main`
- Add missing information to `-h` help
- Add Rake tasks
**2021-01-06**
- Complete make-over from scratch, removed `sync.Map()`, used channels
- Fix information on README
**2018-07-05**
- Due to @fatih’s warning, removed `Lock()` and used `sync.Map()`
- Version 2.1.1
**2018-07-04**
- App refactored
- Unit tests are completed
- Version 2.0.1
**2018-07-02**
- Basic unit testing
**2018-07-01**
- Code refactor
**2018-06-29**
- First release
- Addition: `--version`
**2018-06-28**
- Initial commit
---
## Contributor(s)
* [Uğur "vigo" Özyılmazel](https://github.com/vigo) - Creator, maintainer
---
## Contribute
All PR’s are welcome!
1. `fork` (https://github.com/vigo/lsvirtualenvs/fork)
1. Create your `branch` (`git checkout -b my-feature`)
1. `commit` yours (`git commit -am 'Add garlic and yogurt'`)
1. `push` your `branch` (`git push origin my-feature`)
1. Than create a new **Pull Request**!
---
## License
This project is licensed under MIT
---
[virtualenvwrapper]: https://virtualenvwrapper.readthedocs.io/en/latest/