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

pyproject: hack around to make editable install work #88

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

alexfikl
Copy link
Collaborator

@alexfikl alexfikl commented Jul 3, 2024

Switching to pyproject.toml completely with setuptools seems to have broken editable installs a bit for mypy (and possibly others): python/mypy#13392.

From reading through that, there seem to be a few options to hack around it:

  1. Use the current workaround with setting package-dir. Not sure why this works, but it seems to work and is used by others too.
  2. Use pip install --config-settings editable_mode=strict --editable .. This seems to work, but it's easy to forget to add options to pip install.
  3. Switch to a src-layout: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/. Not sure what setuptools is doing differently in that case, but it seems to pick up the typing correctly with no other changes..
  4. Switch to another build system. Hatchling (https://hatch.pypa.io/latest/) is small and seems to do the right thing by default for editable installs.

I mostly went with 1 because it's very non-intrusive, but it doesn't seem documented as a workaround for editable installs, so the behavior might change..

@alexfikl alexfikl changed the title pyprojet: hack around to make editable install work pyproject: hack around to make editable install work Jul 3, 2024
@inducer
Copy link
Owner

inducer commented Jul 3, 2024

Thanks! It's a wee bit gross, but I can live with it. I've put the py38 back, since we do have an opinion that may differ from the default. Deleting the line length meanwhile is saying "We would like to agree with whatever the default is."

@inducer inducer enabled auto-merge (rebase) July 3, 2024 16:07
@alexfikl
Copy link
Collaborator Author

alexfikl commented Jul 3, 2024

I've put the py38 back, since we do have an opinion that may differ from the default. Deleting the line length meanwhile is saying "We would like to agree with whatever the default is."

According to their docs, the default is "whatever project.requires-python" says, which seemed reasonable. Is there any case where we'd want those to disagree?
https://docs.astral.sh/ruff/settings/#target-version

@inducer inducer merged commit 9c1e5dc into inducer:main Jul 3, 2024
8 checks passed
@alexfikl alexfikl deleted the fix-editable branch July 3, 2024 16:18
inducer added a commit that referenced this pull request Jul 3, 2024
@inducer
Copy link
Owner

inducer commented Jul 3, 2024

Ah! Didn't know it was that smart. Thanks for setting me straight. c68a286

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.

2 participants