Python Bytes: #319 CSS-Style Queries for... JSON? :

Python Bytes: #319 CSS-Style Queries for... JSON?
blow post content copied from  Planet Python
click here to view original post

<a href='' style='font-weight: bold;'>Watch on YouTube</a><br> <br> <p><strong>About the show</strong></p> <p>Sponsored by <a href=""><strong>Microsoft for Startups Founders Hub</strong></a>.</p> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href=""><strong>@[email protected]</strong></a></li> <li>Brian: <a href=""><strong>@[email protected]</strong></a></li> <li>Show: <a href=""><strong>@[email protected]</strong></a></li> </ul> <p>Join us on YouTube at <a href=""><strong></strong></a> to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.</p> <p><strong>Michael #1:</strong> <a href=""><strong>Secure maintainer workflow</strong></a></p> <ul> <li>by <a href=""><strong>Ned Batchelder</strong></a></li> <li>We are the magicians, but also the gatekeepers for our users</li> <li>Terminal sessions with implicit access to credentials <ul> <li>first is unlikely: a bad guy gets onto my computer and uses the credentials to cause havoc</li> <li>second way is a more serious concern: I could unknowingly run evil or buggy code that uses my credentials in bad ways.</li> </ul></li> <li>Mitigations <ul> <li><strong>1Password:</strong> where possible, I store credentials in <a href="">1Password</a>, and use tooling to get them into environment variables. <ul> <li>Side bar: Do not use lastpass, see end segment</li> <li>I can have the credentials in the environment for just long enough to use them. This works well for things like PyPI credentials, which are used rarely and could cause significant damage.</li> </ul></li> <li><strong>Docker:</strong> To really isolate unknown code, I use a Docker container.</li> </ul></li> </ul> <p><strong>Brian #2:</strong> <strong>Tools for parsing HTML and JSON</strong></p> <ul> <li>Learned these from <a href="">A Year of Writing about Web Scraping in Review</a></li> <li><a href="">Parsel</a> - extract and remove data from HTML using XPath and CSS selectors</li> <li><a href="">jmespath</a> - “James Path” - declaratively specify how to extract elements from a JSON document</li> </ul> <p><strong>Michael #3:</strong> <a href=""><strong>git-sizer</strong></a></p> <ul> <li>Compute various size metrics for a Git repository, flagging those that might cause problems.</li> <li><p>Tip, partial clone: git clone <strong>--filter=blob:none</strong> URL</p> <pre><code> # Stats for # Full: git clone repo Receiving objects: 100% (118820/118820), 514.31 MiB | 28.83 MiB/s, done. Resolving deltas: 100% (71763/71763), done. Updating files: 100% (10792/10792), done. 1.01 GB on disk # Partial: git clone --filter=blob:none repo Receiving objects: 100% (10120/10120), 220.25 MiB | 24.92 MiB/s, done. Resolving deltas: 100% (1454/1454), done. Updating files: 100% (10792/10792), done. 694.4 MB on disk </code></pre></li> <li><p><a href="">Partial clone</a> is a performance optimization that “allows Git to function without having a complete copy of the repository. The goal of this work is to allow Git better handle extremely large repositories.” When changing branches, Git may download more missing files.</p></li> <li>Not the same as shallow clones or sparse checkouts <ul> <li>Consider shallow clones for CI/CD/deployment</li> <li>Sparse checkouts for a slice of a monorepo</li> </ul></li> </ul> <p><strong>Brian #4:</strong> <a href=""><strong>Dataclasses without type annotations</strong></a></p> <ul> <li>Probably file this under “don’t try this at home”. <ul> <li>Or maybe “try this at home, but not at work”.</li> <li>Or just “that Brian fella is a bad influence”. <ul> <li>What! It’s not me. It’s Adrian, the dude that wrote the article.</li> </ul></li> </ul></li> <li>Unless you’re using a type checker, for dataclasses, “… use any type you want. If you're not using a static type checker, no one is going to care what type you use.” <pre><code> @dataclass class Literally: anything: ("can go", "in here") as_long_as: lambda: "it can be evaluated" # Now, I've noticed a tendency for this program to get rather silly. hell: with_("from __future__ import annotations") it_s: not even.evaluated it: just.has(to=be) * syntactically[valid] # Right! Stop that! It's SILLY! </code></pre></li> </ul> <p><strong>Extras</strong> </p> <p>Michael:</p> <ul> <li><a href="">LastPass story</a> just keeps getting worse <ul> <li>We will see problems in supply chains because of this too</li> <li>A whole 2 hour discussion diving into what I touched on: <a href="> </ul></li> <li>Got your <a href="">new mac mini</a> yet? Or <a href="">MacBook Pro</a>?</li> </ul> <p><strong>Joke:</strong> <a href="">Developer/maker, what’s my purpose?</a></p>
January 18, 2023 at 01:30PM
Click here for more details...

The original post is available in Planet Python by
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.