• Stars
    star
    5,595
  • Rank 7,307 (Top 0.2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

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

Repository Details

An Experimental Package Management Solution for Python

Rye: An Experimental Package Management Solution for Python


Rye is Armin's personal one-stop-shop for all his Python needs. It installs and manages Python installations, manages pyproject.toml files, installs and uninstalls dependencies, manages virtualenvs behind the scenes. It supports monorepos and global tool installations.

It is a wish of what Python was, with no guarantee to work for anyone else. It's an exploration, and it's far from perfect. Thus also the question: Should it exist?

Watch the instruction

Click on the thumbnail to watch a 9 minute introduction video

Learn more:

Usage

For installation instructions please refer to the installation documentation.

To use rye for automatic management, you first need to create a new project using rye init:

$ rye init my_project && cd my_project

Once that's done, you can follow these steps to enjoy the benefits of automated management:

$ rye sync

If you want to choose a specific version of Python, you can use the rye pin command to specify the version you need (optionally):

That's it! You can now easily achieve automatic management and switch between different versions of Python as needed.

The virtualenv that rye manages is placed in .venv next to your pyproject.toml. You can activate and work with it as normal with one notable exception: the Python installation in it does not contain pip.

Correctly installed, rye will automatically pick up the right Python without manually activating the virtualenv. That is enabled by having ~/.rye/shims at higher priority in your PATH. If you operate outside of a rye managed project, the regular Python is picked up automatically.

Some of the things it does

It automatically installs and manages Python:

$ rye pin 3.11
$ rye run python
Python 3.11.1 (main, Jan 16 2023, 16:02:03) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Note that does mean, that Rye will automatically download and install an appropriate Python binary for you. These Python binaries are currently pulled from the indygreg python-build-standalone releases.

Install tools in isolation globally:

$ rye install maturin

Manage dependencies of a local pyproject.toml and update the virtualenv automatically:

$ rye add flask
$ rye sync

Decisions Made

To understand why things are the way they are:

  • Virtualenvs: while I personally do not like virtualenvs that much, they are so widespread and have reasonable tooling support, so I chose this over __pypackages__.

  • No Default Dependencies: the virtualenvs when they come up are completely void of dependencies. Not even pip or setuptools are installed into it. Rye manages the virtualenv from outside the virtualenv.

  • No Core Non Standard Stuff: Rye (with the exception of it's own tool section in the pyproject.toml) uses standardized keys. That means it uses regular requirements as you would expect. It also does not use a custom lock file format and uses pip-tools behind the scenes.

  • No Pip: Rye uses pip, but it does not expose it. It manage dependencies in pyproject.toml only.

  • No System Python: I can't deal with any more linux distribution weird Python installations or whatever mess there is on macOS. I used to build my own Pythons that are the same everywhere, now I use indygreg's Python builds. Rye will automatically download and manage Python builds from there. No compiling, no divergence.

  • Project Local Shims: Rye maintains a python shim that auto discovers the current pyproject.toml and automatically operates below it. Just add the shims to your shell and you can run python and it will automatically always operate in the right project.

Python Distributions

Rye does not use system python installations. Instead it uses Gregory Szorc's standalone Python builds: python-build-standalone. This is done to create a unified experience of Python installations and to avoid incompatibilities created by different Python distributions. Most importantly this also means you never need to compile a Python any more, it just downloads prepared binaries.

Global Tools

If you want tools to be installed into isolated virtualenvs (like pipsi and pipx), you can use rye too (requires ~/.rye/shims to be on the path):

$ rye install pycowsay
$ pycowsay Wow

  ---
< Wow >
  ---
   \   ^__^
    \  (oo)\_______
       (__)\       )\/\
           ||----w |
           ||     ||

To uninstall run rye uninstall pycowsay again.

License: MIT

More Repositories

1

pipsi

pip script installer
Python
2,004
star
2

insta

A snapshot testing library for rust
Rust
1,594
star
3

pluginbase

A simple but flexible plugin system for Python.
Python
1,112
star
4

similar

A high level diffing library for rust based on diffs
Rust
922
star
5

minijinja

MiniJinja is a powerful but minimal dependency template engine for Rust
Rust
864
star
6

flask-oauth

OAuth Support for Flask
Python
579
star
7

python-modernize

Modernizes Python code for eventual Python 3 migration. Build on top of 2to3
Python
531
star
8

self-replace

Utility library that helps to implement processes that replace themselves
Rust
483
star
9

idasen-control

Lets you control IKEA IDΓ…SEN desks from the command line.
JavaScript
423
star
10

dotfiles

My dotfiles (vim / bash etc.)
Vim Script
419
star
11

unp

Unpacks things.
Python
414
star
12

systemfd

Development helper utility for helping with auto reloading for projects supporting systemd socket activation
Rust
375
star
13

when

Timezones from the command line
Rust
361
star
14

better-panic

A python inspired panic handler for rust
Rust
340
star
15

platter

A useful helper for wheel deployments.
Python
332
star
16

teetty

A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process
Rust
285
star
17

classy

A classy JavaScript class library
Python
267
star
18

flask-pastebin

Example pastebin with websockets, sqlalchemy, facebook connect and a bunch of other buzzwords
Python
264
star
19

deser

Experimental rust serialization library
Rust
256
star
20

python-geoip

GeoIP database access for Python under a BSD license.
Python
249
star
21

snaek

DEPRECATED: Being replaced with milksnake: https://github.com/getsentry/milksnake
Python
227
star
22

python-regex-scanner

Demo of how to use the underlying SRE engine to build a regex scanner
Python
217
star
23

lucumr

My personal website
CSS
211
star
24

timesched

Simple time scheduler application
JavaScript
211
star
25

rstblog

NIH site generator
Python
208
star
26

python-unio

Unbreaks Unicode on Python
Python
165
star
27

fragile

Utility wrapper to send non send types to other threads safely
Rust
150
star
28

procspawn

like thread::spawn but for processes
Rust
148
star
29

python-pbkdf2

Because pbkdf2 is awesome and bcrypt is overkill
Python
147
star
30

unbox

A work in progress command line utility to unpack various types of archives quickly.
Rust
137
star
31

listenfd

Helper crate to work with systemd/catflap socket activation
Rust
136
star
32

jinja2-htmlcompress

Compresses HTML in Jinja2 streams
Python
125
star
33

phpserialize

A PHP serializer implementation for Python
Python
122
star
34

webgl-meincraft

Minecraft engine thingy written in CoffeeScript and WebGL
JavaScript
107
star
35

similar-asserts

Provides assert_eq! like macros with colorized diff output
Rust
89
star
36

vim-jinja

Repository for Jinja support in vim.
Vim Script
86
star
37

jsonjinja

A Jinja2 inspired templating language for rendering JSON data on the server and client.
Python
81
star
38

bf3-aggregator

Sourcecode for the bf3 developer news aggregator.
Python
80
star
39

vim-python-combined

Fork of the python.vim by Dmitry Vasiliev and Neil Schemenauer for 2.x and 3.x.
Vim Script
76
star
40

unicode-nazi

Annoying helper module that finds unicode/bytestring comparisions
Python
71
star
41

multiversion

A hack that allows you to use different versions of the same library in the same Python process without clashes
Python
70
star
42

sha1-smol

Minimal and dependency free implementation of SHA1 for Rust
Rust
68
star
43

templatetk

My GSOC Project for Template Compilation
Python
67
star
44

solace

Non-plurk fork of Solace. Might eventually be merged back. Solace is a Stackoverflow inspired platform.
Python
64
star
45

badideas

Examples from my europython talk
Python
61
star
46

hq

jq but for html
Rust
60
star
47

speaklater

Lazy strings for Python
Python
59
star
48

elementtree-rust

Port of the Python element tree library to Rust
Rust
58
star
49

sqlalchemy-django-query

A Django like query object for SQLAlchemy
Python
50
star
50

fruity-vim-colorscheme

Fruity Colorscheme for Vim
Vim Script
47
star
51

probe

Probes remote websites
Python
46
star
52

fungiform

A form library for Python based on Zine's form system.
Python
44
star
53

serde-plain

A serde serializer that serializes a subset of types into plain strings
Rust
43
star
54

struckdown

An experimental markdown processing system
Rust
43
star
55

flask-feedback

Python
39
star
56

flatex-pdf-download

some code to toy with that can download flatex.at pdfs
Python
38
star
57

rust-execution-context

Implements a .NET inspired execution context for Rust
Rust
37
star
58

twig

a template engine for the chyrp blog engine.
PHP
36
star
59

rust-excessive-bools-lint

To save future generations from the "bools everywhere" antipattern.
Rust
35
star
60

unix-ipc

A super minimal wrapper around unix sockets for IPC.
Rust
35
star
61

dota2-demoinfo2

A version of Valve's Dota2 replay parser that also compiles on OS X (and hopefully Linux)
C++
34
star
62

frostbite2-stuff

Python libs for accessing Frostbite stuff
Python
33
star
63

jinja2-tmbundle

Editor support
33
star
64

ponyguruma

Oniguruma for Python
Python
32
star
65

flask-extension-wizard

Helper script to create Flask Extension Packages
Python
32
star
66

stack-tokens

Example implementation of stack tokens for Rust
Rust
31
star
67

proximity-tracing

Holds various things for proximity contact tracing.
Rust
31
star
68

tokio-unix-ipc

A super minimal wrapper around unix sockets for IPC on top of tokio.
Rust
31
star
69

python-inifile

Ini file library for Python
Python
31
star
70

cli-tools

Command line utilities
Python
31
star
71

zine

A blog
Python
30
star
72

webgame

Rust
27
star
73

super-secret-wsgi-replacement

My take on a WSGI replacement
26
star
74

rust-runas

Runs a command in an elevated context
Rust
26
star
75

mictoggle

Toggle microphone through hotkey
Swift
25
star
76

htmldiff

Diffs arbitrary HTML inline
Python
25
star
77

python-juggernaut

Python client library for juggernaut
Python
24
star
78

covidcotra

Some hackery for covid-19 contrac tracing
Rust
24
star
79

memo-map

A crate implementing a synchronized map for memoization
Rust
21
star
80

pyastutil

Various Python AST utilities
Python
19
star
81

clicolors-control

Rust library for controlling CLI colors
Rust
19
star
82

prettyprint

A prettyprinter for Python
Python
19
star
83

vim-rst

Restructured text support for vim
Vim Script
18
star
84

python-atomicfile

Helpers for atomic file operations
Python
18
star
85

flask-fungiform

Flask bridge to fungiform
Python
18
star
86

rust-eh

More error handling experiments in Rust.
Rust
18
star
87

rust-incidents

Even more error handling experiments in Rust.
Rust
17
star
88

aoc19

advent of code 2019 repo
Rust
16
star
89

vim-json

Simple JSON support for vim.
Vim Script
16
star
90

frameworkify

Making dylibs on OS X painless
Python
15
star
91

insta-cmd

CLI extension to insta
Rust
15
star
92

johanson

A hard fork of yajl for lightweight JSON parsing.
C
15
star
93

kickstarter-scraper

Scrapes kickstarter for some stats
Python
14
star
94

twitterlog

A Python log handler that logs to Twitter
Python
14
star
95

yamldb

A small wrapper around SQLite and YAML
Python
14
star
96

sandboxcraft

A small project that implements a voxel engine (hopefully)
C
14
star
97

rust-osascript

Rust wrapper around a bit of osascript
Rust
13
star
98

unicode-literals-pep

Not yet a proposed PEP about u'' in Python 3.3 and later
Python
12
star
99

small-ctor

Minimal, dependency free implementation of the ctor crate
Rust
11
star
100

libbattlelog

Dig around in battlelog
Python
11
star