Skip to content

Conversation

@SnakeOilSalesman
Copy link

Would like to help to improve multiple unexpected in Python project moments.

This particular PR motivation:

  1. gitignore has some duplicates which is not dramatically bad in general but could be improved
  2. modern Python projects usually provide "tools" settings via pyproject.toml file
  3. uv.lock file could be added and used instead of outdated requriements.txt approach, which will be made in a following PR alongside with more complex changes
  4. setup.cfg file is empty and is obsolete. Since it is not used anywhere, it is safe to drop it
  5. better split main entry point into two modules: one where "app" instance is created and configured; and second where web-server is actually started. Such approach is more flexible. Uvicorn might be replaced in the future, approach with pydantic-settings parsing runner arguments might be avoided, etc.

@virrius
Copy link
Member

virrius commented Dec 10, 2025

I disagree with points:

  1. Renaming the app to _ doesnt seem necessary. Its a default FastAPI argument and, imo, should retain its original name
  2. Using uv.lock is too much because the full dependency list varies across user systems and could lead to compatibility issues. The dependencies listed in pyproject.toml along with a Docker setup as a working example should be enough
  3. Personally, I prefer having ruff.toml as a separate file, but either option is fine. it looks good if @EvilFreelancer is not opposed

@SnakeOilSalesman
Copy link
Author

  1. Single Underscore (_) is the most common and widely accepted convention to name an unused argument, which "app" clearly is in this function.
  2. Using lock files is the way to avoid compatibility issues. Do you expect this project to be installed and used as a library or as a stand-alone application? As of now, to me it looks more like the second option. If it is expected to be installed and used alongside other dependencies in a single environment, than it's not very clear to me what is the use case for the project. Please, provide more context.
  3. As of now the project using only basic set of ruff rules. I would highly recommend to start enabling them, since it is not only linter/formatter, but a performance and security checks as well. In addition to Ruff, highly suggested to start using mypy, pyrefly or ty for static type checking. Or even all of them, which is quite common these days. When you start adding configurations for all those tools, it will be a mess in a root directory. "pyproject.toml" was introduced to address the issue of Python projects requiring multiple configuration files for different development tools.

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

Successfully merging this pull request may close these issues.

2 participants