Python environment management in LabThings config file
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
调研方向
The issue does not name implementation files or tests. Read the configuration format and how it maps each Thing to its class, then review how the project currently documents Python dependencies; the issue frames this as discussion and leaves the format and scope undecided. Done would require a decided approach for representing package requirements and generating a requirements.in file.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
A LabThings server is configured by a config file that specifies the class for each Thing. That depends on all of the relevant packages existing in the current Python environment, which isn't guaranteed.
Describe the solution you'd like
The LabThings config file could include the package name (which isn't always the same as the module name) for each Thing. It could even include a version and/or hash. LabThings would then be able to parse a config file and produce a requirements.in file that's able to be interpreted by pip or uv. Said file could then be compiled into a version-locked requirements.txt file (including package hashes) for a reproducible environment.
It will take a bit of thought to figure out a format that works without unnecessary duplication of information, especially when specifying software versions and thinking about version locking/pinning. It is also important to make sure we don't duplicate work that's already done much better by tools like pip, uv and so on. However, I think it could be pretty valuable if the config file is able to act as a single source of truth for the required Python environment.
I am not convinced we want to enter the murky waters of LabThings managing python environments directly. That feels like a big step up in software complexity. However, if it can play nicely with environment management tools (e.g. by generating a requirements.in) that might be very useful.
For example, the OpenFlexure management server could allow someone to configure the labthings config file, which in turn generates a requirements.in that allows it to ensure that the packages required for a given configuration are installed. Thinking that through, it might not play nicely with projects that substantially customise the LabThings server, because this creates a sort of chicken-and-egg problem (you'd need that package before you can load the config file...). I think it could still be useful, but exactly what takes priority would need careful thought. It would probably work better if server customisations could be fully specified through the config file, that's a sizeable change to how it's currently run though.
Describe alternatives you've considered
The obvious alternative is using the existing config file together with a requirements.in or requirements.txt file. There's something appealing to me about linking individual Things to packages rather than specifying the two independently.
Additional context
This issue is mostly me recording some thoughts from a conversation with a colleague at HTT, it's here to prompt discussion rather than immediate implementation.
- 主要语言
- Python
- 星标
- 10
- 派生
- 4
- 平均合并
- 4 天 15 小时
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
labthings/labthings-fastapi 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
labthings/labthings-fastapi#438 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
labthings/labthings-fastapi#435 ·
维护者通常 3 天内回复
-
Consider atomic JSON writes可能重新可做 @ashiishe2-oss 于 26 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
labthings/labthings-fastapi#412 · 3 条评论 ·
维护者通常 3 天内回复
-
drop-python-version
难度 2/5 1-3 小时 新手友好度 68/100
labthings/labthings-fastapi#354 · 2 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
labthings/labthings-fastapi#312 · 1 条评论 ·
维护者通常 3 天内回复
查看 labthings/labthings-fastapi 的全部 Issue
相似的 Issue
-
bug feature request
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 66/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
Qiskit/qiskit-obp#156 ·
-
action-item enhancement
难度 2/5 1-3 小时 新手友好度 88/100
getcommunityone/open-navigator#1658 ·
维护者通常 1 天内回复
-
review-panel severity:low
难度 2/5 1-3 小时 新手友好度 72/100
kristovatlas/coin-accounting#636 ·
维护者通常 1 天内回复