When you are working on an "wide" project, like a language is, you have to limit your scope somehow. One self-imposed limit for Rye < 1.0 was, that I will not think about modules.
Go compiler is known to produce single statically linked binaries. That means that a single file just works, no need for additional installations of any other Go runtime dependencies. This is very nice for distribution.
Rye interpreter is also such single binary, and although Go, from version 1.5 supports use of shared libraries, I don't plan to make Rye's bindings dynamic for now.
This is a limitation. If you have one global Rye, it has to be compiled in with all the bindings you need on your system. Tags to the go compiler define the modules, so defining them is not hard, but not something you want a Rye programmer to think about.
Solving limitations often offers new avenues for innovation. Having a global programming language and global modules is problematic also in dynamic/shared system (DLL hell anyone?). You can have 2 project needing two different versions of Python or the same Python but different versions of PostgreSQL binding. That's why Python folks had to invent virtual environments (venv, virtualenv, pipenv).
"A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them. This is one of the most important tools that most of the Python developers use."
With our lastest change, Rye wouldn't need per-project virtual environments, because it now gives you per-project Rye binaries.
There are two changes. When you run global rye command now, it starts a Rye binary in a current directory. If Rye binary is not there yet, it proposes you to build one.
And there is a new utility rye-build available now, that takes a list of modules from a local rye.mod file (Inspired by Golang's go.mod) and builds a local rye interpreter with listed modules. When you are adding modules you just append them to rye.mod and call rye-build again.
A little demo:
For this to work you need just two small bash scripts in your /usr/local/bin (rye and rye-build). I sill need to make some sort of installer script and documentation so anyone can use this.
Anyhow ... follow further development on github.
Komentarji
Objavite komentar