r/learnpython • • 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 Upvotes

2 comments sorted by

1

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 1d ago

Instead of flake8 and black, personally I'd just use ruff. I would also suggest using uv to manage your dependencies (technically no changes needed, although I'd rename [project.optional-dependencies] into [dependency-groups] and either remove test/docs groups as unnecessary, or just include them in dev to reduce duplication). I would also strongly recommend using version ranges with your dependencies, and having a lockfile to keep versioning reproducible (uv automatically uses uv.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 use pytest.toml over the old pytest.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.