r/learnpython • u/nnt-3001 • 1d ago
Feedback on my python project
Hello everyone, I'm a computer science student working on a small project about k-medoid clustering algorithms called CLARANS and FastCLARANS. I've been developing this project for quite some time and would like the community to review it. Initially, I intended to submit it to the Journal of Open Source Software, but after careful consideration, I realized it wasn't quite suitable. You can find more information at this repository: https://github.com/ThienNguyen3001/scikit-clarans.git
What I'd like feedback on
- Is the code structure okay, or could it be improved
- Anything I may have gotten wrong
- What I could add next
Thanks for the feedbacks!
1
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 1d ago
Instead of
flake8andblack, personally I'd just useruff. I would also suggest usinguvto manage your dependencies (technically no changes needed, although I'd rename[project.optional-dependencies]into[dependency-groups]and either removetest/docsgroups as unnecessary, or just include them indevto reduce duplication). I would also strongly recommend using version ranges with your dependencies, and having a lockfile to keep versioning reproducible (uvautomatically usesuv.lock).Pytest's configuration can be in
pyproject.toml, unless you have a specific reason for keeping it separate. Even then, you could at least usepytest.tomlover the oldpytest.ini.I'd keep tests outside the main source code, in a separate top-level folder in the repository.
Why do most of your Python files start with underscores? And in
_clarans.py/_fast_clarans.py, all methods in their classes other than__init__also use a leading underscore. I don't see any reason to exclude all that from the "public" interface.