dckc / madmode-blog

my tinkering notebook (blog)
https://www.madmode.com
0 stars 2 forks source link

migrate dependencies from Pipfile to uv / pyproject #212

Open dckc opened 1 month ago

dckc commented 1 month ago

Discovered uv via lobste.rs discussion. Looks cool.

I'm not really pushing the envelope, so stuff like deployment to netlify just works with a Pipfile that I've been using at least as far back as 2019, thru a python 2.7 -> 3.x transition.

But sometimes I get a little concerned that my dependencies are a little fragile. Let's see how well uv handles them.

dckc commented 1 month ago

Kerflewey

Why the heck is hatch complaining? Did I ask to use hatch somehow?

$ uv run -- ./site serve
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: madmode-blog @ file:///home/connolly/projects/madmode-blog
  Caused by: Build backend failed to build wheel through `build_editable()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/build.py", line 83, in build_editable
    return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 155, in build
    artifact = version_api[version](directory, **build_data)
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 494, in build_editable
    return self.build_editable_detection(directory, **build_data)
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 505, in build_editable_detection
    for included_file in self.recurse_selected_project_files():
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 180, in recurse_selected_project_files
    if self.config.only_include:
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/config.py", line 806, in only_include
    only_include = only_include_config.get('only-include', self.default_only_include()) or self.packages
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 260, in default_only_include
    return self.default_file_selection_options.only_include
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/home/connolly/.cache/uv/builds-v0/.tmpRm3oOY/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 248, in default_file_selection_options
    raise ValueError(message)
ValueError: Unable to determine which files to ship inside the wheel using the following heuristics: https://hatch.pypa.io/latest/plugins/builder/wheel/#default-file-selection

The most likely cause of this is that there is no directory that matches the name of your project (madmode_blog).

At least one file selection option must be defined in the `tool.hatch.build.targets.wheel` table, see: https://hatch.pypa.io/latest/config/build/

As an example, if you intend to ship a directory named `foo` that resides within a `src` directory located at the root of your project, you can define the following:

[tool.hatch.build.targets.wheel]
packages = ["src/foo"]
---

for ref: 4fb8a09

dckc commented 1 month ago

vitual project still losing

Seems like progress, but...

$ uv run -- ./site serve
Traceback (most recent call last):
  File "/home/connolly/projects/madmode-blog/./site", line 20, in <module>
    from flaskext.markdown import Markdown
  File "/home/connolly/projects/madmode-blog/.venv/lib/python3.10/site-packages/flaskext/markdown.py", line 32, in <module>
    from flask import Markup
ImportError: cannot import name 'Markup' from 'flask' (/home/connolly/projects/madmode-blog/.venv/lib/python3.10/site-packages/flask/__init__.py)