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

Upgrade hatch to fix installing extras bug #4108

Merged
merged 5 commits into from
Dec 14, 2023
Merged

Upgrade hatch to fix installing extras bug #4108

merged 5 commits into from
Dec 14, 2023

Conversation

BryceStevenWilley
Copy link
Contributor

@BryceStevenWilley BryceStevenWilley commented Dec 12, 2023

Description

Fix #4107 by updating hatchling in a fairly hacky way though.

Hatch will used to strip out parenthesis in the extras if it thinks it doesn't need them and wouldn't add them back in. :( We can, however, add a meaningless restriction like and python_version >= '1' to force hatch to use our parenthesis. Extremely hacky, and I would understand if we don't want this to be merged until a cleaner hatch fix is upstream. Also happy to come up with another way of essentially just having true in the spec, but I couldn't find one with a quick reading of https://peps.python.org/pep-0508/.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary? I'm not sure it's a great idea to add a test to see that dependency was avoided, happy to add one if desired though!
    I did manually test this by installing my local checkout of the project, confirming that the dependencies for the d extra aren't installed:
$ pip install .
Processing /home/brycew/Developer/black
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: typing-extensions>=4.0.1 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (4.9.0)
Requirement already satisfied: tomli>=1.1.0 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (2.0.1)
Requirement already satisfied: mypy-extensions>=0.4.3 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (1.0.0)
Requirement already satisfied: pathspec>=0.9.0 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (0.12.1)
Requirement already satisfied: platformdirs>=2 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (4.1.0)
Requirement already satisfied: click>=8.0.0 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (8.1.7)
Requirement already satisfied: packaging>=22.0 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1763+gdad9f79.d20231212) (23.2)
Building wheels for collected packages: black
  Building wheel for black (pyproject.toml) ... done
  Created wheel for black: filename=black-0.1.dev1763+gdad9f79.d20231212-py3-none-any.whl size=194930 sha256=a511959e5af87f2bc5623744f13eba2bd3c406fd9b522e8a537c8f3d341b1a18
  Stored in directory: /tmp/pip-ephem-wheel-cache-o2gmqktu/wheels/92/d6/de/b610e33302c2b433609d1ae2283761d3ff26bd0fb805d38fe1
Successfully built black
Installing collected packages: black
  Attempting uninstall: black
    Found existing installation: black 0.1.dev1763+gdad9f79
    Uninstalling black-0.1.dev1763+gdad9f79:
      Successfully uninstalled black-0.1.dev1763+gdad9f79
Successfully installed black-0.1.dev1763+gdad9f79.d20231212

When run on main, this output includes Requirement already satisfied: aiohttp>=3.7.4 in /home/brycew/Developer/.venv/lib/python3.10/site-packages (from black==0.1.dev1762+g35ce37d) (3.9.1), and all of it's dependencies.

  • Add new / update outdated documentation? (nothing changed here)

Fix #4107, in a fairly hacky way though.

Hatch will strip out parenthesis in the extras if it thinks it doesn't need
them. We can, however, add a meaningless restriction like
`and python_version >= '1'` to force hatch to use our parenthesis. Definitely
should have a hatch fix upstream though.
Copy link
Contributor

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing! Now that https://github.com/pypa/hatch/releases/tag/hatchling-v1.20.0 has been released with an upstream fix, maybe a simpler solution might be to just pin to hatchling>=1.20.0 here?

requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"]

@BryceStevenWilley
Copy link
Contributor Author

Thanks! I just saw that hatchling released the patch already, which is nice. I also changed the other pinned version of hatchling, I don't have a mac machine to test that one though.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the report and for fixing this twice over!

We'll test the Mac build in CI (looks like the patch still applies, which is main reason for that pin)

CHANGES.md Outdated Show resolved Hide resolved
@hauntsaninja hauntsaninja merged commit 8fec1c3 into psf:main Dec 14, 2023
45 of 46 checks passed
@sigma67
Copy link

sigma67 commented Dec 16, 2023

Any plans for a patch release including this fix?

@cooperlees cooperlees changed the title Adds paren to deps for hidden extra constraint Upgrade hatch to fix installing extras bug Dec 22, 2023
@BryceStevenWilley BryceStevenWilley deleted the 4107_extra_d_deps branch January 3, 2024 16:52
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.

Dependencies for black[d] are being installed by default
4 participants