Skip to content
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

Update .pre-commit-config.yaml to use uv #108

Open
prrao87 opened this issue Oct 10, 2024 · 4 comments
Open

Update .pre-commit-config.yaml to use uv #108

prrao87 opened this issue Oct 10, 2024 · 4 comments
Assignees

Comments

@prrao87
Copy link
Member

prrao87 commented Oct 10, 2024

We should upgrade the .pre-commit-config.yaml in this repo to use uv so that we can run mypy prior to pushing changes. Something like the below:
https://github.com/smarlhens/python-boilerplate/blob/main/.pre-commit-config.yaml

@sanders41
Copy link
Collaborator

This one is going to be tricky and take some thinking I believe. The current issues aren't related to uv. I did a quick test locally and have issue related to python 3.13. My system python is set to 3.13 with pre-commit installed globally. pre-commit seems to be using the global version instead of the one from the virtual environment because my errors are python 3.13 related and the virual environment is 3.12. I'm not sure why this is because I'm working on another project right now with asyncpg and I'm having no problems with pre-commit (I'm using Python 3.12 on that project also).

For the error in CI it looks like it is no longer finding the pyproject.toml for the specific directory. I'm not sure what would have changed to make that happen.

@sanders41
Copy link
Collaborator

I haven't had a chance to test this yet, but I'm wondering if we update dependencies if it could fix at least some of the issues. Since 3.13 has been released there should be wheels available for at least some of them by now. It might not fix everything, but it seems like a good place to start

@prrao87
Copy link
Member Author

prrao87 commented Oct 14, 2024

I haven't had the time to test this yet either 🤣. I think you're right, Python 3.13 should be more or less stable to use. My problem is that the ML libraries I tend to use (Scipy, numpy, PyTorch, etc.) don't track newer versions of Python very well, so I normally wait a year or so till I upgrade Python versions, until these libraries catch up.

That being said, uv isn't running system Python, right? Is there a reason why we can't update the pre-commit to also use the uv-managed version of Python? In your case, say you installed Python 3.13 via uv: uv python install 3.13. Why isn't it possible to point the CI to that by installing the uv-managed Python via CI prior to running the pre-commit hook?

@sanders41
Copy link
Collaborator

I’m not using uv to manage my python, I still use pyenv because, at least so far, they add new versions faster. I have pre-commit installed with up tool install pre-commit at the system level which uses 3.13 for me. What is weird is pre-commit is using my system installed version rather than the one from the virtual environment in this project, the virtual environment is 3.12. This is the only repo I have where this happens and I’m not sure why.

For CI we are using pre-commit.ci to run the pre-commit hooks rather than GitHub Actions so uv won’t be involved with it at all.

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

No branches or pull requests

2 participants