Skip to content

Puts requirements in pyproject #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

purepani
Copy link
Contributor

@purepani purepani commented May 4, 2025

This just puts the requirements into pyproject statically, as opposed to dynamically defining them with setup tools.

@purepani purepani force-pushed the push-wsnmlyyvlunn branch from 4239004 to b81e358 Compare May 4, 2025 21:33
@purepani purepani force-pushed the push-wsnmlyyvlunn branch from b81e358 to 8fcceff Compare May 4, 2025 21:37
@purepani
Copy link
Contributor Author

purepani commented May 4, 2025

Ok it looks like I have to fix the CI to do this. This is definitely worth doing, but was a bit more effort than I was expecting

@FoamyGuy
Copy link
Contributor

FoamyGuy commented May 4, 2025

I don't think we would want to make this change to only a single repo. Ideally the actions config should stay in sync between all of the circuitpython library repos.

I don't necessarily think we would want to move the requirements into pyproject.toml either. I believe that some of the infrastructure utilities in use will expect that requirements.txt exist and contain the required libraries.

I'm not sure that I see the up side to moving them out of requirements.txt and needing these news actions requirements and steps. Can you say why this is approach is better than what we have currently in place, or what problem it's trying to solve to switch it?

@purepani
Copy link
Contributor Author

purepani commented May 5, 2025

I don't think we would want to make this change to only a single repo.
Yeah that's definitely true. If this were to be changed, it should be across all the libraries.

I didn't have a specific problem in this case, but in general static configurations are "better" as they're more in-line with modern python packaging. Tools will generally support the static configuration natively (for example something like adding a dependency through the cli, or exporting groups of dependencies in an export format like requirements.txt together).

This was definitely just a knee-jerk reaction to seeing that those were defined dynamically, and that my default position is "static definition through pyproject unless there's a good reason not to."

One problem I do have is I personally generally use uv for projects, and that doesn't support dynamic dependencies for venv creation. Granted, this is definitely a me problem, and is pretty easily solved in my case(and I do think supporting venv creation through uv with dynamic deps should be a uv feature), so I don't really consider this a circuit python problem per-se. However, it is an example of tools being better supported for static configurations. Also uv can install from a requirements.txt; it's just ever so slightly more annoying.

As you said, this should probably also just be done through the GitHub actions upstream.

I don't think it would be too hard to add this to the upstream actions and do change this incrementally across all the libraries as they have time to update, since it's pretty easy to export a requirements.txt file with pip for both optional and required dependencies.

TLDR: More tools are supported with static configs, so dynamic dependencies should usually be an escape hatch when needed, at least in my opinion. Probably not a big need to change it, but it's probably a good idea to do so. This should probably be done in a PR upstream.

@purepani
Copy link
Contributor Author

purepani commented May 5, 2025

To reply to this:

I'm not sure that I see the up side to moving them out of requirements.txt and needing these news actions requirements and steps.

I would argue that the tools should be updated to also support pyproject.toml dependencies, since that is standard, but certainly I don't know how much work it is to do that, and it certainly might not be worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants