The Real Python Podcast

Constructing Python Library APIs & Tackling Jinja Templating


Listen Later

What principles should you consider when designing a Python library? How do you construct a library API that’s understandable and easy to use? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.

We share an article about building library APIs. The piece provides advice for package structure, naming, error handling, and more. The author guides you toward Pythonic principles by comparing clunky vs elegant design examples.

Christopher discusses his recent video course on Jinja templating. The course covers creating text files with programmatic content and employing rich templates to structure the front end of Python web applications.

We cover several other articles and projects from the Python community, including several news updates, reasons why membership tests are fast for the range() function, CLI tools hidden in the Python standard library, a thread about the right way to install Python, recipes for using the Polars library, and a project for feature flags within Django.

This week’s episode is brought to you by Snyk.

Course Spotlight: Jinja Templating

With Jinja, you can build rich templates that power the front end of your web applications. But you can use Jinja without a web framework running in the background. Anytime you want to create text files with programmatic content, Jinja can help you out.

Topics:

  • 00:00:00 – Introduction
  • 00:02:16 – PyLadies Conference (Dec 2023) Call for Volunteers
  • 00:02:32 – PSF Board Election Results
  • 00:03:47 – PSF Announces New Security Developer in Residence
  • 00:04:39 – Django Security Releases Issued
  • 00:04:50 – Deprecation of bdist_egg Uploads to PyPI
  • 00:05:54 – Why Are Membership Tests So Fast for range() in Python?
  • 00:11:51 – CLI Tools Hidden in the Python Standard Library
  • 00:15:59 – Sponsor: Snyk
  • 00:16:49 – Designing Pythonic Library APIs
  • 00:28:27 – Jinja Templating
  • 00:32:49 – Kill a Developer in 4 Words or Less
  • 00:37:28 – Video Course Spotlight
  • 00:38:51 – What is “the right way” to install Python on a new M2 MacBook?
  • 00:44:11 – polars-cookbook: Recipes for Using Python’s Polars Library
  • 00:46:48 – waffle: Feature Flags for Django
  • 00:49:54 – Thanks and goodbye
  • News:

    • PyLadies Conference (Dec 2023) Call for Volunteers
    • PSF Board Election Results
    • PSF Announces New Security Developer in Residence
    • I Am the First PSF Security Developer-in-Residence – Seth was recently hired as the first security developer in residence at the PSF. His blog post talks about what his responsibilities are and how he defines success for the position.
    • Deputy CPython Developer in Residence - Python Software Foundation - Career Page
    • Django Security Releases Issued: 4.2.3, 4.1.10, and 3.2.20
    • Deprecation of bdist_egg Uploads to PyPIPEP 715 has been accepted and as of August 1, 2023, the .egg format will no longer be accepted as an upload. Existing eggs on PyPI will remain in place.
    • Show Links:

      • Why Are Membership Tests So Fast for range() in Python? – In Python, range() is most commonly used in for loops. However, ranges have some other use cases too, as they share many properties with lists. In this tutorial, you’ll explore why it’s so fast to perform a membership test on a Python range.
      • CLI Tools Hidden in the Python Standard Library – There are several modules in Python that are directly callable from the command line, including the ability to gzip and pretty-print JSON. This article introduces you to what options are available and how Simon discovered them.
      • Designing Pythonic Library APIs – This article summarizes principles that Ben has found useful when designing Python library APIs. Topics include structure, naming, error handling, and type annotations.
      • Jinja Templating – With Jinja, you can build rich templates that power the front end of your web applications. But you can use Jinja without a web framework running in the background. Anytime you want to create text files with programmatic content, Jinja can help you out.
      • Discussion:

        • Kill a Developer in 4 Words or Less - Twitter
        • What is “the right way” to install Python on a new M2 MacBook? - Twitter
        • Projects:

          • polars-cookbook: Recipes for Using Python’s Polars Library
          • waffle: Feature Flags for Django
          • Additional Links:

            • PSF Board of Directors Nominees - 2023 - YouTube
            • pandas-cookbook: Recipes for using Python’s pandas library
            • Level up your Python skills with our expert-led courses:

              • Getting Started With Django: Building a Portfolio App
              • Deploy Your Python Script on the Web With Flask
              • Jinja Templating
              • Support the podcast & join our community of Pythonistas

                ...more
                View all episodesView all episodes
                Download on the App Store

                The Real Python PodcastBy Real Python

                • 4.7
                • 4.7
                • 4.7
                • 4.7
                • 4.7

                4.7

                139 ratings


                More shows like The Real Python Podcast

                View all
                The Changelog: Software Development, Open Source by Changelog Media

                The Changelog: Software Development, Open Source

                288 Listeners

                Software Engineering Daily by Software Engineering Daily

                Software Engineering Daily

                625 Listeners

                Talk Python To Me by Michael Kennedy

                Talk Python To Me

                579 Listeners

                Soft Skills Engineering by Jamison Dance and Dave Smith

                Soft Skills Engineering

                289 Listeners

                Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

                Super Data Science: ML & AI Podcast with Jon Krohn

                303 Listeners

                Python Bytes by Michael Kennedy and Brian Okken

                Python Bytes

                213 Listeners

                Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

                Syntax - Tasty Web Development Treats

                988 Listeners

                Darknet Diaries by Jack Rhysider

                Darknet Diaries

                8,087 Listeners

                Tech Brew Ride Home by Morning Brew

                Tech Brew Ride Home

                967 Listeners

                Practical AI by Practical AI LLC

                Practical AI

                197 Listeners

                AWS Podcast by Amazon Web Services

                AWS Podcast

                207 Listeners

                Django Chat by William Vincent and Carlton Gibson

                Django Chat

                75 Listeners

                Last Week in AI by Skynet Today

                Last Week in AI

                311 Listeners

                Machine Learning Street Talk (MLST) by Machine Learning Street Talk (MLST)

                Machine Learning Street Talk (MLST)

                100 Listeners

                The Pragmatic Engineer by Gergely Orosz

                The Pragmatic Engineer

                70 Listeners