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

Install project in editable mode when using a pyproject.toml manifest automatically #1083

Closed
olivier-lacroix opened this issue Mar 29, 2024 · 3 comments · Fixed by #1084
Closed
Labels
✨ enhancement Feature request

Comments

@olivier-lacroix
Copy link
Contributor

Problem description

With #1044 merged, I propose to automatically add current project as a dependency in editable mode when using a pyproject.toml manifest.

I do not see any reason not to, but maybe I am missing something?

@tdejager
Copy link
Contributor

tdejager commented Mar 29, 2024

With regards to the CLI. I guess coming from pip, you would normally run pip install -e .. As a user you know pip install requires a list of requirements or editables. However, pixi install takes the set of requirements from a file and creates an environment which is a bit different of a command.

So I was wondering if it this might make it confusing, because you need an extra specifier with pip which you don't with pixi install. However, it might be the better default nonetheless.


Now that I'm reading more about it I think editable installs by default is the correct way to go. Prior art:

  • poetry expects a folder with the same name as the pkg. Or you can use the packages field in the pyproject.toml to include sources with a different name.
  • pdm init create a src folder with the same name as the package.
  • hatch also creates a src folder with the same name as the package.

W.r.t build backends its much of the same thing, hatch's is pretty well documented: https://hatch.pypa.io/latest/plugins/builder/wheel/#default-file-selection.

However, setuptools allows all kinds of different configurations, although the documentation follows/recommends a similar approach as poetry.

@garymm
Copy link

garymm commented Apr 10, 2024

This doesn't work for me with pixi 0.19.0.
My pyproject.toml:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "fluid"
requires-python = ">=3.10"
dynamic = ["version"]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "linux-aarch64", "osx-arm64"]

[tool.pixi.dependencies]
pytorch = ">=2.1.0, <2.2.0"
gymnasium = ">=0.28, <0.29"
loguru = ">=0.7.0, <0.8.0"
pytest = ">=8.0, <9.0"

[tool.pixi.host-dependencies]
python = ">=3.10, <3.11"

If I add this at the bottom, things work as expected:

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

How can I tell it doesn't work?
When do pixi run pytest without the explicit editable dep, it fails with ModuleNotFoundError.

@tdejager
Copy link
Contributor

Hi @garymm you are correct in the PR that closes this issue it was decided against an automatic install. Mainly because you can have multiple environments where you might not want an editable in all cases.

'pixi unit' does add it automatically to the .toml. If you find this behavior undesirable, feel free to make an issue where we can weigh the pro's and cons :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants