Skip to content

Conversation

@konstin
Copy link
Member

@konstin konstin commented Aug 7, 2024

Currently, the entry for a package+version+source table is called distribution. That is incorrect, the sdist and wheel fields inside of that table are distributions, the table itself is for a package. We also align ourselves closer with PEP 751.

I went through lock.rs and renamed all occurrences of "distribution" that actually referred to a "package".

This change invalidates all existing lockfiles.

Bikeshedding: Do we call it package or packages? See also python/peps#3877

package is nice because it looks like a header:

[[package]]
name = "anyio"
version = "4.3.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "idna" },
    { name = "sniffio" },
]
sdist = { url = "https://files.pythonhosted.org/packages/db/4d/3970183622f0330d3c23d9b8a5f52e365e50381fd484d08e3285104333d3/anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6", size = 159642 }
wheels = [
    { url = "https://files.pythonhosted.org/packages/14/fd/2f20c40b45e4fb4324834aea24bd4afdf1143390242c0b33774da0e2e34f/anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8", size = 85584 },
]

packages is nice because the field is not a single entry, but a list.

2/3 for #4893

@konstin konstin added preview Experimental behavior lock Related to universal resolution and locking labels Aug 7, 2024
@zanieb
Copy link
Member

zanieb commented Aug 7, 2024

What's the migration story here? Are we just throwing an error or will we replace the lockfile?

@konstin
Copy link
Member Author

konstin commented Aug 7, 2024

Yeah

@zanieb
Copy link
Member

zanieb commented Aug 7, 2024

What?

@konstin
Copy link
Member Author

konstin commented Aug 7, 2024

Ah sorry i misread; we never error with invalid lockfiles, we ignore them and replace them. We could add an alias or something if we want to preserve previous preferences.

@zanieb
Copy link
Member

zanieb commented Aug 7, 2024

I think that's okay with me, thank you.

@charliermarsh
Copy link
Member

Can we add a basic test to verify that we don't error for an invalid lockfile?

@charliermarsh
Copy link
Member

Will add and merge.

@charliermarsh charliermarsh enabled auto-merge (squash) August 7, 2024 18:19
@charliermarsh charliermarsh disabled auto-merge August 7, 2024 18:19
konstin and others added 6 commits August 8, 2024 10:05
Currently, the entry for a package+version+source table is called `distribution`. That is incorrect, the `sdist` and `wheel` fields inside of that table are distribution, the table itself is for a package. We also align ourselves closer with PEP 751.

I went through `lock.rs` and renamed all occurrences of "distribution" that actually referred to a "package".

This change invalidates all existing lockfiles.

Bikeshedding: Do we call it `package` or `packages`? See also python/peps#3877

`package` is nice because it looks like a header:

```toml
[[package]]
name = "anyio"
version = "4.3.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "idna" },
    { name = "sniffio" },
]
sdist = { url = "https://files.pythonhosted.org/packages/db/4d/3970183622f0330d3c23d9b8a5f52e365e50381fd484d08e3285104333d3/anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6", size = 159642 }
wheels = [
    { url = "https://files.pythonhosted.org/packages/14/fd/2f20c40b45e4fb4324834aea24bd4afdf1143390242c0b33774da0e2e34f/anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8", size = 85584 },
]

`packages` is nice because the field is not a single entry, but a list.
@konstin konstin force-pushed the konsti/distribution-to-package branch from a1ec773 to d37099b Compare August 8, 2024 08:25
@konstin
Copy link
Member Author

konstin commented Aug 8, 2024

I've added an alias and confirmed that we read the previous lock as preferences

@charliermarsh
Copy link
Member

Cool. I think this is fine to merge as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lock Related to universal resolution and locking preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants