Best of Planet PythonApril 2025

  1. 1
    Article
    Avatar of planetpythonPlanet Python·52w

    Top Python Code Quality Tools

    Improving Python code quality is crucial for developers seeking clean, efficient, and reliable code. This guide explores a variety of tools, including linters like Pylint and Flake8, type checkers like mypy, and formatters like Black, to enhance code readability and correctness. Security scanners such as Bandit and Safety ensure code safety, while tools like Coverage.py help maintain test coverage. Implementing these tools can enhance productivity and reduce errors in Python projects.

  2. 2
    Article
    Avatar of planetpythonPlanet Python·1y

    Stop Writing `__init__` Methods

    The post describes the shift away from using custom `__init__` methods in Python classes, recommending the use of dataclasses, classmethod factories, and precise typing to enforce object validity and simplify construction. These practices improve code maintainability, flexibility, and future-proofing against new requirements. The author suggests that leveraging dataclasses handles attribute assignment, while classmethod factories and typing.NewType ensure valid, easy-to-use objects without resorting to custom `__init__` methods.

  3. 3
    Article
    Avatar of planetpythonPlanet Python·1y

    Create your first app with Streamlit

    Learn the basics of Streamlit, an open-source Python library for building web apps for machine learning and data science. The guide covers installation, setting up a simple app, and adding interactive features like titles, headings, paragraphs, buttons, sliders, radio buttons, dropdown menus, and a sidebar. It concludes with creating a basic web app that filters the Iris dataset using sidebar controls.

  4. 4
    Article
    Avatar of planetpythonPlanet Python·52w

    From Backend to Frontend: Connecting FastAPI and Streamlit

    The post explains how to create a frontend using Streamlit for a FastAPI backend, providing an efficient, Python-based UI. It discusses the benefits of using Streamlit, offers guidance on making API calls, and covers setting up environment variables and CORS. The author also describes the deployment process using Streamlit Cloud and highlights the advantages of using Docker for development and deployment.

  5. 5
    Article
    Avatar of planetpythonPlanet Python·1y

    Matplotlib Practice Online: Free Exercises

    Explore a comprehensive set of Matplotlib exercises and practice using an online Matplotlib compiler. Learn how to analyze trends, build machine learning models, and explore datasets with various plot types such as bar charts, scatter plots, histograms, and more. The exercises include practical examples to help you understand and visualize data using Python, making it easier for you to focus on mastering data visualization.