Convert Figma logo to code with AI

realpython logopython-guide

Python best practices guidebook, written for humans.

28,174
5,818
28,174
119

Top Related Projects

An opinionated list of awesome Python frameworks, libraries, software and resources.

191,495

All Algorithms implemented in Python

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

63,003

The Python programming language

67,844

The Python micro framework for building web applications.

79,643

The Web framework for perfectionists with deadlines.

Quick Overview

The realpython/python-guide repository is a comprehensive guide to Python programming, covering best practices, tools, and resources for both beginners and experienced developers. It aims to provide a curated list of information to help Python programmers improve their skills and stay up-to-date with the latest trends in the Python ecosystem.

Pros

  • Extensive coverage of Python topics, from basics to advanced concepts
  • Regularly updated with community contributions
  • Well-organized and easy to navigate
  • Includes practical tips and real-world examples

Cons

  • May be overwhelming for absolute beginners due to the breadth of information
  • Some sections might become outdated if not maintained frequently
  • Lacks interactive elements or exercises for hands-on learning
  • Primarily text-based, which may not suit all learning styles

Getting Started

To access the Python Guide:

  1. Visit the GitHub repository: https://github.com/realpython/python-guide
  2. Browse the table of contents in the README.md file
  3. Click on specific topics or sections to explore the content
  4. For offline reading, clone the repository:
    git clone https://github.com/realpython/python-guide.git
    
  5. Contribute to the guide by submitting pull requests with improvements or additions

Note: This is not a code library, so there are no code examples or installation instructions. The guide is meant to be read and referenced for learning and best practices in Python programming.

Competitor Comparisons

An opinionated list of awesome Python frameworks, libraries, software and resources.

Pros of awesome-python

  • More comprehensive list of Python resources and libraries
  • Regularly updated with community contributions
  • Organized into clear categories for easy navigation

Cons of awesome-python

  • Less detailed explanations and tutorials
  • May be overwhelming for beginners due to the sheer volume of information

Code comparison

While both repositories primarily focus on curating Python resources rather than providing code examples, python-guide occasionally includes code snippets in its documentation. For example:

python-guide:

import requests
r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print(r.status_code)
print(r.headers['content-type'])

awesome-python doesn't typically include code snippets, instead focusing on linking to external resources.

Summary

python-guide is a more structured guide with in-depth explanations and occasional code examples, making it suitable for beginners and intermediate Python developers. awesome-python, on the other hand, serves as a comprehensive directory of Python resources, libraries, and tools, which can be particularly useful for experienced developers looking for specific solutions or exploring the Python ecosystem.

Both repositories have their merits, and developers may find value in using them in combination depending on their needs and experience level.

191,495

All Algorithms implemented in Python

Pros of Python

  • Extensive collection of algorithm implementations in Python
  • Well-organized structure with algorithms categorized by type
  • Active community with frequent contributions and updates

Cons of Python

  • Focuses solely on algorithms, lacking broader Python programming guidance
  • May not always follow best practices or optimal implementations
  • Limited explanations or documentation for some algorithms

Code Comparison

python-guide:

def application(env, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    return [b"Hello World"]

Python:

def binary_search(list, item):
    low = 0
    high = len(list) - 1
    while low <= high:
        mid = (low + high) // 2
        guess = list[mid]
        if guess == item:
            return mid
        if guess > item:
            high = mid - 1
        else:
            low = mid + 1
    return None

The python-guide repository provides a comprehensive guide to Python best practices, while Python focuses on algorithm implementations. python-guide offers broader Python knowledge, including setup, writing, and deployment. Python excels in providing a wide range of algorithm examples but may lack the depth of explanation found in python-guide.

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

Pros of system-design-primer

  • Comprehensive coverage of system design concepts and principles
  • Includes visual diagrams and illustrations for better understanding
  • Regularly updated with new content and examples

Cons of system-design-primer

  • Focuses primarily on system design, less emphasis on Python-specific topics
  • May be overwhelming for beginners due to its extensive content
  • Lacks hands-on coding exercises for practical implementation

Code comparison

system-design-primer:

# No specific Python code examples provided
# Focuses on system design concepts and architecture

python-guide:

import this

def hello_world():
    print("Hello, World!")

if __name__ == "__main__":
    hello_world()

Summary

system-design-primer is an excellent resource for learning about system design and architecture, with a focus on scalability and distributed systems. It provides comprehensive coverage of various topics but may be more suitable for intermediate to advanced developers.

python-guide, on the other hand, is a curated guide specifically for Python developers, covering best practices, tools, and resources. It offers a more hands-on approach to Python programming and is suitable for beginners and experienced developers alike.

Choose system-design-primer if you're interested in learning about large-scale system design, or python-guide if you want to improve your Python skills and follow best practices in Python development.

63,003

The Python programming language

Pros of cpython

  • Official Python implementation, providing the reference standard
  • Extensive codebase with detailed implementation of Python internals
  • Active development with frequent updates and bug fixes

Cons of cpython

  • Large and complex codebase, potentially overwhelming for beginners
  • Focused on implementation details rather than practical Python usage
  • Requires deeper understanding of C and Python internals

Code Comparison

cpython (Python implementation in C):

static PyObject *
unicode_split(PyObject *self, PyObject *args, PyObject *kwds)
{
    static char *kwlist[] = {"sep", "maxsplit", 0};
    PyObject *sep = Py_None;
    Py_ssize_t maxsplit = -1;
    // ... (implementation details)
}

python-guide (Python best practices):

def split_string(text, separator=None, max_splits=-1):
    """
    Split a string into a list of substrings.
    """
    return text.split(separator, max_splits)

The cpython example shows a low-level C implementation of string splitting, while python-guide demonstrates a high-level Python usage example. cpython focuses on the internal workings, whereas python-guide emphasizes practical Python programming.

67,844

The Python micro framework for building web applications.

Pros of Flask

  • Lightweight and flexible web framework, allowing for rapid development
  • Extensive documentation and large community support
  • Easy to integrate with various extensions and libraries

Cons of Flask

  • Less opinionated, requiring more setup for larger projects
  • Not as feature-rich out of the box compared to full-stack frameworks
  • May require additional configuration for production deployment

Code Comparison

Flask (app.py):

from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello, World!'

Python Guide (example.py):

def greet(name):
    return f"Hello, {name}!"

print(greet("World"))

The Flask code demonstrates a simple web application setup, while the Python Guide example shows a basic Python function. Flask is focused on web development, whereas the Python Guide covers general Python programming concepts.

Flask provides a more structured approach to building web applications, while the Python Guide offers broader Python knowledge and best practices. Flask is better suited for web developers, while the Python Guide caters to a wider range of Python programmers.

79,643

The Web framework for perfectionists with deadlines.

Pros of Django

  • Comprehensive web framework with built-in features for rapid development
  • Extensive documentation and large, active community support
  • Robust ORM for database interactions and migrations

Cons of Django

  • Steeper learning curve for beginners compared to simpler guides
  • More opinionated and less flexible for unconventional project structures
  • Heavier footprint, which may be overkill for small projects

Code Comparison

Django (models.py):

from django.db import models

class Article(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()
    pub_date = models.DateTimeField('date published')

Python Guide (example.py):

import datetime

class Article:
    def __init__(self, title, content):
        self.title = title
        self.content = content
        self.pub_date = datetime.datetime.now()

The Django code showcases its ORM capabilities, while the Python Guide example demonstrates a simpler, pure Python approach to creating a similar class structure. Django's code is more concise and includes built-in field types and validation, whereas the Python Guide example requires manual implementation of such features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Hitchhiker's Guide to Python

Python Best Practices Guidebook

→ Read the free guide at: docs.python-guide.org <https://docs.python-guide.org>_

.. image:: https://farm1.staticflickr.com/628/33173824932_58add34581_k_d.jpg


Work in progress. If you'd like to help, please do. There's a lot of work to be done.

This guide is currently under heavy development. This opinionated guide exists to provide both novice and expert Python developers a best practice handbook to the installation, configuration, and usage of Python on a daily basis.

Topics include:

  • Platform and version-specific installations
  • Py2app, Py2exe, bbfreeze, pyInstaller
  • Pip
  • Numpy, scipy, statpy, pyplot, matplotlib
  • Virtualenv
  • Fabric
  • Exhaustive module recommendations, grouped by topic/purpose
  • Which libraries to use for what
  • Server configurations & tools for various web frameworks
  • Documentation: writing it
  • Testing: Jenkins & tox guides
  • How to easily interface hg from git

If you aren't fond of reading reStructuredText, there is an almost up-to-date HTML version at docs.python-guide.org <https://docs.python-guide.org>_.