Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#315: Some Stickers!

Published Tue, Dec 20, 2022, recorded Tue, Dec 20, 2022
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Michael #1: Jupyter Server 2.0 is released!

  • Jupyter Server provides the core web server that powers JupyterLab and Jupyter Notebook.
  • New Identity API: As Jupyter continues to innovate its real-time collaboration experience, identity is an important component.
  • New Authorization API: Enabling collaboration on a notebook shouldn’t mean “allow everyone with access to my Jupyter Server to edit my notebooks”. What if I want to share my notebook with e.g. a subset of my teammates?
  • New Event System API: jupyter_events—a package that provides a JSON-schema-based event-driven system to Jupyter Server and server extensions.
  • Terminals Service is now a Server Extension: Jupyter Server now ships the “Terminals Service” as an extension (installed and enabled by default) rather than a core Jupyter Service.
  • pytest-jupyter: A pytest plugin for Jupyter

Brian #2: Converting to pyproject.toml

  • Last week, episode 314, we talked about “Tools for rewriting Python code” and I mentioned a desire to convert setup.py/setup.cfg to pyproject.toml
  • Several of you, including Christian Clauss and Brian Skinn, let me know about a few tools to help in that area. Thank you.
  • ini2toml - Automatically translates .ini/.cfg files into TOML
    • “… can also be used to convert any compatible .ini/.cfg file to TOML.”
    • “ini2toml comes in two flavours: “lite” and “full”. The “lite” flavour will create a TOML document that does not contain any of the comments from the original .ini/.cfg file. On the other hand, the “full” flavour will make an extra effort to translate these comments into a TOML-equivalent (please notice sometimes this translation is not perfect, so it is always good to check the TOML document afterwards).”
  • pyproject-fmt - Apply a consistent format to pyproject.toml files
    • Having a consistent ordering and such is actually quite nice.
    • I agreed with most changes when I tried it, except one change.
      • The faulty change: it modified the name of my project. Not cool.
      • pytest plugins are traditionally named pytest-something.
        • the tool replaced the - with _. Wrong.
        • So, be careful with adding this to your tool chain if you have intentional dashes in the name.
      • Otherwise, and still, cool project.
  • validate-pyproject - Automated checks on pyproject.toml powered by JSON Schema definitions

    • It’s a bit terse with errors, but still useful.
          $ validate-pyproject pyproject.toml
          Invalid file: pyproject.toml
          [ERROR] `project.authors[{data__authors_x}]` must be object
      
          $ validate-pyproject pyproject.toml
          Invalid file: pyproject.toml
          [ERROR] Invalid value (at line 3, column 12)
      
  • I’d probably add tox

    • Don’t forget to build and test your project after making changes to pyproject.toml
    • You’ll catch things like missing dependencies that the other tools will miss.

Michael #3: aws-lambda-powertools-python

  • Via Mark Pender
  • A suite of utilities for AWS Lambda Functions that makes distributed tracing, structured logging, custom metrics, idempotency, and many leading practices easier
  • Looks kinda cool if you prefer to work almost entirely in python and avoid using any 3rd party tools like Terraform etc to manage the support functions of deploying, monitoring, debugging lambda functions - Tracing: Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
  • Logging - Structured logging made easier, and decorator to enrich structured logging with key Lambda context details
  • Metrics - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
  • Event handler: AppSync - AWS AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function
  • Event handler: API Gateway and ALB - Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration
  • Bring your own middleware - Decorator factory to create your own middleware to run logic before, and after each Lambda invocation
  • Parameters utility - Retrieve and cache parameter values from Parameter Store, Secrets Manager, or DynamoDB
  • Batch processing - Handle partial failures for AWS SQS batch processing
  • Typing - Static typing classes to speedup development in your IDE
  • Validation - JSON Schema validator for inbound events and responses
  • Event source data classes - Data classes describing the schema of common Lambda event triggers
  • Parser - Data parsing and deep validation using Pydantic
  • Idempotency - Convert your Lambda functions into idempotent operations which are safe to retry
  • Feature Flags - A simple rule engine to evaluate when one or multiple features should be enabled depending on the input
  • Streaming - Streams datasets larger than the available memory as streaming data.

Brian #4: How to create a self updating GitHub Readme

Extras

Brian:

Michael:

Joke: What are clouds made of?


Want to go deeper? Check our projects