Successfully reported this slideshow.
Your SlideShare is downloading. ×

PyCon Italy 2022 - Automate cleaning code in few easy steps! - Ester Beltrami

Loading in …3
×

Check these out next

1 of 27 Ad
1 of 27 Ad

PyCon Italy 2022 - Automate cleaning code in few easy steps! - Ester Beltrami

Download to read offline

Have you ever been in the situation where you check the pipeline to see if it has finished and you discover it didn’t even start because you forgot to run formatters and linters locally? or when the code you’re reading isn’t formatted properly and you’re dying to stop doing everything you’re doing and fix it once for all this crap? There are wonderful tools out there to avoid this problem, that runs every commit or push so you don’t forget anymore! Learn how to configure them for your needs and more importantly learn why you need them now!!

Have you ever been in the situation where you check the pipeline to see if it has finished and you discover it didn’t even start because you forgot to run formatters and linters locally? or when the code you’re reading isn’t formatted properly and you’re dying to stop doing everything you’re doing and fix it once for all this crap? There are wonderful tools out there to avoid this problem, that runs every commit or push so you don’t forget anymore! Learn how to configure them for your needs and more importantly learn why you need them now!!

Advertisement
Advertisement

More Related Content

Advertisement

PyCon Italy 2022 - Automate cleaning code in few easy steps! - Ester Beltrami

  1. 1. Automate cleaning code in few easy steps! Ester Beltrami Twitter: @esterbeltrami GitHub: github.com/estyxx
  2. 2. Ester •PyCon Italia organizer •Strawberry-graphql core-dev •Poetry Package manager contributor
  3. 3. We write some code
  4. 4. We push the code
  5. 5. Time to relax and wait
  6. 6. We came back to the pipeline and…
  7. 7. pre-commit
  8. 8. .yaml file config
  9. 9. Some nice hooks to include! • pyupgrade to automatically upgrade syntax for newer versions • flake8-eradicate to find commented out (or so called "dead") code • autoflake to removes unused imports and unused variables
  10. 10. not only code quality, also security!
  11. 11. What are the benefits?
  12. 12. Identify issues *before* the code review
  13. 13. It’s not all about python…
  14. 14. Why developers don’t like it?
  15. 15. but they are slow L
  16. 16. From 1.8.0 ‘manual’ stage!
  17. 17. We still have to remember to pre- commit install but*
  18. 18. Run pre-commit on pipeline or use pre-commit.ci
  19. 19. Can we remove some Makefile commands maybe?
  20. 20. one ring tool to rule them all
  21. 21. What on Earth is a pyproject.toml? It’s the specified file format of PEP 518 which contains the build system requirements of Python projects. We can specify configuration data within the [tool] section!
  22. 22. Poetry Python packaging and dependency management made easy the new, standardized pyproject.toml. In other words, it replace setup.py, requirements.txt, setup.cfg, MANIFEST.in and Pipfile. Documentation: https://python- poetry.org/
  23. 23. How the pyproject.toml looks like
  24. 24. Poetry 1.2 is coming! Introduce the ability do group dependencies in groups! Not only the default `dev` one. And plugins to add your own functionality to Poetry!
  25. 25. Thank you!

×