Giter Club home page Giter Club logo

gop's Introduction

gop - simple governing of your Python versions

Build Status

gop is simple to setup, simple to use, and powerful to boot.

There are no tricky settings, options, or crazy dependencies. gop is just a helpful tool that gets the job done, and is the Golang cousin of p, a bash script for managing Python versions.

gop is also great for getting started using Python development versions. Use gop latest to get up and running with the latest development version of Python!

Installation

To build from source, install Go and then run

go get -u github.com/andrewmfiorillo/gop/cmd/gop

The two settings you may want to change are P_PREFIX (where are installed versions are kept) and your PATH (which makes them easily accessible)

In Linux or OSX, this would look like

# In ~/.bash_profile, or the equivalent
export P_PREFIX=$HOME
export PATH="$P_PREFIX/p/versions/bin:$PATH"

Or in Windows, you set the environment variables with Rapid Environment Editor or your favorite tool

set P_PREFIX=%USERPROFILE%
set PATH=%P_PREFIX%;%PATH%

Usage

Commands:
    gop <version>                  Activate to Python <version>
    gop ls, list                   Output the versions of Python available
        gop ls installed           Output the installed versions of Python
        gop ls latest              Output the latest Python version available
        gop ls stable              Output the latest stable Python version available
    gop latest                     Activate to the latest Python release
    gop stable                     Activate to the latest stable Python release
    gop status                     Output current status
    gop install <version> --force  Install Python <version> but do NOT activate
    gop use <version> [args ...]   Execute Python <version> with [args ...]
    gop bin <version>              Output bin path for <version>
    gop rm <version ...>           Remove the given version(s)
    gop default, disable           Use default (system) Python installation
    gop help, h [command]          Shows a list of commands or help for one command

Options:
  --verbose
  --help, -h     show help
  --version, -v  print the version

How does gop work?

gop stores each Python version installed under the directory $P_PREFIX/p/versions/python. When a Python version is activated, p creates symbolic links in $P_PREFIX/p/versions, pointing to the:

  • bin
  • include
  • lib
  • share

directories of the activated Python version.

For example, Python version 3.6.5 is installed, and it will be placed under the directory:

$P_PREFIX/p/versions/python/3.6.5

Activating version 3.6.5 will create symlinks that points to directories under the activated Python installation:

$P_PREFIX/p/versions/bin     -> $P_PREFIX/p/versions/python/3.6.5/bin
$P_PREFIX/p/versions/include -> $P_PREFIX/p/versions/python/3.6.5/include
$P_PREFIX/p/versions/lib     -> $P_PREFIX/p/versions/python/3.6.5/lib
$P_PREFIX/p/versions/share   -> $P_PREFIX/p/versions/python/3.6.5/share

$P_PREFIX allows you to customize where python versions are installed, and defaults to $HOME (%USERPROFILE% on Windows) if unspecified. To use the Python that gop installs, you must either call its full path (given with gop bin) or add $P_PREFIX/p/versions/bin to your $PATH.

When installing Python 3, the symlink python and pip are also created for python3 and pip3 executables respectively, for the sake of convenience.

FAQs

What about pip?

pip is installed by default for Python 3. For Python 2.7.9 or above, you can run the following command to install pip:

python -m ensurepip

For Python version less than 2.7.9, you will have to install pip manually.

Can I use gop to manage Python project dependencies?

You could, though it is recommended to use pipenv to do so. gop can be used to install the Python version for your project, and pipenv can later be used to setup the project virtual environment using the Python version installed.

Attribution

This is a fork from p by Raphx.

License

MIT

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.