Skip to content

Conversation

@dkhofer
Copy link
Member

@dkhofer dkhofer commented Sep 26, 2025

No description provided.

fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for byte in &self.0 {
write!(f, "{:02x}", byte)?;
write!(f, "{byte:02x}")?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pacifying clippy with a lot of this

@dkhofer dkhofer requested a review from bobvh September 26, 2025 22:36
@dkhofer
Copy link
Member Author

dkhofer commented Sep 26, 2025

I couldn't get to everything, so I focused on the existing operations that I think Bob wants python bindings for, mainly derive_chunks and make_stitch. I refactored those so we can pass in arguments directly from python instead of reading them from files. I also did the same for update_with_fasta, so you can call update_with_sequence from python and just pass in a sequence you want to have added to the graph.

Bob, let me know if there are operations that I missed, or other operations that don't exist yet that you'd like to see implemented for python.

@bobvh
Copy link
Member

bobvh commented Sep 29, 2025

The functions you have added is a good start. The ergonomics look a bit clunky, but that could be handled on the python side (setting up a gen_api_client that hides many of the arguments). I did want to try what it feels like and I can't figure out how you are building / testing the Python module.

The Makefile in the main project dir causes the old python bindings to be built, not your new workspace. The idea is to supersede /src/python-api, correct? So we could remove /src/python-api when merging this into main?

Calling maturin directly from gen-python says it installed something, but under what name?

> maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.13 at <my gen repo>/gen-python/.venv/bin/python
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
📦 Built wheel for CPython 3.13 to /var/folders/f8/8zf8xczs0pxf9_vfnlmqlx9h0000gn/T/.tmpHFSTAY/gen_python-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
✏️ Setting installed package as editable
🛠 Installed gen-python-0.1.0

> which python
<my gen repo>/gen-python/.venv/bin/python

> python
Python 3.13.3 (main, Apr 25 2025, 01:23:04) [Clang 17.0.0 (clang-1700.0.13.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gen
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import gen
ModuleNotFoundError: No module named 'gen'
>>>

I know we can't keep the name "gen", did we decide on the alternative?

I also tried just building it with cargo build from gen-python, but that gives the usual linker issues from pyo3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants