{"id":19741928,"url":"https://github.com/pyo3/python3-dll-a","last_synced_at":"2025-10-12T23:02:05.931Z","repository":{"id":39656678,"uuid":"460734349","full_name":"PyO3/python3-dll-a","owner":"PyO3","description":"Standalone python3.dll import library generator","archived":false,"fork":false,"pushed_at":"2025-03-30T00:57:21.000Z","size":229,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-09T15:03:00.752Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyO3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-18T06:20:24.000Z","updated_at":"2025-03-25T19:17:32.000Z","dependencies_parsed_at":"2024-03-24T07:30:29.716Z","dependency_job_id":"7993e6e4-510c-418e-a551-8110f058eb8b","html_url":"https://github.com/PyO3/python3-dll-a","commit_stats":{"total_commits":133,"total_committers":5,"mean_commits":26.6,"dds":0.5263157894736843,"last_synced_commit":"0bd1477bbead1d9dd6c8f8c2abf49a5df90daef3"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyO3%2Fpython3-dll-a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyO3%2Fpython3-dll-a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyO3%2Fpython3-dll-a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyO3%2Fpython3-dll-a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyO3","download_url":"https://codeload.github.com/PyO3/python3-dll-a/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055276,"owners_count":21040156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T01:28:27.856Z","updated_at":"2025-10-12T23:02:05.918Z","avatar_url":"https://github.com/PyO3.png","language":"Rust","readme":"Standalone `python3(y)(t).dll` import library generator\n=======================================================\n\n[![Actions Status](https://github.com/PyO3/python3-dll-a/workflows/Test/badge.svg)](https://github.com/PyO3/python3-dll-a/actions)\n[![Crate](https://img.shields.io/crates/v/python3-dll-a.svg)](https://crates.io/crates/python3-dll-a)\n[![Documentation](https://docs.rs/python3-dll-a/badge.svg)](https://docs.rs/python3-dll-a)\n\nGenerates import libraries for the Python DLL\n(either `python3.dll` or `python3y(t).dll`)\nfor MinGW-w64 and MSVC (cross-)compile targets.\n\nThis crate **does not require** Python 3 distribution files\nto be present on the (cross-)compile host system.\n\nThis crate uses the binutils `dlltool` program to generate\nthe Python DLL import libraries for MinGW-w64 targets.\nSetting `PYO3_MINGW_DLLTOOL` environment variable overrides\nthe default `dlltool` command name for the target.\n\n**Note:** MSVC cross-compile targets require either LLVM binutils\nor Zig to be available on the host system.\nMore specifically, `python3-dll-a` requires `llvm-dlltool` executable\nto be present in `PATH` when targeting `*-pc-windows-msvc` from Linux.\n\nAlternatively, `ZIG_COMMAND` environment variable may be set to e.g. `\"zig\"`\nor `\"python -m ziglang\"`, then `zig dlltool` will be used in place\nof `llvm-dlltool` (or MinGW binutils).\n\nPyO3 integration\n----------------\n\nSince version **0.16.5**, the `pyo3` crate implements support\nfor both the Stable ABI and version-specific Python DLL import\nlibrary generation via its new `generate-import-lib` feature.\n\nIn this configuration, `python3-dll-a` becomes a `pyo3` crate dependency\nand is automatically invoked by its build script in both native\nand cross compilation scenarios.\n\n### Example `Cargo.toml` usage for an `abi3` PyO3 extension module\n\n```toml\n[dependencies]\npyo3 = { version = \"0.16.5\", features = [\"extension-module\", \"abi3-py37\", \"generate-import-lib\"] }\n```\n\n### Example `Cargo.toml` usage for a standard PyO3 extension module\n\n```toml\n[dependencies]\npyo3 = { version = \"0.16.5\", features = [\"extension-module\", \"generate-import-lib\"] }\n```\n\nStandalone build script usage\n-----------------------------\n\nIf an older `pyo3` crate version is used, or a different Python bindings\nlibrary is required, `python3-dll-a` can be used directly\nfrom the crate build script.\n\nThe examples below assume using an older version of PyO3.\n\n### Example `build.rs` script for an `abi3` PyO3 extension\n\nThe following cargo build script can be used to cross-compile Stable ABI\nPyO3 extension modules for Windows (64/32-bit x86 or 64-bit ARM)\nusing either MinGW-w64 or MSVC target environment ABI:\n\n```rust\nfn main() {\n    if std::env::var(\"CARGO_CFG_TARGET_OS\").unwrap() == \"windows\" {\n        let cross_lib_dir = std::env::var_os(\"PYO3_CROSS_LIB_DIR\")\n            .expect(\"PYO3_CROSS_LIB_DIR is not set when cross-compiling\");\n        let arch = std::env::var(\"CARGO_CFG_TARGET_ARCH\").unwrap();\n        let env = std::env::var(\"CARGO_CFG_TARGET_ENV\").unwrap();\n\n        let libdir = std::path::Path::new(\u0026cross_lib_dir);\n        python3_dll_a::generate_implib_for_target(libdir, \u0026arch, \u0026env)\n            .expect(\"python3.dll import library generator failed\");\n    }\n}\n```\n\nA compatible `python3.dll` import library file named `python3.dll.a`\nor `python3.lib` will be automatically created in the directory\npointed by the `PYO3_CROSS_LIB_DIR` environment variable.\n\n### Example `cargo build` invocation\n\n```sh\nPYO3_CROSS_LIB_DIR=target/python3-dll cargo build --target x86_64-pc-windows-gnu\n```\n\nGenerating version-specific `python3y.dll` import libraries\n-----------------------------------------------------------\n\nAs an advanced feature, `python3-dll-a` can generate Python version\nspecific import libraries such as `python39.lib` or `python313t.lib`.\n\nSee the `ImportLibraryGenerator` builder API description for details.\n\nMaintenance\n-----------\n\nThis crate embeds Module-Definitions based on the `stable_abi.toml` file from CPython.\n\nThe upstream version of this file is located in the [CPython project][cpython]\nrepository under the path `Misc/stable_abi.toml`.\n\n[cpython]: https://github.com/python/cpython/blob/main/Misc/stable_abi.toml\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyo3%2Fpython3-dll-a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyo3%2Fpython3-dll-a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyo3%2Fpython3-dll-a/lists"}