Home >Backend Development >Python Tutorial >A Minimalist Python Version Manager

A Minimalist Python Version Manager

Patricia Arquette
Patricia ArquetteOriginal
2024-10-02 16:10:30681browse

A Minimalist Python Version Manager

Python Support in Shuru: Version 0.0.9

Shuru just got an upgrade—Python version management is now live! If you’ve been using Shuru for your Node.js tasks, you'll be glad to know you can now manage your Python versions with the same ease.

What’s New?

With this latest release (v0.0.9), Shuru can download, build, and install Python from source, all by simply configuring your shuru.toml. No need for extra tools like pyenv anymore. Just define the Python version you need, and Shuru takes care of the rest.

Here’s how it looks in your shuru.toml:

[versions]
python = "3.10.2"

[[task]]
name = "setup"
command = "pip install -r requirements.txt"

[[task]]
name = "run"
command = "python app.py"
default = true

Under the Hood

When you specify a Python version, Shuru will:

  1. Download the Source: It grabs the specified version from the official Python website.
  2. Compile It: This isn’t just a simple download and go. Shuru compiles Python from source, allowing for greater customization if you need it.
  3. Install: Finally, it installs Python in your designated environment.

If you want to see the build process in real-time, set the SHURU_BUILD_PYTHON_VERBOSE environment variable:

export SHURU_BUILD_PYTHON_VERBOSE=1

With this variable enabled, you’ll get detailed output during the build, making it easier to troubleshoot if anything goes wrong.

What About Node.js?

Python isn’t the only language Shuru supports. It still manages your Node.js versions in the same way, so you can seamlessly switch between environments for different projects. Shuru makes it easy to configure both in a single file, ensuring you’re always running the correct versions for your applications.

Final Thoughts

This addition makes Shuru a more versatile tool for developers who work in both JavaScript and Python. Managing your development environment should be straightforward, and Shuru aims to simplify that process.

Check out the latest version on GitHub and start integrating Python management into your workflow. Happy coding!

The above is the detailed content of A Minimalist Python Version Manager. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn