Code Monkey home page Code Monkey logo

rtx-python's Introduction

rtx-python

Warning

This plugin is soon to be deprecated in favor of rtx's built-in core python functionality.

Build Status

Python plugin for rtx version manager

Install

rtx plugin add python

Install with --patch

Enable to fix macOS 11 issues

You can use environment variable RTX_PYTHON_PATCH_URL to install with --patch like that:

export RTX_PYTHON_PATCH_URL="https://github.com/python/cpython/commit/8ea6353.patch?full_index=1"
rtx install python 3.6.12

or use environment variable RTX_PYTHON_PATCHES_DIRECTORY.

Use

Check rtx readme for instructions on how to install & manage versions of Python. Please make sure you have the required system dependencies installed before trying to install Python.

Under the hood, rtx-python uses python-build to build and install Python, check its README for more information about build options and the common build problems wiki page for any issues encountered during installation of python versions.

Using multiple versions of Python

A common request for Python is being able to use the python2 and python3 commands without needing to switch version. This can be achieved by setting multiple versions of Python, for example with

rtx global python 3.6.2 2.7.13

Executables in the first version will take priority over the executables in the next one. Note that you can use an arbitrary number over versions, if needed. With the above example, python will therefore use the python executable found in version 3.6.2. However, as the python2 does not exist in Python 3.6.2, python2 will use the python2 executable found in version 2.7.13.

python -V
Python 3.6.2

python3 -V
Python 3.6.2

python2 -V
Python 2.7.13

Pip installed modules and binaries

If you use pip to install a module like ipython that has binaries. You will need to run rtx reshim python for the binary to be in your path.

Default Python packages

rtx-python can automatically install a default set of Python packages with pip right after installing a Python version. To enable this feature, provide a $HOME/.default-python-packages file that lists one package per line, for example:

ansible
pipenv

You can specify a non-default location of this file by setting a RTX_PYTHON_DEFAULT_PACKAGES_FILE variable.

[experimental] Virtualenv support

Automatically create and activate a virtualenv when entering a directory with the virtualenv option. This requires using .rtx.toml since .tool-versions could not support this syntax:

[tools]
python = { version='3.11', virtualenv='.venv' }

[experimental] Pipenv/Poetry support

This functionality has been removed from this plugin and instead put into rtx-pipenv and rtx-poetry.

rtx-python's People

Contributors

jdx avatar danhper avatar cmckni3 avatar likwid avatar rlex avatar matan129 avatar pierreneter avatar and-semakin avatar neersighted avatar jfly avatar jeromedoyle avatar djgoku avatar joshuarosato avatar rockwood avatar dieswaytoofast avatar fazibear avatar paulswartz avatar essh avatar bellini666 avatar github-actions[bot] avatar zfletch avatar

Stargazers

baggiponte avatar Ben Rosen avatar

Watchers

 avatar

Forkers

bellini666 dfang

rtx-python's Issues

virtualenv issues

see jdx/mise#8 (comment) for context

  • virtualenv not deactivating when navigating away
  • virtualenv created in subdirectory, not project root
  • ability to use absolute paths with environment variables like $HOME/.venv

@delicb I wasn't able to reproduce the first one here. If you can manage to make it happen again, it would be helpful if I could see the output of echo $__RTX_DIFF (which I can decode the base64 of to make useful, no need to do that for me).

If you can also dive a bit further, you could add set -x to ~/.local/share/rtx/plugins/python/bin/exec-env to see what it's doing and when it is running. Also make sure you've updated both rtx and rtx-python since I've made several changes to both today.

CI

asdf-python used travis, we can either leverage that or use github actions. I'm leaning github actions since the travis config looks entirely unusable for rtx.

ERROR: Cannot install specific ref from source, sorry

Cannot install specific ref from source, sorry.For a list of available versions, see `rtx ls-remote python`.
Cannot install specific ref from source, sorry.For a list of available versions, see `rtx ls-remote python`.
rtx [email protected] installing                                                                                                                                                           โœ— 0s rtx failed to install [email protected]
rtx Run with RTX_DEBUG=1 for more information
rtx ls-remote python
# 3.9.16

I did run with RTX_DEBUG=1, but I did not pick out anything helpful. I could update this issue if the logs are needed.


Switching to asdf-python works alright.

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.