Skip to content

Conversation

@andyscott
Copy link

Adds support for specifying the module name + module prefix for pyo3 extensions.

@andyscott andyscott force-pushed the ags/pyo3-module-path branch from 7a660ad to 3a98fed Compare November 13, 2025 01:56
@andyscott andyscott changed the title pyo3: support module prefix + naming feat: pyo3 support module prefix + naming Nov 13, 2025
@andyscott andyscott force-pushed the ags/pyo3-module-path branch from 35bc452 to e19bd9c Compare November 15, 2025 05:43
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Thanks! Just one question

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

One more question for you guys!

name = "module_prefix",
srcs = ["bar.rs"],
edition = "2021",
imports = ["."],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain how this interacts with imports? Is imports = ["."] required? What happens if a subdirectory is added? Does it make the module not imported?

Choose a reason for hiding this comment

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

Import values behave just like they do for regular Python library import paths under Bazel.

I reworked the test to use the default import path (the repo root) instead of the package's dir. The python test case is adjusted accordingly so it looks like the rest of the test cases in the pyo3 extension workspace.

Copy link

@ags-openai ags-openai Dec 10, 2025

Choose a reason for hiding this comment

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

What happens if a subdirectory is added? Does it make the module not imported?

As in something like imports = ["some_dir"]? It'd try to strip this off of the prefix of the module path for python. Since the shared lib is being placed in a directory with a module path prefix turned to dirs it would effectively try to trim the module name prefixes this PR is adding support for.

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