#222 Autocomplete with type annotations for AWS and boto3

38:21
 
Share
 

Manage episode 285826641 series 1305988
By Michael Kennedy and Brian Okken. Discovered by Player FM and our community — copyright is owned by the publisher, not Player FM, and audio is streamed directly from their servers. Hit the Subscribe button to track updates in Player FM, or paste the feed URL into other podcast apps.

Sponsored by Linode! pythonbytes.fm/linode

Special guest: Greg Herrera

YouTube live stream for viewers:

Watch on YouTube
Michael #1: boto type annotations

  • via Michael Lerner
  • boto3's services are created at runtime
  • IDEs aren't able to index its code in order to provide code completion or infer the type of these services or of the objects created by them.
  • Type systems cannot verify them
  • Even if it was able to do so, clients and service resources are created using a service agnostic factory method and are only identified by a string argument of that method.
  • boto3_type_annotations defines stand in classes for the clients, service resources, paginators, and waiters provided by boto3's services.

Example with “bare” boto3:

Example with annotated boto3:

Brian #2: How to have your code reviewer appreciate you

  • By Michael Lynch
  • Suggested by Miłosz Bednarzak
  • Actual title “How to Make Your Code Reviewer Fall in Love with You”
    • but 🤮
    • even has the words “your reviewer will literally fall in love with you.”
    • literally → figuratively, please
  • Topic is important though, here are some good tips:
    • Review your own code first
      • “Don’t just check for mistakes — imagine reading the code for the first time. What might confuse you?”
    • Write a clear change list description
    • “A good change list description explains what the change achieves, at a high level, and why you’re making this change.”
    • Narrowly scope changes
    • Separate functional and non-functional changes
    • This is tough, even for me, but important.
    • Need to fix something, and the formatting is a nightmare and you feel you must blacken it. Do those things in two separate merge requests.
    • Break up large change lists
    • A ton to write about. Maybe it deserves 2-3 merges instead of 1.
    • Respond graciously to critiques
    • It can feel like a personal attack, but hopefully it’s not.
    • Responding defensively will only make things works.

Greg #3: REPODASH - Quality Metrics for Github repositories

  • by Laurence Molloy
  • Do you maintain a project codebase on Github?
  • Would you like to be able to show the maturity of your project at a glance?
  • Walk through the metrics available
  • Use-case

Michael #4: Extra, extra, extra, extra, hear all about it

  • Python 3 Float Security Bug
  • Building Python 3 from source now :-/ It’s still Python 3.8.5 on Ubuntu with the kernel patch just today! (Linux 5.4.0-66 / Ubuntu 20.04.2)
  • Finally, I’m Dockering on my M1 mac via:
  • docker context create remotedocker --docker "host=ssh://user@server"
  • docker context use remotedocker
  • docker run -it ubuntu:latest bash now works as usual but remotely!

  • Why I keep complaining about merge thing on dependabot. Why!?! ;)

  • Anthony Shaw wrote a bot to help alleviate this a bit. More on that later.

Brian #5: testcontainers-python

  • Suggested by Josh Peak
  • Why mock a database? Spin up a live one in a docker container.
  • “Python port for testcontainers-java that allows using docker containers for functional and integration testing. Testcontainers-python provides capabilities to spin up docker containers (such as a database, Selenium web browser, or any other container) for testing.”
import sqlalchemy from testcontainers.mysql import MySqlContainer with MySqlContainer('mysql:5.7.32') as mysql: engine = sqlalchemy.create_engine(mysql.get_connection_url()) version, = engine.execute("select version()").fetchone() print(version) # 5.7.32 
  • The snippet above will spin up a MySql database in a container. The get_connection_url() convenience method returns a sqlalchemy compatible url we use to connect to the database and retrieve the database version.

Greg #6: The Python Ecosystem is relentlessly improving price-performance every day

  • Python is reaching top-of-mind for more and more business decision-makers because their technology teams are delivering solutions to the business with unprecedented price-performance.
  • The business impact keeps getting better and better.
  • What seems like heavy adoption throughout the economy is still a relatively small-inroad compared to what we’ll see in the future. It’s like water rapidly collecting behind a weak dam.
  • It’s an exciting time to be in the Python world!

Extras:

Brian:

  • Firefox 86 enhances cookie protection
    • sites can save cookies. but can’t share between sites.
    • Firefox maintains separate cookie storage for each site.
    • Momentary exceptions allowed for some non-tracking cross-site cookie uses, such as popular third party login providers.

Joke:

56 Funny Code Comments That People Actually Wrote: These are actually in a code base somewhere (a sampling):

 /* * Dear Maintainer * * Once you are done trying to ‘optimize’ this routine, * and you have realized what a terrible mistake that was, * please increment the following counter as a warning * to the next guy. * * total_hours_wasted_here = 73 */ 
 // sometimes I believe compiler ignores all my comments 
 // drunk, fix later 
 // Magic. Do not touch. 
 /*** Always returns true ***/ public boolean isAvailable() { return false; } 

229 episodes