astral-sh / packse

Python packaging scenarios
Apache License 2.0
105 stars 8 forks source link

Add scenario for .none extra #148

Closed 0v00 closed 1 month ago

0v00 commented 7 months ago

Added a .none scenario in extras.json, but running poetry run packse view scenarios/extras.json threw this PEP508 related error:

File at 'scenarios/extras.json' is not a valid scenario: Expected matching RIGHT_BRACKET for LEFT_BRACKET, after extras
    a[.none,extra_b]
     ~^ - at `$[8].root.requires[0]`.

Resolved this by making a small change to the __init__ method of the Requirement class to handle .none extras separately.

Closes https://github.com/astral-sh/uv/issues/1430

zanieb commented 7 months ago

Thank you for contributing!

This looks like it might be failing in hatchling now? Sorry this doesn't look like a great first issue since we're running into validation troubles. I've been thinking of ways to drop validation so we can publish things that are more broken... I might need to write a simple build backend.

0v00 commented 7 months ago

Thank you for contributing!

This looks like it might be failing in hatchling now? Sorry this doesn't look like a great first issue since we're running into validation troubles. I've been thinking of ways to drop validation so we can publish things that are more broken... I might need to write a simple build backend.

Forgot to re-run the build prior to the PR, sorry. And agreed, not sure there is a quick/small fix to work around the hatchling error.

zanieb commented 7 months ago

I'll try to take a look at it but it's a big task so it might take me a while to get to.

0v00 commented 7 months ago

I'll try to take a look at it but it's a big task so it might take me a while to get to.

All good. I might have found a workaround by adding some changes to build.py to avoid toml syntax errors (e.g. avoiding .none in the generated build/none-extra/.../pyproject.toml file - and I'm assuming the .none extra should not be in the generated toml) and to avoid later validation issues in hatchling. All checks passing so far. But I'm not sure if this approach is ideal, or if its worthwhile making these changes just to add an invalid extras scenario.