Use pyproject.toml
, pdm
and ruff
for improved reproducibility and cleaner code
#40
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.
@karpathy , thank you for another interesting educational project!
This MR introduces
pyproject.toml
file to handle project metadata and dependencies in accordance with PEP-6211.Using it with
pdm
2 and its lock files is more reliable than an unversioned dependency list stored inrequirements.txt
.It also adds a dev dependency for
ruff
3 linter and code formatter as well as the missing one forpytest
.All the simple issues discovered by
ruff
andmarkdownlint
4 are resolved.All the tests are still passing as the result of no semantic code changes have been done.
NB: One can also use
ruff
ornbQA
5 on Jupyter Notebooks.TODO: Add more Ruff rule sets like the one for type hints and resolve newly discovered issues.
Footnotes
PEP 621 – Storing project metadata in pyproject.toml. ↩
PDM is a modern Python package and dependency manager supporting the latest PEP standards. ↩
Ruff – An extremely fast Python linter and code formatter, written in Rust. ↩
markdownlint – Markdown linting and style checking for Visual Studio Code. ↩
nbQA – Run ruff, isort, pyupgrade, mypy, pylint, flake8, black, blacken-docs, and more on Jupyter Notebooks . ↩