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

Dependencies not added to the wheel metadata #1053

Closed
1 of 2 tasks
calavera opened this issue Aug 10, 2022 · 4 comments · Fixed by #1054
Closed
1 of 2 tasks

Dependencies not added to the wheel metadata #1053

calavera opened this issue Aug 10, 2022 · 4 comments · Fixed by #1054
Assignees
Labels
bug Something isn't working

Comments

@calavera
Copy link

Bug Description

Dependencies specified in pyproject.toml are not added to the final METADA file in the dist-info directory.

I have a project with this information in the pyproject.toml file:

[project]
name = "cargo-lambda"
dependencies = ["ziglang>=0.9.0"]

When I read the documentation, I understood that Maturin would use that information to make sure that the dependencies are installed when someone runs pip install cargo-lambda. This is not the case.

For what I can tell, the dist-info/METADATA files doesn't include the dependency as Requires-Dist, is there anything that I'm missing?

This is the header if my dist-info/METADATA:

❯ cat cargo_lambda-0.10.0.dist-info/METADATA
Metadata-Version: 2.1
Name: cargo-lambda
Version: 0.10.0
Summary: Cargo subcommand to work with AWS Lambda
Keywords: cargo,subcommand,aws,lambda
Home-Page: https://github.com/cargo-lambda/cargo-lambda
License: MIT
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source Code, https://github.com/cargo-lambda/cargo-lambda

# cargo-lambda

[![crates.io][crate-image]][crate-link]
[![Build Status][build-image]][build-link]

Your Python version (python -V)

Python 3.8.10

Your pip version (pip -V)

pip 20.0.2

What bindings you're using

No response

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. Clone cargo-lambda with git clone [email protected]:cargo-lambda/cargo-lambda
  2. Generate a wheel with maturin --release -o dist --strip -m crates/cargo-lambda-cli/Cargo.toml
  3. Unzip the generated wheel
  4. Verify that dist-info/METADATA doesn't include Requires-Dist.
@calavera calavera added the bug Something isn't working label Aug 10, 2022
@messense
Copy link
Member

// use command line argument if specified
if let Some(path) = cargo_manifest_path {
return Ok((path.clone(), path.parent().unwrap().join(PYPROJECT_TOML)));
}

The problem is that when you specified Cargo manifest path in cli, maturin currently assumes pyproject.toml is in the same directory which isn't true in this case.

I planned to fix it in #1009 but forgot about it when implementing #1043, thanks for posting the issue.

@messense
Copy link
Member

Please try #1054.

BTW, currently maturin cannot build source distribution for your project even after #1054 due to the following error:

$ maturin sdist -o dist -m crates/cargo-lambda-cli/Cargo.toml
🔗 Found bin bindings
📡 Using build options bindings from pyproject.toml
💥 maturin failed
  Caused by: Failed to build source distribution
  Caused by: pyproject.toml was not included by `cargo package`. Please make sure pyproject.toml is not excluded or build without `--sdist`

Consider move pyproject.toml to crates/cargo-lambda-cli/ directory.

@calavera
Copy link
Author

Consider move pyproject.toml to crates/cargo-lambda-cli/ directory.

I can give that a try

@calavera
Copy link
Author

Moving the pyproject.toml file worked, btw. You might want to consider updating your documentation to help other people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants