Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Help detecting dependencies in pyproject.toml that are only specified as conda-dependencies #3001

Open
Hofer-Julian opened this issue Jan 24, 2025 · 3 comments

Comments

@Hofer-Julian
Copy link
Contributor

Hofer-Julian commented Jan 24, 2025

Problem description

Problem description

Let's assume the following script:

# __init__.py
import numpy as np
x = np.array([1,2,3])

and the following pyproject.toml

[project]
dependencies = []
name = "pypi-test"
requires-python = ">= 3.11"
version = "0.1.0"

[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]

[tool.pixi.pypi-dependencies]
pypi_test = { path = ".", editable = true }

[tool.pixi.dependencies]
numpy = ">=2.2.2,<3"

This works fine, when used with pixi, but when you publish it on PyPI, people will not be able to use it since numpy isn't added as dependency.

Suggested solutions

We already know which conda packages correspond to PyPI packages.
Therefore, we also know the list of packages that are missing in project.dependencies

We could:

  • warn, but only if pyproject.toml is both the package and the manifest
  • create pixi lint and add that as a lint rule
  • let that handle by an external lint tool

References

Discord discussion

@ruben-arts
Copy link
Contributor

I think if we implement this #532 it could be solved aswell.

@maurosilber
Copy link
Contributor

I think if we implement this #532 it could be solved aswell.

I think that would require the inverse PyPI to conda mapping, while this works with the conda to PyPI mapping.

@theavey
Copy link

theavey commented Feb 5, 2025

Also related to #2411 I think.

Would really like to not have to list (conda) dependencies in a bunch of places (recipe.yaml then twice in pyproject.toml), but would also like to stay PEP 621 compliant for ease of reading by other developers and whatever build backend I choose.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants