Client metadata - #907
Conversation
|
I'm not too keen on this. @antirotor I think your thoughts may weight well here. But Can't we store it in some dedicated grouped section in a pyproject? |
For me the issue with pyproject is that it is misleading as it looks like you can use it as standard pyproject.toml, but you can't.
We're using something that is known, for something else, because "it is known", but it is not the same. Just because we know that (and how it is used), we're ok-ish with that, but it is completely wrong. Especially for someone who tries to understand. Having pyproject.toml is shortcut leading to wrong assumptions.
What else would be in the pyproject.toml ? |
I would prefer that. You can use dependency groups for that - having the AYON dependencies defined as standard dependencies in main pyproject.toml and adding runtime dependencies via group. [project]
name = foo
# ...
dependencies = [
"PyYaml ~= 6"
]
[dependency-groups]
ayonRuntime = [
"pillow ~= 12"
]Reasons why this is better
Caveats Required changes |
| return None | ||
|
|
||
| try: | ||
| return json.load(open(client_json)) |
We also do expect that the dependencies are as dict key -> package, value -> version which is not how standard pyproject toml does define it. And again it still does not solve the issue that we're using pyproject.toml as something that is known but we don't use it that way, WHICH IS MISLEADING!!! |
|
Having one pyproject.toml in the repo root is standard. Defining dependencies in there is standard too. These dependencies are used by different tools (uv, poetry,...) so having ayon-dependencies-tool use them is IMO also standard. If we expect dependencies in some way that is not standard, I would argue that we should change what we expect :) Having AYON related stuff defined in pyproject.toml has even more advantages - what we do with |
|
Love your take on this @antirotor <3 ;) IMHO create_package is a poor man build backend and should totally be replaced by an actual build backend (hatch based plugins are not that complicated to implement...) |
That is different conversation, but at the end we don't need the pyproject toml in the final zip (on server), we just need what server actually needs in the zip, which is why this PR was created, to store what we need in |
|
WDYM by "root pyproject.toml"? Keep in mind that we already use pyproject.toml in the root in multiple repos for server related stuff. |
You can add something like this to the pyproject toml, does not affect the "standard" pyproject toml (at least that's how I understood it). The point is that you end up with Example how we could define it in the root pyproject toml: [ayon.dependencies]
requests="*"
[ayon.runtimeDependencies]
PIL="*" |
|
Maybe let's talk about how this is currently used - client.json is where you define dependencies for the addon. This gets uploaded to the server so when you want to create dependency package for the given addon bundle, you'll get them. ayon-dependencies-tool will take this, compile pyproject.toml from it and run On the client side, you often need to define the same dependencies twice now (in My point is to use just BTW Note If there is a need to separate server and client dependencies, we can still use dependency groups - they are there exactly for cases like that. |
This pyproject toml would be removed -> that is kinda the point of this PR to remove that.
Yes, because you want to define more dependencies for running from code which should not be defined in the dependencies for dependencies tool.
I'm not against, but we should not pass the full pyproject to server as server has NO IDEA what to do with it, and dependencies tool either. Also you might want to store more client related metadata in future, which might not be possible with toml. NOTE: We HAVE TO define the dependencies for dependencies tool in a different way I don't see how it would work if we would not do it in a different way. To change that we'd have to completelly rewrite how we handle dependencies -> TOTALY DIFFERENT CONVERSATION, please do not enter that here. I'm trying to improve what we have now, not what we want in 5 years, if we actually have some time to spend on it, I don't care about 5 years future that might not happen, I want to avoid current confusion. Remove Most of addons (90% of them) don't have pyproject.toml in root, that's why I don't think it has to be strictly in the root pyproject toml, because it just does not have to be there most of the time. Again this is current state, I'm not looking for "final solution" I'm looking for something that will not cause the confusion current pyproject toml is causing. The suggested approach allows any approach we'll decide to go with by using a middle man -> |
|
I don't want to argue more about this. Just few point and then I am out:
I would argue that you already have that information in
What different way? We are using
I won't reduce confusion that much, you are just replacing one file with another (pyproject with client which is IMO also confusing because it doesn't state what it is, also json doesn't support comments so using it for anything human editable isn't really good option), but the biggest confusion is that everyone expects to define dependencies in the main pyproject.toml
I would argue that not having pyproject.toml is actually antipattern on our side because even making small changes without properly configured linter is just wrong. Correct version of linter is dependency and as such it should be defined in pyproject.toml. Even with addon that are not python based (I am not aware of any) there must be at least a little bit of python to make addon from it and there are tons of successful hybrid projects that are cpp based and yet they still define pyproject.toml. I know you are not looking for "final solution" and I get why the 🫳🏻🎤 |
That's the point. When we ditch dependencies tool we can use pyproject toml. But NOW it is confusing.
Usually you want to be more strict about versions of dependencies for tests and examples, but for addon compatibility you usually have to be more variable, also you should not re-define dependencies that are already in launcher (like PySide6) or ayon-core (like Pillow). That's what is different. You also should not define python version, but pyproject toml does require it, we need dependencies in key: value, but standard pyproject toml does define it is list of strings. The whole The point is: It is different, it is not standard, I don't want to change anything except way how it is defined and how it is read by server. It will be always confusing, but having pyproject.toml in client dir causes a tons of confusion. Right now we can't get rid of poetry from the tomls and we can't use the standard dependencies definitions. So we're stuck in the middle of non-standard sh*t that does not represent anything from how it is in fact used. |
PR Checklist
client.json.Description of changes
Allow to define dependencies, and other possible client metadata with
client.jsoninstead ofpyproject.toml.This is a proposal. Right now we do allow to define dependencies using pyproject.toml, and we also do expect that the dependencies are defined with
tool.poetry.dependencies. That has multiple issues, we don't use poetry anymore, using pyproject.toml is misleading for developers and for IDEs as they try to define more 'pyproject.toml' metadata that either should not be defined or has no effect.Example change:
pyproject.toml
client.json
{ "dependencies": { "PyYaml": "^6" }, "runtimeDependencies": { "pillow": "^12" } }Technical details
The structure of the json is not validated -> thus defined, has to be added to documentation.
We also can't just change it and support both until all addons are changed.