Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow explicit location to module #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tlambert03
Copy link

@tlambert03 tlambert03 commented Mar 22, 2024

Creating a PR rather than an issue to make it easier to discuss...

In my build pipeline, I would like to be able to provide a specific file location for the module, rather than relying on import module_name. For example, I'd like to be able to do this:

pybind11-stubgen my_pkg._my_module -o src --location build/cp311/_my_module.cpython-311-darwin.so

This makes it so that your module doesn't necessarily need to be in a fully qualified and importable location just to be able to create stubs. All other semantics remain the same: MODULE_NAME refers to where the module will be importable from, but under the hood, we use importlib.util.spec_from_file_location rather than importlib.import_module.

naturally, very open to feedback :). (also: not immediately sure how to integrate this into the testing setup here)

thanks!

@VelocityRa
Copy link

Bump @sizmailov? Seems useful.

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.

2 participants