PyO3 / PyO3/pyo3

Dynamically opened python library

Open
#2,668 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

hard
Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

I want to optionally allow python plugins for my project. It would be nice if PyO3 could be configured such that python isn't linked at compile time and instead the .so is loaded dynamically at runtime and symbols are also loaded dynamically.

An alternative would be to statically link python to my project so that it's always available but that would drastically increase my binary size.

I believe this can be implemented using the libloading crate, maybe macros can be used in some way to convert the extern "C" blocks into dynamic symbol lookups? I'm not too familiar with macros, so I cannot say for sure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reviewing PyO3's current compile-time Python linking and the proposed libloading approach, then determine the configuration and runtime symbol-loading design; done means optional dynamic loading works without linking Python at compile time while preserving the existing mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.