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

maturin develop does not install dependencies #414

Closed
cassiersg opened this issue Feb 11, 2021 · 1 comment · Fixed by #443
Closed

maturin develop does not install dependencies #414

cassiersg opened this issue Feb 11, 2021 · 1 comment · Fixed by #443
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@cassiersg
Copy link

When adding a section

 [package.metadata.maturin]
requires-dist = ["flask~=1.1.0", "toml==0.10.0"]

in Cargo.toml, the dependencies are not installed in the current virtualenv when running maturin develop.
Is this the expected behavior ?

If so, it is a bit annoying: the simplest way I found for installing the python dependencies specified in Cargo.toml is to build the wheel and install it. Is there a better solution ? I believe this could be mentioned in the README.

Please provide the following information:

  • Your python version (python -V): 3.7.3
  • Your pip version (pip -V): 21.0.1
    • If this isn't the latest pip version, have you checked using the latest pip version? This is the latest pip version
  • The version of the bindings you're using, if any (e.g. pyo3, rust-cpython or cffi): pyo3=0.13
  • Does cargo build work? yes
  • If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)? N/A (on linux)
@konstin konstin added the enhancement New feature or request label Feb 23, 2021
@konstin
Copy link
Member

konstin commented Feb 23, 2021

Currently, this is missing from develop. If anyone want to implement this, this should be the right location:

maturin/src/develop.rs

Lines 44 to 49 in 7c43487

let interpreter = PythonInterpreter::check_executable(python, &target, &build_context.bridge)?
.ok_or_else(|| {
anyhow!("Expected `python` to be a python interpreter inside a virtualenv ಠ_ಠ")
})?;
let mut builder = PathWriter::venv(&target, &venv_dir, &build_context.bridge)?;

Check whether build_context.metadata21.requires_dist has any entries and if so, call python -m pip on all of them (at once, invoking pip is slow). For the test, pick a dependency-less, pure-python package from pypi as test requirement, extend an existing test with that package as requirement and check that the requirement is installed in check_installed.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants