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

Add path option for Python source #584

Merged
merged 1 commit into from
Aug 6, 2021
Merged

Conversation

messense
Copy link
Member

@messense messense commented Jul 6, 2021

With this PR you can specify Python source code location in Cargo.toml by setting package.metadata.maturin.python-source to your Python source code directory.

Here is an example project layout with python-source set to python:

├── Cargo.lock
├── Cargo.toml
├── Readme.md
├── check_installed
│   └── check_installed.py
├── python
│   ├── pyo3_mixed_py_subdir
│   │   ├── __init__.py
│   │   └── python_module
│   │       ├── __init__.py
│   │       └── double.py
│   └── pyproject.toml
├── src
│   └── lib.rs
├── test_pyo3_mixed.py
└── tox.ini

Closes #335

@messense messense requested a review from konstin July 16, 2021 03:08
Copy link
Member Author

@messense messense left a comment

Choose a reason for hiding this comment

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

FIXME: pyproject.toml should be relative to Python source instead of Cargo.toml. It's wrong, see 41a49b6

@messense messense force-pushed the python-source branch 2 times, most recently from 7220fd7 to 2750d9f Compare July 18, 2021 02:22
@messense messense removed the request for review from konstin August 5, 2021 11:22
@messense
Copy link
Member Author

messense commented Aug 5, 2021

cc @sebpuetz @davidhewitt @ijl

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

👍 This seems like a good idea, it's nice to give users this flexibility!

src/build_context.rs Outdated Show resolved Hide resolved
src/build_options.rs Outdated Show resolved Hide resolved
src/metadata.rs Outdated Show resolved Hide resolved
@davidhewitt
Copy link
Member

(This looks good to me, apart from missing README. I would approve, but historically I haven't been an approver / reviewer for maturin. If you want more review capacity I'm happy to start reviewing & approving maturin PRs?)

@messense
Copy link
Member Author

messense commented Aug 6, 2021

If you want more review capacity I'm happy to start reviewing & approving maturin PRs?

That would be great. konstin emailed me that he won't be actively maintain maturin nowaday.

@messense messense merged commit 105d2fb into PyO3:main Aug 6, 2021
@messense messense deleted the python-source branch August 6, 2021 10:17
@ShanWeera
Copy link

ShanWeera commented Aug 7, 2021

@messense I'm on Windows 10, Python 3.8 and using Maturin 0.11.3-beta.2.

I can't seem to get python-source working on my end. The folder structure is similar to what's documented in the README. The Python source files are not copied over. Works fine with lib.name.

Any ideas?

@davidhewitt
Copy link
Member

@ShanWeera Can you share the cargo.toml which doesn't work?

@messense
Copy link
Member Author

messense commented Aug 8, 2021

@ShanWeera Please open a new issue so we can track it.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Oct 1, 2021
https://build.opensuse.org/request/show/922513
by user mia + dimstar_suse
- Update to 0.11.4
  * Autodetect PyPy executables
    gh#PyO3/maturin#617
  * auditwheel: add `libz.so.1` to whitelisted libraries
    gh#PyO3/maturin#625
  * auditwheel: detect musl libc
    gh#PyO3/maturin#629
  * Fixed Python 3.10 and later versions detection on Windows
    gh#PyO3/maturin#630
  * Install entrypoint scripts in `maturin develop` command
    gh#PyO3/maturin#633
    gh#PyO3/maturin#634
  * Add support for installing optional dependencies in
    `maturin develop` command
    gh#PyO3/maturin#635
  * Fixed build error when `manylinux`/`compatibility` options is
    specified in `pyproject.toml`
    gh#PyO3/maturin#637
- Changes in 0.11.3:
  * Add path option for Python source
    gh#PyO3/maturin#584
  * Add auditwheel support for musllinux
    gh#PyO3/maturin#597
  * `[tool.m
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