#blocks #resources #generate #homebrew #python #sha-256 #package

app brew-python-resource-blocks

Generate Resource Blocks for Homebrew Python Formulae

1 unstable release

new 0.1.0 Nov 7, 2024

#353 in Development tools

Download history 102/week @ 2024-11-03

102 downloads per month

MIT license

24KB
107 lines

Brew Python Resource Blocks

brew-python-resource-blocks is a Rust tool that generates Homebrew resource blocks for Python packages listed in a requirements.txt file. This tool fetches package information from PyPI and formats it into resource blocks that can be used in Homebrew formulae.

Features

  • Reads a requirements.txt file and extracts package names and versions.
  • Fetches package information from PyPI.
  • Generates Homebrew resource blocks with URLs and SHA256 checksums.

Installation

To build the tool, you need to have Rust installed. You can install Rust using rustup.

# Clone the repository
git clone https://github.com/yourusername/brew-python-resource-blocks.git

# Change to the project directory
cd brew-python-resource-blocks

# Build the project
cargo build --release

Usage

To use the tool, run the following command, providing the path to your requirements.txt file:

cargo run -- path/to/requirements.txt

This will output the generated resource blocks to the console.

Example

Given a requirements.txt file with the following content:

# This file was autogenerated by uv via the following command:
#    uv export --format=requirements-txt
-e .
click==8.1.7 \
    --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de \
    --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows' \
    --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
    --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
environs==9.5.0 \
    --hash=sha256:a76307b36fbe856bdca7ee9161e6c466fd7fcffc297109a118c59b54e27e30c9 \
    --hash=sha256:1e549569a3de49c05f856f40bce86979e7d5ffbbc4398e7f338574c220189124

The tool will generate the following resource blocks:

resource "click" do
  url "https://files.pythonhosted.org/packages/.../click-8.1.7.tar.gz"
  sha256 "..."
end

resource "colorama" do
  url "https://files.pythonhosted.org/packages/.../colorama-0.4.6.tar.gz"
  sha256 "..."
end

resource "environs" do
  url "https://files.pythonhosted.org/packages/.../environs-9.5.0.tar.gz"
  sha256 "..."
end

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Dependencies

~4–15MB
~192K SLoC