# PEP 751: now with graphs!

**URL:** <https://discuss.python.org/t/pep-751-now-with-graphs/69721>\
**Category:** Standards\
**Created:** [October 30, 2024, 10:10pm UTC](https://discuss.python.org/t/pep-751-now-with-graphs/69721 "2024-10-30T22:10:37Z")\
**Posts on this page:** 1\
**Showing post:** 55

<div class="post-metadata">

**Author:** ![charliermarsh](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/charliermarsh/32/10246_2.png) [@charliermarsh](https://discuss.python.org/u/charliermarsh)\
**Post date:** [November 6, 2024, 9:49pm UTC](https://discuss.python.org/t/pep-751-now-with-graphs/69721/55 "2024-11-06T21:49:49Z")

</div>

> [@brettcannon](#):
>
> Could you provide the complete list?

For sure – the source is [here](https://github.com/astral-sh/uv/blob/273f453e75f70a906b29618ab98bafab4abc4b67/crates/uv-resolver/src/lock/mod.rs#L2418).

They are:

- `{ registry = "https://pypi.org/simple" }`
- `{ url = "https://example.org/foo-1.0.zip" }`
- `{ git = "https://github.com/agronholm/anyio?tag=4.6.2#c4844254e6db0cb804c240ba07405db73d810e0b" }`
- `{ path = "../library/foo-1.0.0-py3-none-any.whl" }` (a local distribution, like a `.whl` or `.tar.gz`)
- `{ editable = "../library" }` (an editable source tree)
- `{ directory = "../library" }` (a non-editable source tree)
- `{ virtual = "../library" }` (this one is the strangest, it means: install the project’s dependencies, but not the project itself)

The whole `editable` vs. `directory` vs. `virtual` thing is somewhat debatable but hopefully the intent is clear at least.

> [@brettcannon](#):
>
> How do you detect when the lock file will fail on a platform? In the last draft of the PEP I had that declared upfront, but there was some concerns on how easy it would be to amalgamate details into one and whether the details I was specifying made sense (e.g., I think listing supported wheels was a concern). And in this draft I list all requirements so you can tell when an edge goes to nowhere. But I’m trying to think if that strategy still works with this as you’re effectively simplifying the requirements down to just what to install without having to make any decisions at install time? I assume there’s a `marker`/`markers` key to make a requirement conditional. I guess having all the requirements could still work as the edges would still resolve to keys that don’t exist or lack a wheel for the platform. Or you could have requirements that are marked as unsupported and thus known to go nowhere.

I think there are two parts to this…

First, we typically lock for all platforms, so the graph is “complete”. In that case, we traverse the graph, and if we can’t find a compatible wheel or source distribution for a given package (or, e.g., we can’t find a wheel and source distributions are disabled), we error.

However, we also allow users to instruct us to only lock for a subset of environments via [`tool.uv.environments`](https://docs.astral.sh/uv/reference/settings/#environments). So they can say, “Only lock for macOS”:

```toml
[tool.uv]
# Resolve for macOS, but not for Linux or Windows.
environments = ["sys_platform == 'darwin'"]

```

(The environments listed in `tool.uv.environments` _must_ be disjoint.)

If `tool.uv.environments` is specified, we include that in the lockfile. And at install-time, we determine whether the current platform is compatible with any of the entries in `tool.uv.environments`.

---

_[View the full topic](https://discuss.python.org/t/pep-751-now-with-graphs/69721)._
