-
Notifications
You must be signed in to change notification settings - Fork 1
Ruff and UV #15
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
adrzewiecki
wants to merge
27
commits into
iai-group:main
Choose a base branch
from
adrzewiecki:feature/astral
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ruff and UV #15
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modern tooling - created by Astral
Hi again, hope this is welcome!
I have thought to update the template for a while (years..) but finally got around to it. If the changes are welcome i can help to update the guidelines.
It would also be useful if some of you want to test it out, and let me know if you have any problems.
All rulesets are for you to decide, but this could be a starting point.
uv - Python package management, written in Rust
Note
I assume you are still using conda/miniconda.
Even though conda can be used as a python package manager, pip would generally be a better options. An even better option is
uv. It manages a lockfile, making it very easy to reproduce environments. Other tools like pipenv, poetry, pdm are also good options, but there is a reason that pdm itself adds support foruv.uvis impressively fast and it feels like they actually want python development to be better.Warning
It is important to note that
uvalso can manage environments, but they are not "mobile" in the same vain that conda environments are.UV and Conda - 101
UV should be work well with conda environments, create and activate the environment as usual.
How you install
uvis up to you, in the example below it is done by conda.Add a package to the
pyproject.tomlAdd a development package.
Update a package to the latest compatible version, based on the dependency tree.
Install all packages from the lockfile.
Note
If you want to install a package without changing the
pyproject.tomloruv.lock.uv pip install <package-name>Ruff - Linter and Formatter
Faster and better formatter and linter
Replaces
black,flake8,pydocstyleanddocformatter.These tools are built into ruff, making it very easy to enable and disable rules.
The configuration in this PR has enabled these rulesets:
I have ignored some rules that I have found to not be useful.
Pydocstyle config
Since we are using the
googledocstring style for pydocstyle the configuration looks a bit different then old pre-commit configuration.Google style
These rules are disabled by default with
googlestyle and are thus not set explicitly in the new configuration.