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

fix: add hatchling for platformdirs #600

Merged
merged 1 commit into from
Apr 22, 2022
Merged

fix: add hatchling for platformdirs #600

merged 1 commit into from
Apr 22, 2022

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Apr 19, 2022

platformdirs/platformdirs#75 was released yesterday.

@yajo
Copy link
Contributor Author

yajo commented Apr 20, 2022

Any clues on why this is failing?

@takeda
Copy link
Contributor

takeda commented Apr 21, 2022

@yajo This is just guessing, I'm not as familiar with poetry2nix internals, but I'm wondering if it isn't due to pyproject.toml not listing any dependencies, yet, the wheel on PyPI lists these (I'm thinking poetry2nix compiles dependencies it uses pyproject.toml?):

Requires-Dist: editables>=0.2; python_version > '3'
Requires-Dist: importlib-metadata; python_version < '3.8'
Requires-Dist: packaging>=21.3; python_version > '3'
Requires-Dist: packaging~=20.9; python_version < '3'
Requires-Dist: pathspec>=0.9
Requires-Dist: pluggy>=1.0.0; python_version > '3'
Requires-Dist: pluggy~=0.13; python_version < '3'
Requires-Dist: tomli>=1.2.2; python_version > '3'
Requires-Dist: toml~=0.10.2; python_version < '3'

Perhaps an override for hatchling is also necessary?

@ofek why the dependencies are not in pyproject.toml?

@ofek
Copy link

ofek commented Apr 21, 2022

it builds itself so afaik there would be no deps at build time that way

@adisbladis
Copy link
Member

When we add something via an override that isn't in the projects poetry.lock we inherit whatever version that nixpkgs has.
In this instance poetry has a dependency on platformdirs which pulled in hatchling via the override.

The problem was that Poetry's dependency on packaging was defined as packaging = "^20.4" while hatchling requires 21.3.

For now I've added a conditional around this override that just checks if platformdirs is really a version that requires hatchling.
This still isn't technically correct, but it could certainly be worse.

Copy link
Contributor Author

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Seems good.

@adisbladis adisbladis merged commit 80c070d into nix-community:master Apr 22, 2022
@xanderio
Copy link

Even with this fix applied platformdirs still fails to build.

Processing /build/platformdirs-2.5.2
  Running command Preparing metadata (pyproject.toml)
  Traceback (most recent call last):
    File "/nix/store/ycgq5lbkywhrwr8gmyj4wjbdzx0cf4b7-python3.8-pip-22.0.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_wheel'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/nix/store/ycgq5lbkywhrwr8gmyj4wjbdzx0cf4b7-python3.8-pip-22.0.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/nix/store/ycgq5lbkywhrwr8gmyj4wjbdzx0cf4b7-python3.8-pip-22.0.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/nix/store/ycgq5lbkywhrwr8gmyj4wjbdzx0cf4b7-python3.8-pip-22.0.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
    File "/nix/store/lpssqjfy8c05nmwav954w1n9531nlzn4-python3.8-hatchling-0.22.0/lib/python3.8/site-packages/hatchling/build.py", line 41, in build_wheel
      return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
    File "/nix/store/lpssqjfy8c05nmwav954w1n9531nlzn4-python3.8-hatchling-0.22.0/lib/python3.8/site-packages/hatchling/builders/plugin/interface.py", line 103, in build
      configured_build_hooks = self.get_build_hooks(directory)
    File "/nix/store/lpssqjfy8c05nmwav954w1n9531nlzn4-python3.8-hatchling-0.22.0/lib/python3.8/site-packages/hatchling/builders/plugin/interface.py", line 318, in get_build_hooks
      raise ValueError('Unknown build hook: {}'.format(hook_name))
  ValueError: Unknown build hook: vcs
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /nix/store/4g4p6h9gv9r44w261vsn5k2wc905pqhw-python3-3.8.13/bin/python3.8 /nix/store/ycgq5lbkywhrwr8gmyj4wjbdzx0cf4b7-python3.8-pip-22.0.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /build/tmp4h5n1fto
  cwd: /build/platformdirs-2.5.2
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@lelit
Copy link

lelit commented Apr 22, 2022

Even with this fix applied platformdirs still fails to build.

Right, got the same yesterday, adding just hatchling. This comment suggests that hatch-vcs is needed too, but I could not try that out yet.

@lelit
Copy link

lelit commented Apr 22, 2022

See also this other comment.

@adisbladis
Copy link
Member

I've added hatch-vcs in 8cfd980.
It's still not going to work unless you add hatch-vcs to your dependencies at the moment since hatch-vcs isn't packaged in nixpkgs, and as such we cannot inherit it from there.

I don't have the mental bandwidth to package this for nixpkgs, but feel free to cc me on a nixpkgs PR for a quick review.

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.

None yet

6 participants