FS#75479 - [python-hatch] dependencies are a mess

Attached to Project: Arch Linux
Opened by Letu Ren (FantasqueX) - Monday, 01 August 2022, 12:56 GMT
Last edited by David Runge (dvzrv) - Monday, 04 September 2023, 00:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Santiago Torres (sangy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 12
Private No

Details

Description:

python-hatch requires python-tomli-w, as shown in https://github.com/pypa/hatch/blob/39f72785281331efc4590aa5802fd0f009f559dd/pyproject.toml#L50
and don't need python-toml.

Currently, python-hatch cannot run correctly.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/lib/python3.10/site-packages/hatch/cli/__init__.py:203 in main │
│ │
│ 200 │
│ 201 def main(): # no cov │
│ 202 │ try: │
│ ❱ 203 │ │ return hatch(windows_expand_args=False) │
│ 204 │ except Exception: │
│ 205 │ │ from rich.console import Console │
│ 206 │
│ │
│ /usr/lib/python3.10/site-packages/click/core.py:1130 in __call__ │
│ │
│ /usr/lib/python3.10/site-packages/click/core.py:1055 in main │
│ │
│ /usr/lib/python3.10/site-packages/click/core.py:1654 in invoke │
│ │
│ /usr/lib/python3.10/site-packages/click/core.py:1404 in invoke │
│ │
│ /usr/lib/python3.10/site-packages/click/core.py:760 in invoke │
│ │
│ /usr/lib/python3.10/site-packages/click/decorators.py:26 in new_func │
│ │
│ /usr/lib/python3.10/site-packages/hatch/cli/__init__.py:121 in hatch │
│ │
│ 118 │ │ │ app.display_waiting('No config file found, creating one with default setting │
│ 119 │ │ │
│ 120 │ │ try: │
│ ❱ 121 │ │ │ app.config_file.restore() │
│ 122 │ │ │ if app.verbose: │
│ 123 │ │ │ │ app.display_success('Success! Please see `hatch config`.') │
│ 124 │ │ except OSError: # no cov │
│ │
│ /usr/lib/python3.10/site-packages/hatch/config/user.py:47 in restore │
│ │
│ 44 │ │ return tomli_w.dumps(config.raw_data) │
│ 45 │ │
│ 46 │ def restore(self): │
│ ❱ 47 │ │ import tomli_w │
│ 48 │ │ │
│ 49 │ │ config = RootConfig({}) │
│ 50 │ │ config.parse_fields() │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'tomli_w'
This task depends upon

Closed by  David Runge (dvzrv)
Monday, 04 September 2023, 00:41 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with python-hatch 1.7.0-4
Comment by Toolybird (Toolybird) - Tuesday, 27 December 2022, 01:38 GMT
Dupe  FS#76944 
Comment by Matthew Cohen (mbc) - Wednesday, 15 February 2023, 20:12 GMT
It also requires python-httpx
Comment by Matthew Cohen (mbc) - Wednesday, 15 February 2023, 20:14 GMT
As well as python-tomlkit
Comment by Matthew Cohen (mbc) - Wednesday, 15 February 2023, 22:42 GMT
And python-shellingham
Comment by Toolybird (Toolybird) - Saturday, 20 May 2023, 23:50 GMT
Dupes:  FS#76056   FS#76348   FS#75639   FS#78798   FS#78803   FS#79142 

Consolidating numerous related bug reports about this pkg into one. Installing the pkg in a fresh VM/chroot then running `pip check' (which although not guaranteed, seems like a reasonable indicator) shows:

$ pip check
hatch 1.7.0 requires hatchling, which is not installed.
hatch 1.7.0 requires httpx, which is not installed.
hatch 1.7.0 requires hyperlink, which is not installed.
hatch 1.7.0 requires pyperclip, which is not installed.
hatch 1.7.0 requires shellingham, which is not installed.
hatch 1.7.0 requires tomli-w, which is not installed.
hatch 1.7.0 requires tomlkit, which is not installed.

Comment by Phil Schaf (flying-sheep) - Wednesday, 14 June 2023, 13:04 GMT
I don't know why  FS#75639  was merged into this issue

That issue is about `python-setuptools` *not* being a dependency, while this issue is about missing dependencies.

If it were a duplicate, this issue would have to be titled “[python-hatch] missing and superfluous dependencies”
Comment by Andrew Martens (mrtilo) - Thursday, 15 June 2023, 21:03 GMT
Any chance we can act on this almost a year old bug report?
Comment by KRACKY (KRACKY) - Wednesday, 19 July 2023, 22:32 GMT
Ok, I had both my bug request and this bug request removed as duplicates. ( https://bugs.archlinux.org/task/79142 and https://bugs.archlinux.org/task/79150 ). Echoing mrtilo, instead of just closing our duplicate requests, can this *please* be fixed? This package is unusable without these dependencies, and has been affecting a lot of potential users of this package.

Also, a large amount of its current dependencies are either unnecessary, or are not first level dependencies, such as `python-setuptools`, `python-colorama`, `twine` or `python-appdirs`. As such, it may make sense to exclude these as well.

Below are the dependencies that should be added:

To be installed:
- `python-hatchling`
- `python-httpx`
- `python-hyperlink`
- `python-shellingham`
- `python-tomli-w`
- `python-tomlkit`

Was being indirectly installed, but not explicitly:
- `python-keyring`
- `python-packaging`
- `python-platformdirs`
- `python-rich`

Other than those (and please correct me if I'm wrong), I don't see how any of the other dependencies are actually required by this package. They seem to be either higher-level dependencies, or are not used at all. As such, would propose removing these (PLEASE CHECK THESE!):
- `python-appdirs`
- `python-atomicwrites`
- `python-colorama`
- `python-coverage`
- `python-semver`
- `python-setuptools`
- `python-sortedcontainers`
- `python-toml`
- `twine`

--------

As such, tentatively proposing that this be the dependencies:

```
depends=(
'python' 'python-pip' 'python-virtualenv'
'python-click' 'python-pexpect' 'python-rich' 'python-userpath'
'python-hatchling' 'python-httpx' 'python-hyperlink' 'python-shellingham' 'python-tomli-w' 'python-tomlkit'
'python-keyring' 'python-packaging' 'python-platformdirs'
'python-build' 'python-pytest' 'python-wheel'
)
```

Lastly, also would recommend fixing the linked url
```
url="https://github.com/pypa/hatch"
```
Comment by Phil Schaf (flying-sheep) - Friday, 28 July 2023, 10:14 GMT
that’s also not right, why would anything have a runtime dependency to python-pytest?
Comment by Phil Schaf (flying-sheep) - Friday, 28 July 2023, 10:36 GMT Comment by KRACKY (KRACKY) - Friday, 28 July 2023, 15:33 GMT
Thx Phil; I did feel a little weird leaving it in, since all the PKGBUILDs I looked at didn't use it. But since I haven't exhaustively tested out all of hatch's features with this limited set of dependencies, I left it in, alongside any other building/deploying python package. In the pytest case especially, I was unsure since it was listed here as what I thought could still be a dependency ( https://github.com/pypa/hatch/blob/10d659f7109ad93cd9ba9e26384c8328d44e80ed/hatch.toml#L5 ).

Should have added that decision in my write-up as well (^_^;)
Comment by Santiago Torres (sangy) - Friday, 28 July 2023, 20:55 GMT
Hi Kracy and Phil. Let me take a look at this patch tonight and try to get this over with asap. I personally packaged this earlier on while chatting w/ ofek himself, and things indeed moved faster than I could keep up...
Comment by KRACKY (KRACKY) - Friday, 28 July 2023, 21:01 GMT
thx sangy (っ◔◡◔)っ ❤
Comment by Santiago Torres (sangy) - Friday, 28 July 2023, 21:26 GMT
I pushed a fixed version. It works for me, but please let me know if you have any issues and we can reopen...
https://gitlab.archlinux.org/archlinux/packaging/packages/python-hatch/-/commit/f27a992cf55f5198124d41ba0734b46b3375590c
Comment by Phil Schaf (flying-sheep) - Saturday, 29 July 2023, 20:52 GMT
  • Field changed: Percent Complete (100% → 0%)
Still not quite there. See here for the actual dependencies: https://github.com/pypa/hatch/blob/10d659f7109ad93cd9ba9e26384c8328d44e80ed/pyproject.toml#L39-L54

e.g. python-build is really just a make dependency.

Just take the exact list from my patch, it’s correct.
Comment by Phil Schaf (flying-sheep) - Sunday, 30 July 2023, 15:43 GMT
Kracky, the file you linked to is the definition of the dev environment. I.e. additional dependencies for running tests and building documentation.

If this PKGBUILD gets a check() function, those come into play.
Comment by KRACKY (KRACKY) - Sunday, 30 July 2023, 15:52 GMT
tysm for confirming flying-sheep (っ◔◡◔)っ ❤

Have mainly used poetry before, not hatch, so wasn't 100% sure how to infer the dependencies in the `hatch.toml` file 👍

Loading...