Day005 – Random posts under TIL

Topics

Best practices in Python

1. Best practices in Python
Read this article on Writing Python Scripts in modern way by Bryson Meiling and it is very insightful. In summary,

use pyproject.toml instead of requirements.txt.
Use uv for v…


This content originally appeared on DEV Community and was authored by sarvsav

Topics

  1. Best practices in Python

1. Best practices in Python
Read this article on Writing Python Scripts in modern way by Bryson Meiling and it is very insightful. In summary,

  1. use pyproject.toml instead of requirements.txt.
  2. Use uv for virtual environment.
  3. Use type hints.
  4. Add raises section to the docstrings.
  5. Use pydantic models.
  6. Use linter and formatter like Ruff.
  7. Use pytest.
  8. Use orjson instead of json.
  9. Always use fstring.
  10. Use pathlib instead of os.path.
  11. Use Typer instead of argparse.


This content originally appeared on DEV Community and was authored by sarvsav


Print Share Comment Cite Upload Translate Updates
APA

sarvsav | Sciencx (2024-10-18T21:14:01+00:00) Day005 – Random posts under TIL. Retrieved from https://www.scien.cx/2024/10/18/day005-random-posts-under-til/

MLA
" » Day005 – Random posts under TIL." sarvsav | Sciencx - Friday October 18, 2024, https://www.scien.cx/2024/10/18/day005-random-posts-under-til/
HARVARD
sarvsav | Sciencx Friday October 18, 2024 » Day005 – Random posts under TIL., viewed ,<https://www.scien.cx/2024/10/18/day005-random-posts-under-til/>
VANCOUVER
sarvsav | Sciencx - » Day005 – Random posts under TIL. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/18/day005-random-posts-under-til/
CHICAGO
" » Day005 – Random posts under TIL." sarvsav | Sciencx - Accessed . https://www.scien.cx/2024/10/18/day005-random-posts-under-til/
IEEE
" » Day005 – Random posts under TIL." sarvsav | Sciencx [Online]. Available: https://www.scien.cx/2024/10/18/day005-random-posts-under-til/. [Accessed: ]
rf:citation
» Day005 – Random posts under TIL | sarvsav | Sciencx | https://www.scien.cx/2024/10/18/day005-random-posts-under-til/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.