How aspadax/requirements-txt-generator works
This is a Conda-focused CLI that generates a Python project’s requirements.txt without querying package registries. The workflow validates command-line options, locates the environment’s package metadata, scans project Python files for imports, excludes standard-library names, matches imports to locally installed packages and versions, then writes the result. The graph preserves these distinct stages and the standard-library data input. Relationships are based on the shown main, package, Conda, and writer code; other environment integrations are not evidenced.
Main entry points: main.rs Generation workflow · cli.rs CLI arguments · conda.rs Conda detection and paths · std.rs Standard-library loader
Components 14
Inputs and options
- CLI arguments
src/cli.rs - Generation workflow
src/main.rs
Conda environment
- Conda detection and paths
src/virtual_envs/conda.rs - Conda site-packages
- Environment package interface
src/virtual_envs/traits.rs
Dependency analysis
- Standard-library list
python_std_libraries.json - Standard-library loader
src/python/std.rs - Python file discovery
src/python/package.rs - Python source reader
src/python/package.rs - Import extraction
src/python/package.rs - Package matching and versions
src/python/package.rs
Requirements output
- Requirements writer
src/writer.rs - requirements.txt
Other components
- Tool user
Connections 13
- Tool user → CLI arguments: provides options
README.md - CLI arguments → Generation workflow: parses and validates
src/main.rs - Generation workflow → Standard-library loader: loads names
src/main.rs - Standard-library loader → Standard-library list: reads JSON
src/python/std.rs - Generation workflow → Conda detection and paths: locates environment
src/main.rs - Conda detection and paths → Conda site-packages: reads metadata
src/virtual_envs/conda.rs - Generation workflow → Python file discovery: scans project
src/main.rs - Generation workflow → Python source reader: reads discovered files
src/main.rs - Generation workflow → Import extraction: extracts imports
src/main.rs - Generation workflow → Package matching and versions: matches dependencies
src/main.rs - Package matching and versions → Environment package interface: reads package names and versions
src/python/package.rs - Generation workflow → Requirements writer: writes result
src/main.rs - Requirements writer → requirements.txt: creates file
src/writer.rs