Wrapping rhea.py into a python package#9
Conversation
- Goal: for install with `pip git+` - using the `pyproject.toml` approach with an entry script (`__init__.py`) inside a `rhea/` dir that counts as the `module`
… the conda dependency list - Note: `flye` and `minigraph` are the two dependancies not available in pip; hence we need the `conda` still
- Pass them as arguments to all functions. - Variables are now scoped to where they are used. - Modified variables include: - COVERAGE_DICTS - COVERAGE_EDGES_DICTS - NODE_LENGTH_DICT - SEQ_BP_DICT
There was a problem hiding this comment.
Pull request overview
This pull request refactors the existing rhea.py CLI tool to be installable as a Python package (supporting pip install -e . / pip install git+...) and reduces reliance on global mutable state by passing coverage/state explicitly through functions.
Changes:
- Added Python packaging metadata (
pyproject.toml) and arheaconsole-script entry point. - Introduced a
rhea/__init__.pywrappermain()intended to run the CLI via therheacommand. - Refactored
rhea.pycoverage/SV detection flow to pass coverage dictionaries explicitly instead of using globals; updated README/env setup accordingly.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
rhea/__init__.py |
Adds CLI entry point wrapper that dynamically loads rhea.py. |
pyproject.toml |
Defines the project and installs a rhea script entry point. |
rhea.py |
Refactors coverage/state handling to reduce global variables; adds main() function. |
README.md |
Updates usage/install instructions to prefer rhea ... CLI invocation. |
environment.yml |
Adds pip to support editable installs. |
.gitignore |
Adds ignores for build artifacts and standardizes results directory name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- rest of the functions moved to `rhea/core.py` - all code should be within the internal `rhea/` dir for the python project - updated pyproject.toml with simple `packages = ["rhea"]` to define package contents explicitly
- expanded the return list in `create_coverage_df`
|
@copilot do a final review |
Agent-Logs-Url: https://github.com/treangenlab/rhea/sessions/c9b84e03-0627-4380-93be-df25f005d03d Co-authored-by: ppreshant <14856479+ppreshant@users.noreply.github.com>
Final review complete. I fixed one packaging issue so pip installs now pull required Python deps and enforce Python >=3.8 in |
- fix #10 - Updated the channel order in yml to install latest packages including `pandas=3.0.2` which causes this error
Fix pandas' deprecated `applymap` -> 'map`
This pull request refactors the
rhea.pycodebase to improve usability and compatibility withpip git+based installation inside other packages. other changes includemain()function, andfixes #8
Testing notes
rheaon the t0.fasta and t1.fasta examples. (8/May/26)Details of improvements
Packaging and CLI improvements:
pyproject.tomlfile to definerheaas a Python package, including metadata, dependencies, and a CLI entry point (rheacommand now runs the tool).rhea/__init__.pywith amain()function to serve as the CLI entry point, enablingpip install -e .usage and direct invocation via therheacommand.Refactoring for maintainability and testability:
rhea.pyto remove global variables (e.g.,NODE_LENGTH_DICT,SEQ_BP_DICT,COVERAGE_DICTS), passing necessary state explicitly between functions. This improves modularity and makes the code easier to test and extend [1] [2] [3] [4] [5] [6].Documentation and environment updates:
README.mdto clarify installation and usage, including instructions for package installation, running via the CLI, and environment setup [1] [2].pipto theenvironment.ymldependencies to support package installation.Detailed changes:
1. Packaging and CLI improvements
pyproject.tomlto enablerheaas a pip-installable package with a CLI entry point (rhea).rhea/__init__.pywith amain()function that loads and runs the main script, supporting both CLI and package usage.2. Refactoring for maintainability
rhea.py, improving code clarity and testability [1] [2] [3] [4] [5] [6].3. Documentation and environment updates
README.mdwith clearer setup and usage instructions, reflecting the new CLI and installation process [1] [2].piptoenvironment.ymlto support editable installs (pip install -e .).