Podcast appearances and mentions of brett cannon

  • 23PODCASTS
  • 75EPISODES
  • 53mAVG DURATION
  • ?INFREQUENT EPISODES
  • Jan 3, 2025LATEST

POPULARITY

20172018201920202021202220232024


Best podcasts about brett cannon

Latest podcast episodes about brett cannon

Bass After Dark
How can you catch the largemouth of a lifetime in 2025? (ft. Butch Brown, Brett Cannon, and Drew Dutterer)

Bass After Dark

Play Episode Listen Later Jan 3, 2025 170:37


Bass After Dark — inch for inch and pound for pound, the best show in fishing — is back for another lively, and LIVE, episode. Don't miss Ken Duke, Brian the Carpenter, and our three mystery panelists (spoiler alert: it's Butch Brown, Drew Dutterer, and Brett Cannon) as we tackle the big question: How can you catch your fish of a lifetime in 2025? More Bass After Dark: YouTube: https://www.youtube.com/@BassAfterDark Apple Podcasts: https://podcasts.apple.com/us/podcast/bass-after-dark/id1716082782 Spotify: https://open.spotify.com/show/3yMvtb7iKPlblLxqlLbOmz Rumble: https://rumble.com/user/BassAfterDark Instagram: ⁠https://instagram.com/bassafterdarkshow⁠ Facebook: ⁠https://facebook.com/bassafterdark⁠ Stock media provided by Sounder_Music / Pond5 Stock media provided by lovemushroom / Pond5 Stock music provided by Sineius / Pond5

Python Bytes
#395 pythont compatible packages

Python Bytes

Play Episode Listen Later Aug 6, 2024 29:24


Topics covered in this episode: py-free-threading.github.io Python's Supportive and Welcoming Environment is Tightly Coupled to Its Progress Status pages for sites! PEP 751 – A file format to list Python dependencies for installation reproducibility Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: py-free-threading.github.io Track the status of compatibility for free-threaded Python See the Compatibility status tracking page for what you can use Lots of resources for getting your package tested and available for pythont Brian #2: Python's Supportive and Welcoming Environment is Tightly Coupled to Its Progress “Python is as popular as it is today because we have gone above and beyond to make this a welcoming community. Being a friendly and supportive community is part of how we are perceived by the wider world and is integral to the wide popularity of Python. We won a “Wonderfully Welcoming Award” last year at GitHub Universe. Over and over again, the tech press refers to Python as a supportive community.” Some communication recently, with the recent bylaws change, didn't live up to our promise to be welcoming Please read the article for more details. Another quote: “We have a moral imperative – as one of the very best places to bring new people into tech and into open source – to keep being good at welcoming new people. If we do not rise and continue to rise every day to this task, then we are not fulfilling our own mission, “to support and facilitate the growth of a diverse and international community of Python programmers.” Technical skills are a game-changer for the people who acquire them and joining a vast global network of people with similar interests opens many doors. Behavior that contributes to a hostile environment around Python or throws up barriers and obstacles to those who would join the Python community must be addressed because it endangers what we have built here.” Michael #3: Status pages for sites! Based on Uptime Kuma I covered last week Python Bytes status Talk Python status Brian #4: PEP 751 – A file format to list Python dependencies for installation reproducibility Brett Cannon Motivation Currently, no standard exists to: Specify what top-level dependencies should be installed into a Python environment. Create an immutable record, such as a lock file, of which dependencies were installed. Considering there are at least five well-known solutions to this problem in the community (pip freeze, pip-tools, uv, Poetry, and PDM), there seems to be an appetite for lock files in general. Rationale The format is designed so that a locker which produces the lock file and an installer which consumes the lock file can be separate tools. … The file format is designed to be human-readable. …Finally, the format is designed so that viewing a diff of the file is easy by centralizing relevant details. The file format is also designed to not require a resolver at install time. … Extras Brian: Hello, pytest! course is going well, and is purchasable as in pre-release mode. Planning on Aug 19 (or before) deadline. Not sure what the final price will be, but I'm starting with $10. I want people to want to watch it even just so see if they want to recommend to co-workers so the people around them can ramp up on pytest quickly. Michael: Mypy 1.11 Released FastHTML (more next week) Coming up on the final chance to be part of the Code in a Castle event. Joke: Open source OpenAI?

Python Bytes
#389 More OOP for Python?

Python Bytes

Play Episode Listen Later Jun 24, 2024 31:12


Topics covered in this episode: Solara UI Framework Coverage at a crossroads “Virtual” methods in Python classes Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: Solara UI Framework via Florian A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps Solara lets you build web apps from pure Python using ipywidgets or a React-like API on top of ipywidgets. These apps work both inside the Jupyter Notebook and as standalone web apps with frameworks like FastAPI. See the Examples page. Based on Reacton By building on top of ipywidgets, Solara automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more. Brian #2: Coverage at a crossroads Ned Batchelder is working on making coverage.py faster. Includes a nice, quick explanation of roughly how coverage.py works with trace function and arcs used for branch coverage. And how trace slows things down for lines we know are already covered. There are cool ideas from SlipCover that could be applicable. There's also sys.monitoring from Python 3.12 that helps with line coverage, since you can disable it for lines you already have info on. It doesn't quite complete the picture for branch coverage, though. Summary: jump in and help if you can read it anyway for a great mental model of how coverage.py works. Michael #3: “Virtual” methods in Python classes via Brian Skinn PEP 698 just got accepted, defining an @override decorator for type hinting, to help avoid errors in subclasses that override methods. Only affects type checkers but allows you to declare a “link” between the base method and derived class method with the intent of overriding it using OOP. If there is a mismatch, it's an error. Python 3.12's documentation Makes Python a bit more like C# and other more formal languages Brian #4: Parsing Python ASTs 20x Faster with Rust Evan Doyle Tach is “a CLI tool that lets you define and enforce import boundaries between Python modules in your project.” we covered it in episode 384 When used to analyze Sentry's ~3k Python file codebase, it took about 10 seconds. Profiling analysis using py-spy and speedscope pointed to a function that spends about 2/3 of the time parsing the AST, and about 1/3 traversing it. That portion was then rewritten in Rust, resulting in 10x speedup, ending in about 1 second. This is a cool example of not just throwing Rust at a speed problem right away, but doing the profiling homework first, and focusing the Rust rewrite on the bottleneck. Extras Brian: I brought up pkgutil.resolve_name() last week on episode 388 Brett Cannon says don't use that, it's deprecated Thanks astroboy for letting me know Will we get CalVer for Python? it was talked about at the language summit There's also pep 2026, in draft, with a nice nod in the number of when it might happen. 3.13 already in the works for 2024 3.14 slated for 2025, and we gotta have a pi release So the earliest is then 2026, with maybe a 3.26 version ? Saying thanks to open source maintainers Great write-up by Brett Cannon about how to show your appreciation for OSS maintainers. Be nice Be an advocate Produce your own open source Say thanks Fiscal support On topic Thanks Brett for pyproject.toml. I love it. Michael: The Shiny for Python course is out! Plus, it's free so come and get it. Joke: Tao of Programming: Book 1: Into the Silent Void, Part 1

Talk Python To Me - Python conversations for passionate developers

You've probably heard the term "syntactic sugar", that is, syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use. It turns out Brett Cannon has spent 2 years diving into and writing about Python's sweet language features and how they really work down inside CPython. He joins me on the show today to dive into a few of the more relevant posts he's written about it. Links from the show Brett Cannon: @brettcannon@fosstodon.org Syntactic sugar series: snarky.ca Syntactic sugar: wikipedia.org Unravelling attribute access in Python: snarky.ca Unravelling binary arithmetic operations: snarky.ca Unravelling the import statement: snarky.ca record-type: pypi.org Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy --- Episode sponsors --- Talk Python Training

Stray Casts Outdoor Cartoon Television Bass Fishing Talk Show
Into The Great Wide Opens - Ep.8 - Brett Cannon - 8/31/2023

Stray Casts Outdoor Cartoon Television Bass Fishing Talk Show

Play Episode Listen Later Aug 31, 2023 69:03


This is the August 31, 2023 episode of Into The Great Wide Opens.  Tonight, hosts Jamie Bruce and Brad Leuthner are joined by current Bassmaster EQ Angler Brett Cannon #fishing #bassnation #bassfishing #podcast 

opens wide brett cannon
Python Bytes
#348 JavaScript in Your Python

Python Bytes

Play Episode Listen Later Aug 15, 2023 33:14


Topics covered in this episode: Differentiating between writing down dependencies to use packages and for packages themselves PythonMonkey Quirks of Python package versioning bear-type Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Differentiating between writing down dependencies to use packages and for packages themselves Brett Cannon Why can't we just use pyproject.toml and stop using requirements.txt? Nope. At least not yet. They're currently for different things. pyproject.toml There's project.dependencies and project.optional-dependencies.tests that kinda would work for listing dependencies for an app. But you can't say pip install -r pyproject.toml. It doesn't work. And that's weird. project is intended for packaged projects. requirements.txt for applications and other non-packaged projects It has specific versions works great with pip What then? Either we stick with requirements.txt Or we invent some other file, maybe requirements.toml? Or maybe (Brian's comment), add something like [application] and application.dependencies and application.optional-dependencies.tests to pyproject.toml Michael #2: PythonMonkey PythonMonkey is a Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment. This product is in an early stage, approximately 80% to MVP as of July 2023. It is under active development by Distributive. External contributions and feedback are welcome and encouraged. It will enable JavaScript libraries to be used seamlessly in Python code and vice versa — without any significant performance penalties. Call Python packages like NumPy from within a JavaScript library, or use NPM packages like [crypto-js](https://www.npmjs.com/package/crypto-js) directly from Python. Executing WebAssembly modules in Python becomes trivial using the WebAssembly API and engine from SpiderMonkey. More details in Will Pringle's article. Brian #3: Quirks of Python package versioning Seth Larson Yes, we have SemVer, 1.2.3, and CalVer, 2023.6.1, and suffixes for pre-release, 1.2.3pre1. But it gets way more fun than that, if you get creative Here's a few v is an optional prefix, like v.1.0 You can include an “Epoch” and separate it from the version with a !, like 20!1.2.3 Local versions with alphanumerics, periods, dashes, underscores, like 1.0.0+ubuntu-1. PyPI rejects those. That's probably good. Long versions. There's no max length for a version number. How about 1.2.3.4000000000000000001? Pre, post, dev aren't mutually exclusive: 1.0.0-pre0-post0-dev0 More craziness in article - Michael #4: bear-type Beartype is an open-source PEP-compliant near-real-time pure-Python runtime type-checker emphasizing efficiency, usability, and thrilling puns. Annotate @beartype-decorated classes and callables with type hints. Call those callables with valid parameters: Transparent Call those callables with invalid parameters: Boom Traceback: raise exception_cls( beartype.roar.BeartypeCallHintParamViolation: @beartyped quote_wiggum() parameter lines=[b'Oh, my God! A horrible plane crash!', b'Hey, everybody! Get a load of thi...'] violates type hint list[str], as list item 0 value b'Oh, my God! A horrible plane crash!' not str. Extras Brian: Python Testing with Pytest Course Bundle: Limited Pre-Release Beta Use code PYTHONBYTES now through Aug 31for 20% discount (discount extended through the end of the month) What's a pre-release beta? There's a video. Check out the link. Error-tolerant pytest discovery in VSCode Finally! But you gotta turn it on. Also, I gotta talk to them about the proper non-capitalization of pytest. We're at RC1 for Python 3.12.0 Hard to believe it's that time of year again Michael: PyPI hires a Safety & Security Engineer, welcome Mike Fiedler PackagingCon October 26-28 Cloud Builders: Python Conf (born in Ukraine): September 6, 2023 | online Joke: Learning JavaScript

Python People
Brett Cannon - Core Python, Fountain Pens

Python People

Play Episode Listen Later Jul 26, 2023 66:28


Topics:“I don't know about the rest of you... I came for the language, but I stayed for the community." Brett Cannon, Python Core Dev, Pycon US 2014 Opening remarksPublic speakingBeing encouraging to othersWhy CanadaMeanings of Back Bacon, Toque, and PopWalking in VancouverSnowshoeingPhilosophy and thinking logicallyProving the existence of GodRewriting code. “You're probably going to have to write this 3 times before you're happy with it.”1 week per month on technical debt.Fountain pensWriting a gratitude journalBooks“What goes on in your brain is not the same as everyone else's.”"Steeped in the world of tea." - nice punLinks from the show:Podcast interviewsDjango Chat - 20 Years of Python - Brett CannonThe Changelog - There's a whole PEP about that - Brett CannonTim Urban's TED talk which is about procrastination and not public speaking, so I have no idea what Brett is talking about. Good talk though. Brett's PyCascades talk: Python's Syntactic SugarBrian's PyCascades talk: Sharing is Caring: Sharing pytest Fixtures The Complete pytest CourseLevel up your testing skills and save time during coding and maintenance.Check out courses.pythontest.com ★ Support this podcast on Patreon ★

sharing python pep toque steeped fountain pens brett cannon brian okken pycascades
The Changelog
There's a whole PEP about that

The Changelog

Play Episode Listen Later Jun 23, 2023 91:07


Brett Cannon (our unofficial ambassador to the Python community) is here to help alleviate our pip install anxiety. Along the way, we ask him about Python 4, removing the GIL, what he thinks about Chris Lattner's Mojo project, Rust in the Python world & way more (of course).

Changelog Master Feed
There's a whole PEP about that (Changelog & Friends #5)

Changelog Master Feed

Play Episode Listen Later Jun 23, 2023 91:07 Transcription Available


Brett Cannon (our unofficial ambassador to the Python community) is here to help alleviate our pip install anxiety. Along the way, we ask him about Python 4, removing the GIL, what he thinks about Chris Lattner's Mojo project, Rust in the Python world & way more (of course).

Python Bytes
#340 Snorkel not included

Python Bytes

Play Episode Listen Later Jun 13, 2023 31:09


Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Ask me anything episode: Submit your question(s) for our upcoming AMA episode: form here. Thank you! Brian #1: PythonGUIS Martin Fitzpatrick A site with a collection of resources, guides, books, comparisons, etc, around GUIs in Python. Martin recommends starting with PyQT6 However, there are tutorials covering PyQT6 PySide6 PyQT5 TkInter PySide even Kivy Michael #2: JupyterLab 4.0 is Here The next major release of our full-featured development environment You can upgrade by running pip install --upgrade jupyterlab or conda install -c conda-forge jupyterlab. JupyterLab is now faster, thanks to improvements such as CSS rules optimization, CodeMirror 6, MathJax 3, and notebook windowing. JupyterLab 3 was when working with large notebooks. There are additional performance improvements available via opt-in settings: Faster tab-switching on Chromium browsers: “Settings” → “JupyterLab Shell” → switch “Hidden mode” to “contentVisibility” Better performance with long notebooks: “Settings” → “Notebook” → switch “Windowing mode” to “full” An upgraded text editor. Better real time collaboration. Bug fixes. More than 100 bugs have been addressed and resolved, enhancing JupyterLab's stability and performance. Brian #3: Proposing a struct syntax for Python Brett Cannon This would be a cool syntax for a data only type: struct Point(x: int, y: int) No positional only parameters No inheritance No methods Instances would be immutable, so p = Point(1, 2) would create an object that could be used as a key. A data only focused set of types. Michael #4: Python 3.13 Removes 20 Stdlib Modules via PyCoders From PEP 594 – Removing dead batteries from the standard library we're saying goodbye to aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib As well as the 2to3 program and lib2to3 module in Python. Python 3.12 final release is scheduled in 4 months (October 2023) and Python 3.13 final release is scheduled in 1 year and 4 months (October 2024). Extras Brian: Affirming your PSF Membership voting status You have until June 15 to affirm your voting rights in the upcoming Board Election, if you care about such things. Michael: 5 Career Tips for Budding Python Developers video PyCon US 2023 videos are up Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available Joke: Snorkel not included

The Real Python Podcast
Virtual Environment Structure & Surveying the Packaging Ecosystem

The Real Python Podcast

Play Episode Listen Later May 12, 2023 69:27


How do Python virtual environments work under the hood? How does understanding these concepts help you with managing them for your projects? This week on the show, CPython core developer Brett Cannon returns to discuss his recent articles about virtual environments and the Python packaging landscape.

The Real Python Podcast
Targeting WebAssembly Platforms & Distilling a Minimum Viable Python

The Real Python Podcast

Play Episode Listen Later Apr 28, 2023 79:03


Are you familiar with the different versions of WebAssembly? Could WASM be the "write once, run everywhere" solution that developers have searched for? Where does distributing Python applications fit in the narrative? This week on the show, we have CPython core developer Brett Cannon to discuss his recent articles about WebAssembly and MVPy.

Django Chat
20 Years of Python - Brett Cannon

Django Chat

Play Episode Listen Later Apr 26, 2023 74:52


Brett's personal site @brettcannon on GitHub and Fosstodonpython-launchermicrovenvLLMs and the Business of Truth The Chinese Room ArgumentPEP 4 - Deprecation of Standard Modules Support the ShowThis podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter.

Test & Code - Python Testing & Development
197: Python project trove classifiers - Do you need this bit of pyproject.toml metadata?

Test & Code - Python Testing & Development

Play Episode Listen Later Apr 5, 2023 32:49


Classifiers are one bit of Python project metadata that predates PyPI. Classifiers are weird. They were around in setuptools days, and are still here with pyproject.toml. What are they? Why do we need them? Do we need them? Which classifiers should I include? Why are they called "trove classifiers" in the Python docs (https://pypi.org/classifiers/) Brett Cannon joins the show to discuss these wacky bits of metadata. Here's an example, from pytest-crayons (https://github.com/okken/pytest-crayons/blob/main/pyproject.toml): [project] ... classifiers = [ "License :: OSI Approved :: MIT License", "Framework :: Pytest" ] Special Guest: Brett Cannon.

Python Bytes
#328 We are going to need some context here

Python Bytes

Play Episode Listen Later Mar 21, 2023 24:48


Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: zipapp Part of standard library since 3.5 Yet another thing I learned recently from Brett Cannon “This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter. The module provides both a Command-Line Interface and a Python API.” Including: Creating Standalone Applications with zipapp Michael #2: Reverse engineering the Apple News app with #python and #nerd power As we navigate the digital world, we often come across articles we don't have time to read but still want to save for later. One way to accomplish this is by using the Read Later feature in Apple News. But what if you want to access those articles outside the Apple News app, such as on a different device or with someone who doesn't use Apple News? Or what if you want to automatically post links to those articles on your blog? That's where the nerd powers come in. The linked article shows how to use Python to solve your own problem Leading to Rhet Turnbull's CLI: apple-news-to-sqlite Brian #3: What is a context manager? Trey Hunner Also look at all the cool goodies in contextlib from standard library @contextmanager closing suppress redirect_stdout, redirect_stderr chdir Michael #4: nox-poetry: Use Poetry inside Nox sessions via 2 people: John Hagen and Marc Prewitt This package provides a drop-in replacement for the nox.session decorator, and for the nox.Session object passed to user-defined session functions. Comes from Claudio Jolowicz's hypermodern python cookiecutter Covered this on Talk Python: talkpython.fm/episodes/show/362/hypermodern-python-projects This session performs the following steps: Build a wheel from the local package. Install the wheel as well as the pytest package. Invoke pytest to run the test suite against the installation. Consider what would happen in this session if we had imported @session from nox instead of nox_poetry: Package dependencies would only be constrained by the wheel metadata, not by the lock file. In other words, their versions would not be pinned. The pytest dependency would not be constrained at all. Poetry would be installed as a build backend every time. Extras Brian: Sharing is Caring: Sharing pytest fixtures talk availabe at about 2:40:58 on Day 2 video of PyCascades 2023. Also full Day 1 and Day 2 Michael: Wired connection to remote mesh router == wow! Using the Linksys Atlas Max 6E Joke: UnsafeWarnings

Python Bytes
#327 Untangling XML with Pydantic

Python Bytes

Play Episode Listen Later Mar 13, 2023 31:37


Watch on YouTube About the show Sponsored by Compiler Podcast from Red Hat. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: pydantic-xml extension via Ilan Recall untangle. How about some pydantic in the mix? pydantic-xml is a pydantic extension providing model fields xml binding and xml serialization / deserialization. It is closely integrated with pydantic which means it supports most of its features. Brian #2: How virtual environments work Brett Cannon This should be required reading for anyone learning Python. Maybe right after “Hello World” and right before “My first pytest test”, approximately. Some history of environments Back in the day, there was global and your directory. How environments work structure: bin, include, and lib pyvenv.cfg configuration file How Python uses virtual environments What activation does, and that it's optional. Yes, activation is optional. A new project called microvenv that helps VS Code. Mostly to fix the “Debian doesn't ship python3 with venv” problem. It doesn't include script activation stuff It's super small, less than 100 lines of code, in one file. Michael #3: DbDeclare Declarative layer for your database. https://raaidarshad.github.io/dbdeclare/guide/controller/#example Sent in by creator raaid DbDeclare is a Python package that helps you create and manage entities in your database cluster, like databases, roles, access control, and (eventually) more. It aims to fill the gap between SQLAlchemy (SQLA) and infrastructure as code (IaC). You can: Declare desired state in Python Avoid maintaining raw SQL Tightly integrate your databases, roles, access control, and more with your tables Migrations like alembic coming too. Brian #4: Testing multiple Python versions with nox and pyenv Seth Michael Larson This is a cool “what to do first” with nox. Specifically, how to use it to run pytest against your project on multiple versions of Python. Example noxfile.py is super small import nox @nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) def test(session): session.install(".") session.install("-rdev-requirements.txt") session.run("pytest", "tests/") How to run everything, nox or nox -s test. How to run single sessions, nox -s test-311 for just Python 3.11 Also how to get this to work with pyenv. pyenv global 3.8 3.9 3.10 3.11 3.12-dev This reminds me that I keep meaning to write a workflow comparison post about nox and tox. Extras Michael: GitHub makes 2FA mandatory next week for active developers New adventure bike [image 1, image 2]. Who's got good ideas for where to ride in the PNW? Wondering why I got it, here's a fun video. Joke: Case of the Mondays

Python Bytes
#324 JSON in My DB?

Python Bytes

Play Episode Listen Later Feb 21, 2023 44:53


Watch on YouTube About the show Sponsored by Compiler Podcast from Red Hat. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Special guest, Erin Mullaney: @erinrachel@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Use TOML for .env files? Brett Cannon .env files are used to store default settings that can be overridden by environmental variables. Possibly brought on by twelve-factor app design. Supported by python-dotenv, which is also used by pydantic, pipenv, and others. One issue is that it's not a defined standard. from python-dotenv docs “The format is not formally specified and still improves over time. That being said, .env files should mostly look like Bash files.” Adafruit decided that an upcoming CircuitPython will use TOML as the format for settings.toml files, which are to be used mostly how .env files are being used. Brett notices this may fix things for Python for VS Code, and other people as well. So… Is this a good idea? I think so. Michael #2: Pydantic gets serious funding via Mark Little (was on episode 285) Sequoia backs open source data-validation framework Pydantic to commercialize with cloud services. Pydantic Services Inc. emerges from stealth today with $4.7 million in seed funding. Pydantic's new commercial entity will incorporate a swath of new tools and services that are both “powered-by and inspired-by the Pydantic library” Pydantic will start with an initial team of six, with the first three engineers based in Montana, Chicago and Berlin. “With $4.7 million in the bank, Colvin said that they're continuing to rewrite parts of Pydantic in Rust, with a view toward making it more efficient via a ten-fold performance improvement.” Erin #3: JSON Fields for performance (Denormalization) David Stokes Using JSON fields when you design your databases is a good way to improve database query performance. Brian #4: f-strings with pandas and Jupyter keyboard shortcuts Kevin Markham After a couple year break from blogging, friend of the show Kevin Markham has a couple great, short, useful posts. How to use Python's f-strings with pandas My favorite bit is the part about using f-strings for dictionary keys Fly through Jupyter with keyboard shortcuts

The Changelog
News: Load testing a $4 VPS, TOML for .env files, counting unique visitors sans cookies, the Arc browser & a love letter to Deno

The Changelog

Play Episode Listen Later Feb 13, 2023 9:27


Alice Girard Guittard finds out how much she could you really get out of a $4 VPS, Brett Cannon wonders if using TOML for .env files is a good idea, Nic Mulvaney details how they count unique visitors to a website without using cookies, UIDS, or fingerprinting, after a few months, Chris Coyier is still using the Arc browser & Alex Kladov pens a love letter to Deno.

Changelog News
Load testing a $4 VPS, TOML for .env files, counting unique visitors sans cookies, the Arc browser & a love letter to Deno

Changelog News

Play Episode Listen Later Feb 13, 2023 9:27 Transcription Available


Alice Girard Guittard finds out how much she could you really get out of a $4 VPS, Brett Cannon wonders if using TOML for .env files is a good idea, Nic Mulvaney details how they count unique visitors to a website without using cookies, UIDS, or fingerprinting, after a few months, Chris Coyier is still using the Arc browser & Alex Kladov pens a love letter to Deno.

Changelog Master Feed
Load testing a $4 VPS, TOML for .env files, counting unique visitors sans cookies, the Arc browser & a love letter to Deno (Changelog News #31)

Changelog Master Feed

Play Episode Listen Later Feb 13, 2023 9:27 Transcription Available


Alice Girard Guittard finds out how much she could you really get out of a $4 VPS, Brett Cannon wonders if using TOML for .env files is a good idea, Nic Mulvaney details how they count unique visitors to a website without using cookies, UIDS, or fingerprinting, after a few months, Chris Coyier is still using the Arc browser & Alex Kladov pens a love letter to Deno.

Python Bytes
#315 Some Stickers!

Python Bytes

Play Episode Listen Later Dec 20, 2022 29:56


Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org 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 Bob Belderbos Bob's GitHub profile is nice Includes latest Pybites articles, latest Python tips, and even latest Fosstodon toots And he includes a link to an article on how he did this. A Python script that pulls together all of the content, build-readme.py and fills in a TEMPLATE.md markdown file. It gets called through a GitHub action workflow, update.yml and automatically commits changes, currently daily at 8:45 This happens every day, and it looks like there are only commits if Note: We covered Simon Willison's notes on self updating README on episode 192 in 2020 Extras Brian: GitHub can check your repos for leaked secrets. Julia Evans has released a new zine, The Pocket Guide to Debugging Python Easter Eggs Includes this fun one from 2009 from Barry Warsaw and Brett Cannon >>> from __future__ import barry_as_FLUFL >>> 1 2 True >>> 1 != 2 File "[HTML_REMOVED]", line 1 1 != 2 ^ SyntaxError: invalid syntax Crontab Guru Michael: Canary Email AI 3.11 delivers First chance to try “iPad as the sole travel device.” Here's a report. Follow up from 306 and 309 discussions. Maps be free New laptop design Joke: What are clouds made of?

Python Bytes
#314 What are you, a wise guy? Sort it out!

Python Bytes

Play Episode Listen Later Dec 13, 2022 37:24


Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Brian #1: FAQtory Will McGugan “FAQtory is a tool to auto-generate a FAQ.md (Frequently Asked Questions) document for your project. FAQtory has a FAQ.md written by itself, so you can see an example of the project in the project. Builds a markdown FAQ.md that includes questions at the top that link to answers below. “Additionally, a ‘suggest' feature uses fuzzy matching to reply to GitHub issues with suggestions from your FAQ.” I haven't tried this part, but looking forward to it. May help to answer GH issues that are really questions. Michael #2: Kagi search "live with it” report Still enjoying it a lot Very fast LOVE blocking SEO-heavy, content-light sites Maps are rough around the edges Not obvious how to set as a private/incognito search engine (but can be done in settings) They have browser extensions - but I don't want to install extensions I only use 1password & zoom It could use some documentation however (e.g. supports !'s, but what are they?) Being tempted by Orion too, but sticking with Vivaldi. Brian #3: Tools for rewriting Python code Luke Plant A collection of tools change your code (hopefully for the better) Several categories formatting and coding style - black, isort, … upgrades - pyupgrade, flynt, … we need one to convert from setup.py/setup.cfg to pyproject.toml type hints - auto type hints? cool. maybe. I haven't tried any of these, but they look interesting refactoring, editors, rope, jedi other - autoflake, shed, … write your own, with LibCST Michael #4: Socketify Bringing WebSockets, Http/Https High Performance servers for PyPy3 and Python3 A new record for Python no other Web Framework as able to reach 6.2 mi requests per second before in @TFBenchmarks

Talk Python To Me - Python conversations for passionate developers

No Python announcement of 2022 was met with more fanfare than pyscript. This project, announced at PyCon 2022, allows you to write Python files and run them in your browser in place of JavaScript or even with interactions between Python and JavaScript. There was just one catch: The runtime download was a 9MB WebAssembly file. That made its uses quite limited. On this episode, we dive into some news that might change that calculus. The MicroPython and PyScript folks have been teaming up to get PyScript running in the browser on MicroPython. Yes, that's the embedded chip Python. Here's the good news: MicroPython's WebAssembly is just 300k to download and loads in under 100ms. Now that could unlock some possibilities. We have Brett Cannon, Nicholas Tollervey, and Fabio Pliger on the show to discuss. YOUTUBE: id=ABVn6uMG1OI Links from the show Guests and Host Links Brett Cannon: @brettcannon@fosstodon.org Nicholas Tollervey: @ntoll@mastodon.social Fabio Pliger: @b_smoke Michael Kennedy: @mkennedy@fosstodon.org Web Assembly: developer.mozilla.org pyodide: pyodide.org micropython: micropython.org Picture of TFT ESP32 Board: pythonbytes.fm pyscript: pyscript.net Simon Willison's Post About micropython + pyscript: fedi.simonwillison.net WASI: github.com Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy Sponsors AWS Insiders Local Maximum Podcast AssemblyAI Talk Python Training

The Prediction Trade
This Part-time (Profitable) Political Trader Shares His Midterm Bets (#62)

The Prediction Trade

Play Episode Listen Later Aug 18, 2022 32:11


How do you make six figures trading in prediction markets? SXSW's Brett Cannon knows, and in this episode of The Prediction Trade he shares the market bets he's currently making on PredictIt. From Marco Rubio's Senate race and Kamala Harris' tie-breaking Senate votes to whether Donald Trump will file for president before 2023, Brett shares his strategies across a variety of market topics. The Prediction Trade is brought to you by Luckbox magazine. Get a FREE digital subscription: getluckbox.com/TPT Sign up for the TPT newsletter, ask questions and follow us: thepredictiontrade.com Open your PredictIt account with our promo code and we'll match the first $20 you invest: predictit.org/promo/TPT20 Follow us… TWITTER: @predictiontrade FACEBOOK: @predictiontrade YOUTUBE: https://bit.ly/3LsdBeF TPT's theme song: Where Do We Go From Here? (Death)

The Changelog
Stand-up advice, Redis explained, big changes for Deno, DevDash & Minimum Viable Python

The Changelog

Play Episode Listen Later Aug 15, 2022 5:54 Transcription Available Very Popular


Lucas F. Costa on why your daily stand-ups don't work and host to fix them, Mahdi Yusuf deeply explains Redis, the Deno team announces some big changes coming, DevDash is a highly configurable terminal dashboard for developers and creators & Brett Cannon determines what is a Minimum Viable Python (MVPy).

Changelog News
Stand-up advice, Redis explained, big changes for Deno, DevDash & Minimum Viable Python

Changelog News

Play Episode Listen Later Aug 15, 2022 5:57 Transcription Available


Lucas F. Costa on why your daily stand-ups don't work and host to fix them, Mahdi Yusuf deeply explains Redis, the Deno team announces some big changes coming, DevDash is a highly configurable terminal dashboard for developers and creators & Brett Cannon determines what is a Minimum Viable Python (MVPy).

Changelog Master Feed
Stand-up advice, Redis explained, big changes for Deno, DevDash & Minimum Viable Python (The Changelog)

Changelog Master Feed

Play Episode Listen Later Aug 15, 2022 5:54 Transcription Available


Lucas F. Costa on why your daily stand-ups don't work and host to fix them, Mahdi Yusuf deeply explains Redis, the Deno team announces some big changes coming, DevDash is a highly configurable terminal dashboard for developers and creators & Brett Cannon determines what is a Minimum Viable Python (MVPy).

Talk Python To Me - Python conversations for passionate developers

Every year, the PSF and JetBrains team up to do a Python community survey. The most recent one was Fall of 2021. For this episode, I've gathered a great group of Python enthusiasts to discuss the results. I think you'll really enjoy the group discussion on this episode. Links from the show Guests Gina Häußge: @foosel Emily Morehouse-Valcarcel: @emilyemorehouse Tonya Sims: @TonyaSims Brett Cannon: @brettsky Jay Miller: @kjaymiller Paul Everitt: @paulweveritt 2021 Survey Results: jetbrains.com Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Twitter: @talkpython Follow Michael on Twitter: @mkennedy Sponsors Sentry Error Monitoring, Code TALKPYTHON RedHat AssemblyAI Talk Python Training

Talk Python To Me - Python conversations for passionate developers
#360: Removing Python's Dead Batteries (in just 5 years)

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Apr 8, 2022 80:03 Very Popular


Python has come a long way since it was released in 1991. It originally released when the Standard Library was primary the totality of functionality you could leverage when building your applications. With the addition of pip and the 368,000 packages on PyPI, it's a different world where what we need and expect from the Standard Library. Brett Cannon and Christian Heimes have introduced PEP 594 which is the first step in trimming outdated and unmaintained older modules from the Standard Library. Join us to dive into the history and future of Python's Standard Library. Links from the show Brett Cannon: @brettsky Christian Heimes: @ChristianHeimes PEP 594: peps.python.org PEP 594 deprecated modules: peps.python.org Python WebAssembly REPL: repl.ethanhs.me Pyodide: github.com JupyterLite: jupyterlite.readthedocs.io "How to run Python in the browser" - Katie Bell: youtube.com .NET's Blazor: dotnet.microsoft.com wasmtime: pypi.org Python 3.10.4 Release Notes: docs.python.org Watch this episode on YouTube: youtube.com --- Stay in touch with us --- Subscribe on YouTube: youtube.com Follow Talk Python on Twitter: @talkpython Follow Michael on Twitter: @mkennedy Sponsors Microsoft FusionAuth Talk Python Training

Python Bytes
#275 Airspeed velocity of an unladen astropy

Python Bytes

Play Episode Listen Later Mar 16, 2022 42:43


Watch the live stream: Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Special guest: Emily Morehouse-Valcarcel Michael #1: Async and await with subprocesses by Fredrik Averpil People know I do all sorts of stuff with async Lots of cool async things are not necessarily built into Python, but our instead third-party packages E.g. files via aiofiles But asyncio has asyncio.create_subprocess_exec Fredrik's article has some nice examples I started using this for mp3 uploads and behind the scenes processing for us Brian #2: Typesplainer Arian Mollik Wasi, @wasi_master Suggested by Will McGugan Now released a vscode extension for that! Available on vscode as typesplainer Emily #3: Ibis Project via Marlene Mhangami “Productivity-centric Python data analysis framework for SQL engines and Hadoop” focused on: Type safety Expressiveness Composability Familiarity Marlene wrote an excellent blog post as an introduction Works with tons of different backends, either directly or via compilation Depending on the backend, it actually uses SQLAlchemy under the hood There's a ton of options for interacting with a SQL database from Python, but Ibis has some interesting features geared towards performance and analyzing large sets of data. It's a great tool for simple projects, but an excellent tool for anything data science related since it plays so nicely with things like pandas Michael #4: ASV via Will McGugan AirSpeed Velocity (asv) is a tool for benchmarking Python packages over their lifetime. Runtime, memory consumption and even custom-computed values may be tracked. See quickstart Example of astropy here. Finding a commit that produces a large regression Brian #5: perflint Anthony Shaw pylint extension for performance anti patterns curious why a pylint extension and not a flake8 plugin. I think the normal advice of “beware premature optimization” is good advice. But also, having a linter show you some code habits you may have that just slow things down is a nice learning tool. Many of these items are also not going to be the big show stopper performance problems, but they add unnecessary performance hits. To use this, you also have to use pylint, and that can be a bit painful to start up with, as it's pretty picky. Tried it on a tutorial project today, and it complained about any variable, or parameter under 3 characters. Seems a bit picky to me for tutorials, but probably good advice for production code. These are all configurable though, so you can dial back the strictness if necessary. perflint checks: W8101 : Unnessecary list() on already iterable type W8102: Incorrect iterator method for dictionary W8201: Loop invariant statement (loop-invariant-statement) ←- very cool W8202: Global name usage in a loop (loop-invariant-global-usage) R8203 : Try..except blocks have a significant overhead. Avoid using them inside a loop (loop-try-except-usage). W8204 : Looped slicing of bytes objects is inefficient. Use a memoryview() instead (memoryview-over-bytes) W8205 : Importing the "%s" name directly is more efficient in this loop. (dotted-import-in-loop) Emily #6: PEP 594 Acceptance “Removing dead batteries from the standard library” Written by Christian Heimes and Brett Cannon back in 2019, though the conversation goes back further than that It's a very thin line for modules that might still be useful to someone versus the development effort needed to maintain them. Recently accepted, targeting Python 3.11 (final release planned for October 2022, development begins in May 2021. See the full release schedule) Deprecations will begin in 3.11 and modules won't be fully removed until 3.13 (~October 2024) See the full list of deprecated modules Bonus: new PEP site and theme! Extras Brian: Michael: Emily: Riff off of one of Brian's topics from last week: Automate your interactive rebases with fixups and auto-squashing Cool award that The PSF just received PSF Spring Fundraiser Cuttlesoft is hiring! Jokes: *Changing * (via Ruslan) Please hire me

Contributor
EdgeDB with Yury Selivanov

Contributor

Play Episode Listen Later Mar 16, 2022 45:27


Eric Anderson (@ericmander) has a conversation with Yury Selivanov (@1st1), the co-founder of EdgeDB. EdgeDB is the world's first “graph-relational database.” It's a term coined specifically for this new type of database, designed to ease the pain of dealing with the usual relational and NoSQL models. And no, EdgeDB is NOT a graph database! In this episode we discuss: A glitch at EdgeDB's Matrix-inspired launch event Origin of the term and design philosophy, “graph-relational” What to know about becoming a Python core developer How EdgeDB's next-gen query language compares to GraphQL and SQL Links: EdgeDB magicstack uvloop People mentioned: Elvis Pranskevichus (@elprans) Colin McDonnell (@colinhacks) Victor Petrovykh (Github: @vpetrovykh) Dan Abramov (@dan_abramov) Brett Cannon (@brettsky) Daniel Levine (@daniel_levine) Other episodes: Hasura with Tanmai Gopal Dgraph with Manish Jain

Python Podcast
FastAPI

Python Podcast

Play Episode Listen Later Feb 14, 2022 87:43


Dominik und Jochen unterhalten sich über FastAPI. FastAPI ist ein noch sehr junges, aber trotzdem recht verbreitetes Webframework für Python, das darauf ausgelegt ist, die moderneren Sprachfeatures von Python wie Typannotationen und Async-Fähigkeit besser zu nutzen als traditionellere Webframeworks wie Django oder Flask.     Shownotes Unsere E-Mail für Fragen, Anregungen & Kommentare: hallo@python-podcast.de News aus der Szene PEP 665 -- A file format to list Python dependencies for reproducibility of an application | Brett Cannon CPython on WASM At long last, Black is no longer a beta product! | Stability Policy Django wird jetzt auch wie in DEP 8 angekündigt mit black formatiert PyTest 7.0 release HATEOAS — An Alternative Explanation The future of editing in Wagtail Prototype Fund EdgeDB 1.0 Release | asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio | uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood. Twitter: My dental hygienist: "Are you flossing regularly?" Me: "Do you backup your laptop and photos regularly?" Laravel Livewire mit Christoph Rumpel | Alpine.Js | Caleb Porzio Werbung Exklusiv-Deal + ein Geschenk

Python Bytes
#269 Get Rich and replace your cat

Python Bytes

Play Episode Listen Later Feb 3, 2022 40:35


Watch the live stream: Watch on YouTube About the show Sponsored by Datadog: pythonbytes.fm/datadog Special guest: Luciana Brian #1:rich-cli suggested by Lance Reinsmith rich on the command line. why? syntax highlighting rich example.py rich -m README.md use -m for markdown why Will? .md seems clear enough to me. comes with themes. ex: --theme monokai formats json, --json or -j and a bunch of other features I probably won't use, but you might. alignment, maybe width, yeah, I'll probably use -w a bunch more In my .zshrc: alias cat='rich --theme monokai' after pipx install rich-cli feel free to tell me that I shouldn't used cat for looking at file contents. (although, why not?) I'm not, I'm using rich. :) Luciana #2: debugpy - a debugger for Python The debugger we use in the Python extension for VS Code Super heplful features that can save up a lot of time and a lot of folks don't seem to know about: Conditional breakpoints Helpful when you want the code to break only on a specific condition e.g. # of execution times, or when an expression is true Debug console Helpful for quick testing using the context of the program at the breakpoint Temp edits on variable values, expresison evaluation, etc. Jump to Cursor (a.k.a. Set Next Statement) Control on what is the next line the debugger will execute Including previously executed lines Brian #3: Documentation unit tests Simon Willison Post talking about using pytest and tests to check documentation. Simon has test code that introspects the code introspects the docs then makes sure some items are definitely in the docs This is used in Datasette, so you can look at the example in the repo What's tested: config options are all documented plugin hooks are documented views are all documented Cool use of parametrize to generate test cases based on introspection Nice use of fixtures Very cool idea Luciana #4: PEP 673 — Self Type Heard from Brett Cannon that it has been accepted! Interesting for me as I'm learning more about types in Python Adds a way to annotate methods that return an instance of their class Particularly interesting for subclasses, exemple they gave: from __future__ import annotations class Shape: def set_scale(self, scale: float) -> Shape: self.scale = scale return self class Circle(Shape): def set_radius(self, r: float) -> Circle: self.radius = r return self Circle().set_scale(0.5) # *Shape*, not Circle Circle().set_scale(0.5).set_radius(2.7) # => Error: Shape has no attribute set_radius Extras Luciana: Black is no longer in beta! Version 22.1.0 is out

Python Bytes
#268 Wait, you can Google that?

Python Bytes

Play Episode Listen Later Jan 27, 2022 45:09


Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian's book too! Brian #1: (draft) PEP 679 -- Allow parentheses in assert statements Pablo Galindo Salgado This is in draft, not approved, and not scheduled for any release But it seems like a really good idea to me. assert(1 == 2, "seems like it should fail") will always pass currently since the tuple (False,"seems like it should fail") is a non-empty tuple. Current Python will emit a warning >>> assert(1 == 2, "seems like it should fail") [stdin]:1: SyntaxWarning: assertion is always true, perhaps remove parentheses? But really, why not just change the language to allow assert with or without parens. Also would allow multi-line assert statements more easily: assert ( very very long expression, "very very long " "message", ) I hope this is a slam dunk and gets in ASAP. Michael #2: Everything I googled as a dev by Sophie Koonin In an attempt to dispel the idea that if you have to google stuff you're not a proper engineer, this is a list of nearly everything I googled in a week at work Rather than my posting a huge list, check out the day logs on her post Worth calling out a few: Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? - said React upgrade then started causing some super fun errors. semantic HTML contact details - wanted to check if the [HTML_REMOVED] tag was relevant here editing host file - desperate times (and it didn't even work) Madison #3: PyCascades 2022! Another year of excellent and diverse talks across an array of subjects. Talks from some well known folks (Thursday Bram, Jay Miller) as well as first time speakers (Joseph Riddle, Isaac Na) PSF's DE&I Panel is doing a meet & greet, and they have a survey they'd like Python community members to fill out. Socials Friday & Saturday night, sprints on Sunday. Tickets are still available! Brian #4: Strict Python function parameters Seth Michael Larson We have keyword only parameters def process_data(data, *, encoding="ascii"): ... notice the * encoding has to be a keyword argument, cannot be positional. We have position only parameters: def process_data(data, /, encoding="ascii"): ... notice the / data has to be positional, cannot be passed in as a keyword argument Combine the two: def process_data(data, /, *, encoding="ascii"): ... Now data has to be positional, and encoding has to be a keyword, if present. This way a function really can only be called as intended and all uses of the function will be consistent. This is a good thing. There are many benefits, including empowering library authors to make changes without weird behaviors cropping up in user code. Commentary: extra syntax may be confusing for some new users. For a lot of library API entry points, I think this makes a lot of sense. Michael #5: mureq - vendored requests mureq is a single-file, zero-dependency alternative to python-requests Intended to be vendored in-tree by Linux systems software and other lightweight applications. Doesn't support connection pooling (but neither does requests.get()). Uses much less memory Avoids supply chain attack vulnerabilities Consider my prod branch until PRs #2 and #3 are merged. Madison #6: Openverse No, not Metaverse! Previously “CC Search” Search engine for openly licensed media, for free and public use/remix of content. Currently images & audio, hope to include video, text, 3D models down the line. Start your search here Extras Michael: We now have playable times in the transcript section (example). Very cool tool for building regex-es I used for the above: regex101.com Next video is out: Do you even need loops in Python? A Python short by Michael Kennedy Remember, we have full-text search Brian: pip-secure-install - from Brett Cannon Python Testing with pytest is, when I last checked, the #2 bestseller at Pragmatic so cool My Maui trip was also a work trip. Gave me time to completely re-read the book, make notes, and make last minute changes. Changes went in this week and tonight is my “pencils down” date. This is getting real, folks. Thanks to everyone for buying beta copies and supporting the re-write. Madison: spd.watch - new police accountability/information tool for the Seattle area Shoutout to just (mentioned in Ep 242) ghcr.io - free docker image hosting for open source projects, easy integration with GitHub Actions Joke: via Josh Thurston How did the hacker get away from the police? He just ransomware. That joke makes me WannaCry… Where do you find a hacker? In decrypt.

Talk Python To Me - Python conversations for passionate developers
#350: Python Steering Council 2021 Retrospective

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Jan 26, 2022 70:18


For 30 years, Python was overseen by Guide van Rossum since he created and released it around in 1990. When he retired in 2018 he left the creation of the new governing body up to the core developers. After a few stressful months, they concept of the steering council became the way forward. On this episode, I welcome the outgoing steering council to give us a look back and how this past year has gone. We welcome Barry Warsaw, Carol Willing, Brett Cannon, Pablo Galindo Salgado, and Thomas Wouters to the show. They are going to give us a rundown on of the important decisions for 2021. Links from the show Guests / Steering Council Members: Barry Warsaw: @pumpichank Carol Willing: @WillingCarol Brett Cannon: @brettsky Pablo Galindo Salgado: @pyblogsal Thomas Wouters: github.com/Yhg1s Python Steering Council: python.org Meet the Python Developer in Residence: Lukasz Langa episode: talkpython.fm/331 @PSF joke thread: twitter.com Do you even need loops #PythonShort video: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe on YouTube: youtube.com Follow Talk Python on Twitter: @talkpython Follow Michael on Twitter: @mkennedy Sponsors Research Affiliates SignalWire Talk Python Training

The Real Python Podcast
Launching Python, Virtual Environments, and Locking Dependencies With Brett Cannon

The Real Python Podcast

Play Episode Listen Later Jan 14, 2022 50:42


Would you like a simple command to launch your Python programs using the newest version of the language installed on your machine? This week on the show, we continue our conversation with Brett Cannon. Brett discusses his project, the Python Launcher for Unix.

The Real Python Podcast
Continuing to Unravel Python's Syntatic Sugar With Brett Cannon

The Real Python Podcast

Play Episode Listen Later Jan 7, 2022 58:31


A year ago, we had Brett Cannon on the show to discuss his blog series about unravelling Python's syntactic sugar. Brett has written 15 more entries in the series, and he returns to the show this week to continue our conversation. We dive into unravelling 'async' and 'await' statements and their relationship with Python's generators.

Python Bytes
#264 We're just playing games with Jupyter at this point

Python Bytes

Play Episode Listen Later Dec 22, 2021 53:02


Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian's book too! Special guest: Kim van Wyk Michael #0: Take our survey: Should we try to shorten the episodes? Please fill out the 3 question Google Form here We'll be taking a break so see you in two weeks. Also feedback / rate us in your podcast player app Brian #1: Jupyter Games Thorsten Beier “Making their own tiny video games can be a great way for kids to learn programming in a playful matter.” For 2D physics-based games, Box2D, (written in C++), is a 2D rigid body simulation library One Python binding, pyb2d, is from Thorsten Game examples use Ipycanvas, Ipywidgets, and Ipyevents for a place to draw and input events. There are Box2D examples for physics simulations, like internal combustion and a wind tunnel. Game examples, with code, and not that much code billiards Angry Shapes (like Angry birds) World of Goo homage Rocket Color Mixing (it's oddly satisfying to play with, and it's like 73 lines of code, including blank lines and docstring) several more examples Demo games/examples in binder Being able to play with a game engine through Jupyter is kind of amazing. Cool teaching/learning tool. Michael #2: Canary Tokens First, what are canaries (from Thinkst)? These tokens might be useful for finding fallout of Log4Shell But also generally useful Kim #3: pywinauto and PyAutoGUI - libraries for programmatically controlling a GUI-based tool. These can be very handy for simplifying the use of complex GUIs with dozens of options you need to set every time you run them and also for automating GUI tooling as part of a pipeline. Brian #4: A reverse chronology of some Python features Brett Cannon Partly for people wishing for the “good old days” of some old version of Python Brett recommends going down the list and stopping at the first feature you can't live without. If you can't go very far, better not complain about language bloat. I had to stop at 3.10, since I really like the new error messages. Here's an abbreviated list of new features in different Python versions. (And I'm abbreviating it even more for the podcast) Python 3.10 Better error messages, Union operator for types, paraenthesized context managers, match statement (pattern matching) Brett notes that the match statement required a new parser for Python the new parser made better error messages possible so, you can't toss pattern matching without being willing to give up better error messages Python 3.9 dict support for | and |=, type hinting generics for built-in collections Python 3.8 f-string support for =, f``"``{val=}``", := walrus operator (assignment expressions) Python 3.7 dictionaries preserve insertion order, breakpoint() Python 3.6 f-strings, (need we say more) also underscores in numeric literals, async generators and comprehensions, preserving keyword argument order … goes back to 3.1 Michael #5: Hyperactive GCs and ORMs/ODMs Does Python do extremely too many GCs for ORMs? Hint: yes During the execution of that single query against SQLAlchemy, without adjusting Python's GC settings, we get an extreme number of GC collections (1,859 GCs for a single SQLAlchemy query of 20k records). Our fix at Talk Python has been to increase the number of surviving allocations required to force a GC from 700 to 50,000. What can be done to improve this? Maybe someday Python will have an adaptive GC where if it runs a collection and finds zero cycles it backs off and if it starts finding more cycles it ramps up or something like that. For now, test adjusting the thresholds Here are a few presentations / resources: Michael's presentation at Python Web Conf 2021 Talk Python Memory Deep Dive course allocations, gen1, gen2 = gc.get_threshold() # GC every 50K not 700 surviving container allocations. allocations = 50_000 gc.set_threshold(allocations, gen1, gen2) Kim #6: DockerSlim- A tool to reduce the size and improve the security of Docker images. I've used it a little and got some 1Gb Ubuntu-based images down to 50Mb and that was barely scratching the surface. Extras Michael: Emojis for comments Kim: python -m http.server - a small reminder to people that this is a quick way to get files off a Python-equipped system by standing up a simple web server. Mess with DNS - Julia Evans released this really impressive learning tool last week to let people explore DNS settings without breaking real sites. Magit - a slightly tongue-in-cheek addition to last week's discussion on git via both CLI and by mashing buttons in VS Code. Anyone using emacs should strongly consider magit for git - I've kept emacs open even while trying to use other editors because I find magit so indispensable. I've included these just as small items off the top of my head that may or may not be worth a mention. Joke: We use cookies candle (and I don't care about cookies extension) Little Bobby Jindi And more Log4Shell memes

Python Bytes
#257 Python Launcher - Launching Python Everywhere

Python Bytes

Play Episode Listen Later Nov 4, 2021 40:25


Watch the live stream: Watch on YouTube About the show Sponsored by Shortcut Special guest: Morleh So-kargbo Michael #1: Django 4.0 beta 1 released Django 4.0 beta 1 is now available. Django 4.0 has an abundance of new features The new *expressions positional argument of UniqueConstraint() enables creating functional unique constraints on expressions and database functions. The new scrypt password hasher is more secure and recommended over PBKDF2. The new django.core.cache.backends.redis.RedisCache cache backend provides built-in support for caching with Redis. To enhance customization of Forms, Formsets, and ErrorList they are now rendered using the template engine. Brian #2: py - The Python launcher py has been bundled with Python for Windows only since Python 3.3, as py.exe See Python Launcher for Windows I've mostly ignored it since I use Python on Windows, MacOS, and Linux and don't want to have different workflows on different systems. But now Brett Cannon has developed python-launcher which brings py to MacOS and various other Unix-y systems or any OS which supports Rust. Now py is everywhere I need it to be, and I've switched my workflow to use it. Usage py : Run the latest Python version on your system py -3 : Run the latest Python 3 version py -3.9 : Run latest 3.9 version py -2.7 : Even run 2.x versions py --``list : list all versions (with py-launcher, it also lists paths) py --``list-paths : py.exe only - list all versions with path Why is this cool? - I never have to care where Python is installed or where it is in my search path. - I can always run any version of Python installed without setting up symbolic links. - Same workflow works on Windows, MacOS, and Linux Old workfow Make sure latest Python is found first in search path, then call python3 -m venv venv For a specific version, make sure python3.8, for example, or python38 or something is in my Path. If not, create it somewhere. New workflow. py -m venv venv - Create a virtual environment with the latest Python installed. After activation, everything happens in the virtual env. Create a specific venv to test something on an older version: py -3.8 venv venv --``prompt '``3.8``' Or even just run a script with an old version py -3.8 script_name.py Of course, you can run it with the latest version also py script_name.py Note: if you use py within a virtual environment, the default version is the one from the virtual env, not the latest. Morleh #3: Transformers As General-Purpose Architecture The Attention Is All You Need paper first proposed Transformers in June 2017. The Hugging Face (

Python Bytes
#252 Jupyter is now a desktop app!

Python Bytes

Play Episode Listen Later Sep 29, 2021 44:25


Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian's book too! Special guest: Ethan Swan Michael #0: Changing themes to DIY Brian #1: SQLFluff Suggested by Dave Kotchessa. A SQL Linter, written in Python, tested with pytest Configurable, and configuration can live in many places including tox.ini and pyproject.toml. Great docs Rule reference with anti-pattern/best practice format Includes dialects for ANSI, PostgreSQL, MySQL, Teradata, BigQuery, Snoflake Note in docs: “SQLFluff is still in an open alpha phase - expect the tool to change significantly over the coming months, and expect potentially non-backward compatible api changes to happen at any point.” Michael #2: JupyterLab Desktop JupyterLab App is the cross-platform standalone application distribution of JupyterLab. Bundles a Python environment with several popular Python libraries ready to use in scientific computing and data science workflows. JupyterLab App works on Debian and Fedora based Linux, macOS and Windows operating systems. Ethan #3: Requests Cache Create a requests_cache session and call HTTP methods from there You can also do it without a session but that's a bit weird, looks like it's monkey patching requests or something… Results are cached Very handy for repeatedly calling endpoints especially if the returned data is large, or the server has to do some compute Reminds me of @functools.lru_cache Can set things like how long the cache should last (when to invalidate) Funny easter egg in example: “# Cache 400 responses as a solemn reminder of your failures” Brian #4: pypi-rename This is a cookiecutter template from Simon Willison Backstory: To refresh my memory on how to publish a new package with flit I created a new pytest plugin. Brian Skinn noticed it somehow, and suggested a better name. Thanks Brian. So, how to nicely rename. I searched and found Simon's template, which is… A cookiecutter template. So you can use cookiecutter to do some of this work for you. But it's based on setuptools, and I kinda like flit lately, so I just used the instructions. The README.md includes instructions for the steps needed: Create renamed version Publish under new name Change old one to depend on new one, but be mostly empty Modify readme to tell people what's going on Publish old name as a notice Now people looking for old one will find new one. People just installing old one will end up with new one also since it's a dependency. Michael #5: Django 4 coming with Redis Adapter #33012 closed New feature (fixed) → Add a Redis cache backend. Adds support for Redis to be used as a caching backend with Django. Redis is the most popular caching backend, adding it to django.core.cache module would be a great addition for developers who previously had to rely on the use of third party packages. It will be simpler than that provided by django-redis, for instance customising the serialiser is out-of-scope for the initial pass. Ethan #6: PEP 612 It wasn't possible to type a function that took in a function and returned a function with the same signature (which is what many decorators do) This creates a ParamSpec – which is much like a TypeVar, for anyone who has used them to type generic functions/classes It's a reminder that typing is still missing features and evolving, and it's good to accept the edge cases for now – “gradual typing” Reading Fluent Python by Ramalho has influenced my view on this – don't lose your mind trying to type crazy stuff, just accept that it's “gradual” Mention how typing is still evolving in Python and it's good to keep an eye out for new features that help you (see also PEP 645 – using int? for Optional[int]; and PEP 655 – annotating some TypedDict keys as required and others not required) Extras Michael Earsketch Django Critical CVE: CVE-2021-35042 Vulnerable versions: >= 3.0.0, < 3.1.13 Patched version: 3.1.13 Django 3.1.x before 3.1.13 and 3.2.x before 3.2.5 allows QuerySet.order_by SQL injection if order_by is untrusted input from a client of a web application. Ethan Pedalboard I happened upon this project recently and checked back, only to see that Brett Cannon was the last committer! A doc fix, like he suggested last episode Brian Zero Cost Exceptions in Python 3.11 Suggested by John Hagen Guido, Mark Shannon, and others at Microsoft are working on speeding up Python faster-cpython/ideas repo includes a slide deck from Guido which includes “Zero overhead” exception handling. Python 3.11 “What's New” page, Optimizations section includes: “Zero-cost” exceptions are implemented. The cost of try statements is almost eliminated when no exception is raised. (Contributed by Mark Shannon in bpo-40222.) MK: I played with this a bit. Joke: QA 101

Python Bytes
#251 A 95% complete episode (wait for it)

Python Bytes

Play Episode Listen Later Sep 22, 2021 55:33


Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian's book too! Special guest: Brett Cannon Michael #1: auto-optional by Daan Luttik Did you know that concrete types cannot be None in Python typing? This is wrong: def do_a_thing(extra_info: str = None): ... auto-optional will fix it: def do_a_thing(extra_info: Optional[str] = None): ... Why would you want this? Easily modify external libraries that didn't pay attention to proper use of optional to improve mypy linting. Force consistency in your own code-base: Enforcing that None parameter implies an Optional type. Run via the CLI: auto-optional [path] Brian #2: Making World-Class Docs Takes Effort Daniel Stenberg Six requirements for a project to get a gold star docs in the code repo NOT extracted from the code examples, lots of examples, more than you think you need document every API call you provide easily accessible and browsable and hopefully offline readable as well easy to contribute to Non-stop iterating is key to having good docs. extra goodness consistency for section titles cross-references I'd add Check for grammar and spelling mistakes Consistency in all things, formatting, style, tone, depth of info of diff topics Don't be afraid to have a personality. docs that include easter eggs, fun examples, tasteful jokes, etc are nice, as long as that fun stuff doesn't complicate the docs. Don't slam projects for having bad docs. Not all open source projects exist for your benefit. You can make them better by contributing. :) Brett #3: Starship Continuing the trend of stuff to help make your coding better, Python or not.

Changelog Master Feed
Tenet with heavy spoilers (Backstage #18)

Changelog Master Feed

Play Episode Listen Later Aug 27, 2021 81:13 Transcription Available


After months of talking about and planning this episode, we decided near the very end to invite Paul from Heavy Spoilers to join us for a deep, spoiler filled, discussion on the movie Tenet, which was directed by Christopher Nolan and released September 2020. If you're a fan of Tenet, you'll love this episode. Warning: This episode literally includes heavy spoilers. So come back after you've watched the film, or proceed if that doesn't bother you.

Python Bytes
#243 Django unicorns and multi-region PostgreSQL

Python Bytes

Play Episode Listen Later Jul 21, 2021 42:19


Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian's book too! Special guest: Simon Willison Michael #1: MongoDB 5 Native Time Series: Designed for IoT and financial analytics, our new time series collections, clustered indexing, and window functions make it easier, faster, and lower cost to build and run time series applications MongoDB automatically optimizes your schema for high storage efficiency, low latency queries, and real-time analytics against temporal data. The Versioned API future-proofs your applications. You can fearlessly upgrade to the latest MongoDB releases without the risk of introducing backward-breaking changes that require application-side rework New MongoDB Shell we have introduced syntax highlighting, intelligent auto-complete, contextual help and useful error messages creating an intuitive, interactive experience for MongoDB users (use mongosh rather than mongo on the CLI). Also launched preview release of serverless instances on MongoDB Atlas You can watch the MongoDB keynote here. Brian #2: Python 3.11 : Enhanced error locations in tracebacks Yes, 3.11. Even though 3.10 is still in Beta, we're already excited about 3.11 tracebacks now point to the exact expression that caused the error within the line: Traceback (most recent call last): File "distance.py", line 11, in [HTML_REMOVED] print(manhattan_distance(p1, p2)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "distance.py", line 6, in manhattan_distance return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y) ^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'x' even deeply nested calls Traceback (most recent call last): File "query.py", line 37, in [HTML_REMOVED] magic_arithmetic('foo') ^^^^^^^^^^^^^^^^^^^^^^^ File "query.py", line 18, in magic_arithmetic return add_counts(x) / 25 ^^^^^^^^^^^^^ File "query.py", line 24, in add_counts return 25 + query_user(user1) + query_user(user2) ^^^^^^^^^^^^^^^^^ File "query.py", line 32, in query_user return 1 + query_count(db, response['a']['b']['c']['user'], retry=True) ~~~~~~~~~~~~~~~~~~^^^^^ TypeError: 'NoneType' object is not subscriptable and math expressions: Traceback (most recent call last): File "calculation.py", line 54, in [HTML_REMOVED] result = (x / y / z) * (a / b / c) ~~~~~~^~~ ZeroDivisionError: division by zero Simon #3: fly.io multi-region PostgreSQL and last mile Redis fly.io are a hosting provider that specialize in running your code in containers that are geographically close to your users What I find interesting about them is that they are taking something that used to be INCREDIBLY hard - like geographically sharding your database - and describing patterns for doing that which make it easy-enough that I might actually do it Their writing is really good. I'm learning a ton from them about designing code to run globally that applies even if I don't end up using their service Michael #4: django-unicorn A magical full-stack framework for Django Quickly add in simple interactions to regular Django templates without learning a new templating language. Building a feature-rich API is complicated. Skip creating a bunch of serializers and just use Django. Early days if you want to contribute Brian #5: Blue : The somewhat less uncompromising code formatter than black Suggested by Chris May Code from Black, mods by Grant Jenks and Barry Warsaw It's not a fork, it's a patched version of black. Kind of a “containment over inheritance” thing. Deltas: blue defaults to single-quoted strings. except docstrings and triple quoted strings (TQS). Those are still double quotes. blue defaults to line lengths of 79 characters. black is 88. line lengths are customizable with all related tools. blue preserves the whitespace before the hash mark for right hanging comments. making comment blocks off to the side possible blue supports multiple config files: pyproject.toml, setup.cfg, tox.ini, and .blue. Interesting quote from the docs: “We'd prefer not to fork or monkeypatch. Instead, our hope is that eventually we'll be able to work with the black maintainers to add just a little bit of configuration and merge back into the black project. “ My take Probably stick with black most of the time. For some large exiting projects with lots of strings that have standardized to single quote strings already, black is jarring. Also, strings with double quotes in them are untouched by black, so if you have lots of those, strings will be inconsistent, making the code harder to read and confusing to maintain. And the choice isn't really black or blue. It's often nothing due to the non-starter of switching to double quote strings by default. blue is better than nothing. See also # fmt: off, # fmt: on for both blue and black # tell black/blue to not reformat this table # fmt: off some_table = [ 1, 2, 3, 100, 200, 300 ] # fmt: on Simon #6: Organize and Index Your Screenshots (OCR) on macOS I've been wanting to figure out how to use Tesseract OCR for years, and this post finally unlocked it for me brew install tesseract tesseract image.png output-file -l eng pdf (use txt instead of pdf to get plain text) I wrote a TIL about this at https://til.simonwillison.net/tesseract/tesseract-cli It's really good! Even works against photos I've taken. And the PDFs it produces have copy-and-paste text in them (despite looking visually identical to the image) and can be searched using Spotlight. There's a pytesseract library but it actually just works by running that Tesseract CLI tool in a subprocess Extra: Using SQL to find my best photo of a pelican according to Apple Photos Extras Michael: Strong Typing follow up typed nametuple: strongtyping.readthedocs.io/en/latest/namedtuple/ now classes: github.com/FelixTheC/strongtyping/issues/65 We are finally rid of tracking on the podcast sites. But it took some neat tech work Simon https://pythonbytes.fm/episodes/show/237/separate-your-sql-and-python-asynchronously-with-aiosql talked about Textual but it's worth marveling at how far along it has already come, one of the fastest pieces of development-in-the-open I've ever seen - follow along on Will's Twitter account, he posts a lot of videos and screenshots e.g. https://twitter.com/willmcgugan/media and the videos in his README at https://github.com/willmcgugan/textual/blob/main/README.md Joke A “Query tale”? Song from Brett Cannon (take on Pinky and the Brain theme song) What do you want to do today, Brian? Same thing we do every Wednesday, Michael. Help Python take over the world. It's Michael and the Brain! Yes, Michael and the Brain! One's into testing, the other GUIs! They're both into making Python seem sane! They're Michael, they're Michael and the Brain, Brain, Brain, Brain, Brain!

The Python Podcast.__init__
Finding The Core Of Python For A Bright Future With Brett Cannon

The Python Podcast.__init__

Play Episode Listen Later Jun 23, 2021 63:18


Brett Cannon has been a long-time contributor to the Python language and community in many ways. In this episode he shares some of his work and thoughts on modernizing the ecosystem around the language. This includes standards for packaging, discovering the true core of the language, and how to make it possible to target mobile and web platforms.

The Changelog
Every commit is a gift

The Changelog

Play Episode Listen Later Jun 10, 2021 67:40 Transcription Available


Maintainer Week is finally here and we're excited to make this an annual thing! If Maintainer Week is new to you, check out episode #442 with Josh Simmons and Kara Sowles. Today we're talking Brett Cannon. Brett is Dev Manager of the Python Extension for VS Code, Python Steering Council Member, and core team member for Python. He recently shared a blog post The social contract of open source, so we invited Brett to join us for Maintainer Week to discuss this topic in detail. Thank a maintainer on us! We're printing a limited run t-shirt that's free for maintainers, and all you gotta do is thank them, today!

Changelog Master Feed
Every commit is a gift (The Changelog #444)

Changelog Master Feed

Play Episode Listen Later Jun 10, 2021 67:40 Transcription Available


Maintainer Week is finally here and we're excited to make this an annual thing! If Maintainer Week is new to you, check out episode #442 with Josh Simmons and Kara Sowles. Today we're talking Brett Cannon. Brett is Dev Manager of the Python Extension for VS Code, Python Steering Council Member, and core team member for Python. He recently shared a blog post The social contract of open source, so we invited Brett to join us for Maintainer Week to discuss this topic in detail. Thank a maintainer on us! We're printing a limited run t-shirt that's free for maintainers, and all you gotta do is thank them, today!

Python Bytes
#233 RaaS: Readme as a Service

Python Bytes

Play Episode Listen Later May 12, 2021 50:58


Watch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guest: Marlene Mhangami Brian #1: readme.so Recommended by Johnny Metz This is not only useful, it’s fun Interactively create a README.md file Suggested sections great There are lots of sections though, so really only pick the ones you are willing to fill in. I think this is nicer than the old stand by of “copying the README.md of another project” because that other project might not have some of these great sections, like: Acknowledgements API Reference Authors FAQ Features Logo Roadmap Usage/Examples Running Tests Note, these sections are listed in alphabetical order, not necessarily the right order for how they should go in your README.md Produces a markdown file you can copy or download Also an editor so you can edit right there. (But I’d probably throw together the skeleton with dummy text and edit it in something with vim emulation. Michael #2: Wafer-scale Python via Galen Swint Many new processors with the sole purpose of accelerating artificial intelligence and machine learning workloads. Cerebras, a chip company, built an AI-oriented chip that is 12”x12” (30cm^2) with 850,000 AI cores on board. Another way to look at it is that’s 2.6T transistors vs. my M1’s 0.0016T. Built through TSMC, as so many things seem to be these days. What’s the Python angle here? A key to the design is the custom graph compiler, that takes PyTorch or TensorFlow and maps each layer to a physical part of the chip, allowing for asynchronous compute as the data flows through. Shipping soon for just $3M+. Marlene #3: RAPIDS This is the library I’m currently working on at NVIDIA. I work specifically on CuDF which is a Python GPU DataFrame library for loading, joining, aggregating, filtering, and manipulating tabular data using a DataFrame style API. It mirrors the Pandas API but operations are done on the GPU I gave a talk at PyCon Sweden a few months ago called ‘A Beginners Guide to GPU’s for Pythonista’s’. Here’s an example of how long it takes for pandas vs. cudf to calculate the mean of a group of numbers in a column in a DataFrame: #we'll be calculating the mean of the data in a dataframe (table) import cudf import pandas as pd import numpy as np import time #lets create a data frame using pandas, that has two columns, a and b #we're generating a dataframe where each column contains one hundred million rows #each row is filled with a random integer that can be between 0 to one hundred million pandas_df = pd.DataFrame({"a": np.random.randint(0, 100000000, size=100000000), "b": np.random.randint(0, 100000000, size=100000000)}) #next we want to create a cudf version of this dataframe cudf_df = cudf.DataFrame.from_pandas(pandas_df) #now we'll use timeit to compare the time it takes to calculate the mean #of the numbers in the column "a" of the dataframe. #Lets time Pandas %timeit pandas_df.a.mean() #Lets time CuDF %timeit cudf_df.a.mean() #These were the results I got (might be a little slower if you're using the notebook on Colab) # pandas: 105 ms ± 298 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) #cudf: 1.83 ms ± 4.51 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) You can test this out for right now using the RAPIDS, GPU powered notebook for free on Google Colab. Brian #4: datefinder and dateutil Recommended by Ira Horecka Great calmcode.io video on datefinder Neat use of comprehensions to explore sending a bunch of data into a tool: import datefinder date_strings = [ "March 12 2010", "2010-03-12", "03/12/2010 12:42:12" ] [list(datefinder.find_dates(d)) for d in date_strings] # [[datetime.datetime(2010, 3, 12, 0, 0)], # [datetime.datetime(2010, 3, 12, 0, 0)], # [datetime.datetime(2010, 3, 12, 12, 42, 12)]] Nice focused library, used by 662 projects, according to GitHub datefinder finds dates in strings, then uses dateutil to parse them into datetime objects. dateutil is actually kind of amazing also, great for parsing date strings computing relative delas (next month, last week of the month, etc) relative deltas between date and/or datetimes amazing timezone support comprehensive test suite nice mix of both pytest and unittest. I’ll have to ask Paul Ganssle about that sometime. Michael #5: Cinder - Instagram's performance oriented fork of CPython via Anthony Shaw Instagram's performance oriented fork of CPython. They use a multi-process webserver architecture; the parent process starts, performs initialization work (e.g. loading code), and forks tens of worker processes to handle client requests. The overhead due to copy-on-write from reference counting long-lived objects turned out to be significant. They developed a solution called "immortal instances" to provide a way to opt-out objects from reference counting. "Shadowcode" or “shadow bytecode" is their inline caching implementation. It observes particular optimizable cases in the execution of generic Python opcodes and (for hot functions) dynamically replaces those opcodes with specialized versions. Eager coroutine evaluation: If a call to an async function is immediately awaited, we immediately execute the called function up to its first await. The Cinder JIT is a method-at-a-time custom JIT implemented in C++. And can achieve 1.5-4x speed improvements on many Python performance benchmarks. Strict modules is a few things rolled into one Static Python is an experimental bytecode compiler that makes use of type annotations to emit type-specialized and type-checked Python bytecode. Static Python plus Cinder JIT achieves 7x the performance of stock CPython on a typed version of the Richards benchmark. Marlene #6: PyCon US 2021 PyCon US starts today. Its the largest gathering of the Python community on earth! I’ll be hosting the Diversity and Inclusion Work Group Meet and Greet. I recently became the chair of this WG, which focuses on helping increase global diversity and inclusion in the python community. We’ll be going live on the main stage at PyCon on Saturday 15 May at 12pm EST. There will be lots of time for discussion, so I hope to see some of you there! I’ll also be hosting the PSF EMEA members meeting, which will be on Saturday at 10am CAT. You can register on the Meet up page or watch the livestream on the PSF Youtube channel. You can also find me in the PSF booth on Friday and Saturday morning, if you’d like to meet there! Some other talks I’m looking forward to attending are: Python Performance at Scale - Making Python Faster at Instagram More Fun With Hardware and CircuitPython - IoT, Wearables, and more! Large Scale Data Validation (with Spark and Dask) Registration will be open all through the conference, so if you haven’t yet you can register here And of course all the keynotes this year! Extras Michael Keep your fork in sync at GitHub Flask 2.0 is out! (Just interviewed David and Phil for Talk Python) (thanks Adam Parkin) New Major Versions Released! Flask 2.0, Werkzeug 2.0, Jinja 3.0, Click 8.0, ItsDangerous 2.0, and MarkupSafe 2.0 Brian Lots of great feedback about last weeks Test & Code interview with Brett Cannon about packaging. I’m glad it was helpful to people. This week I’m talking with Ryan Howard about Playwright for automated browser testing. Did you know we have 71 patrons on patreon? So cool. You too can support the show at patreon.com/pythonbytes Marlene If you’d like to connect you can find me on twitter @marlene_zw You can also check out my site marlenemhangami.com Joke

Test & Code - Python Testing & Development
152: Python Packaging - Brett Cannon

Test & Code - Python Testing & Development

Play Episode Listen Later May 7, 2021 49:41


I always learn a lot when I talk to Brett, and this episode is no exception. We talk about the packaging workflow, tools, changes, pyproject.toml, flit, setuptools, and so much more. I hope you learn as much as I did in this great discussion. Special Guest: Brett Cannon.

python packaging brett cannon
Python Bytes
#232 PyPI in a box and a revolutionary keyboard

Python Bytes

Play Episode Listen Later May 5, 2021 38:16


Watch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guest: Annette Lewis Brian #1: Sphinx Themes Gallery update Curated and maintained by @pradyunsg and @shirou. I actually don’t know what it looked like before, but this is great. I’m working on my first real Sphinx project, so this is awesome to have. Features: Main image for each theme shows what theme looks like in wide, narrow, and phone layout Demos (click on an image): Main page that shows you quick start: install and config theme name Link to theme documentation Example of Navigation Kitchen sink paragraph level markup including inline, math, meta, blocks, code with sidebars, references, directives, footnotes, and more API documentation example essential if you are using this for documenting code Lists and tables Michael #2: Mongita - Like SQLite but for MongoDB Mongita is a lightweight embedded document database that implements a commonly-used subset of the MongoDB/PyMongo interface. Instead of being a server, Mongita is a self-contained Python library Mongita can be configured to store its documents either on disk or in memory. This is a great project to contribute to as a new open source person, details. Uses: Embedded database: Mongita is a good alternative to SQLite for embedded applications when a document database makes more sense than a relational one. Unit testing: Mocking PyMongo/MongoDB is a pain. Worse, mocking can hide real bugs. By monkey-patching PyMongo with Mongita, unit tests can be more faithful while remaining isolated. Limited dependencies: Mongita runs anywhere that Python runs. Currently the only dependencies are pymongo (for bson) and sortedcontainers (for faster indexes). Annette #3: World Plone Day 2021 - Over 50 Videos from 16 Countries World Plone Day was 24-hour online streaming event held on April 28th 2021. Plone open-source Content Management system, written in Python and built on top of the Zope web framework Plone community produced 56 videos totaling 22 hours of content. More than 50 speakers from 16 countries, 11 languages. All available on Youtube - World Plone Day 2021 playlist Variety of content categories: General Interest Technical Talks Case Studies Plone 6 Plone 6 introduction How does Plone 6 work under the hood? Getting Started with Volto Customization Brian #4: The social contract of open source : view every commit as a gift Brett Cannon Interesting thoughts on what “contract” and what relationship exists between maintainer and user. Great analogy of a stack of USB drives with source code on front lawn with a “FREE” sign. Come by and pick up the latest release whenever you want No guarantee at all Each new version is a gift that you can accept or not Receiver of gift should NOT: knock on front door and yell at developer Leave an angry letter in the mailbox Stand in middle of street in town yelling about how much they hate the software or how much of an idiot the developer is Quote from Immanuel Kant: “Act in such a way that you treat humanity, whether in your own person or in the person of any other, never merely as a means to an end, but always at the same time as an end.” Brett: “… when you treat a maintainer as a fellow human being who may be able to do you a favor of their own volition, then you end up in an appropriate relationship where you are not trying to use the maintainer for something specific. Summary: “Every commit of open source code should be viewed as an independent gift from the maintainer that they happened to leave on their front yard for others to enjoy if they so desire; treating them as a means to and for their open source code is unethical.” Michael #5: PyPI in a box via Jared Chung Connectivity is still a challenge in many countries, especially Africa Vuyisile Ndlovu created PyPI in a Box. Post PyCon Africa, in the conference slack group, attendees shared the most common problems across the continent, and the state of internet connectivity was the overwhelming response. Vuyisile also references putting “StackOverflow in a box” but the article doesn’t lay out how to do it. Annette #6: Film simulations from scratch using Python by Kevin Martin Jose Implementing applying CLUTs (Color Look up table) to an image with Python Opens the Image with PIL then converts it into numpy array Iterates through all the pixels values and assigns it to LUT color cell Returns the filtered Image from the array Extras Michael Talked about HTMX, Akira K. pointed out Hyperscript as a companion. Careful, it’s super new. Dask course is out: https://twitter.com/TalkPython/status/1389382566965178375 FastAPI bundle fund raiser with testdriven.io Python 3.10b1 is out Microsoft becomes 3rd PSF Visionary Sponsor, joining Bloomberg and Google (via PyCoders) Annette Python Web Conf 2022 March 21-25, 2022 The Call for Papers is now open: https://www.papercall.io/pwc-2022 Joke A developer-focused keyboard (graphic)

Star Spangled Gamblers
Deep Dive into Confirmation Markets

Star Spangled Gamblers

Play Episode Listen Later Apr 19, 2021 63:52


Pratik, iSavage, and Brett Cannon do a deep dive into Cabinet confirmation markets.

Star Spangled Gamblers
Gaetz and Confirmation Markets

Star Spangled Gamblers

Play Episode Listen Later Apr 16, 2021 54:53


New, 3-Part Podcast: In Part 1, Zoltar does a deep dive into the legal issues surrounding Rep. Matt Gaetz's political future. In Part 2, new SSG friend Brett Cannon (@brettcannon), an expert on Senate confirmation markets, weighs in on Vanita Gupta and Samantha Power. In Part 3, Peter Hurford explains the model that allowed him to take the SSG title belt from Gaeten and gives his tips for how to make money in Polymarket's vaccine markets.

Python Bytes
#221 Pattern matching and accepting change in Python with Brett Cannon

Python Bytes

Play Episode Listen Later Feb 19, 2021 59:05


Sponsored by Datadog: pythonbytes.fm/datadog Special guest: Brett Cannon Brian #1: Keeping up with Rich Will McGugan has been building Rich It looks like it’s on its way to becoming a full fledged TUI (text user interface) December: Live view: no blog post on that, I don’t think. January: Tree view: Rendering a tree view in the terminal with Python and Rich February: Layouts: Building Rich terminal dashboards fun fullscreen.py example, uses Live view Also, python -m rich will display a demo screen that shows tons of the stuff that Rich can do Many of the features also have a stand alone demo built in, like: $ python -m rich.layout $ python -m rich.tree $ python -m rich.live Although I haven’t figured out how to kill the live demo. it doesn’t seem to time out, and it eats Ctrl-C in my terminal. I’d really like to use Rich for interactive stuff, like keyboard interrupts and arrow keys and tab and such. It’d be fun. Which brings me to the bottom right corner of the python -m rich output. It includes a GitHub Sponsor link for Will. Also, Will, unless it’s a contradiction to RTD TOS, I think you should include a Sponsor link in the Rich documentation. Let’s convince Will to make Rich a full TUI. Michael #2: 12 requests per second If you take a look around the blogosphere at various benchmarks for Python web frameworks, you might start to feel pretty bad about your own setup. The incredible work of the guys at magic stack, getting 100,000 requests per second from uvloop in a single thread. There’s the FastAPI benchmarks Even more mind-blowing is Japronto which claims an insane 1.2 million requests per-second in a single thread But what about your “boring” Flask or Django app? And how realistic are these benchmarks? Usually, not very. Here’s an article diving into this for a “proper” ORM style app. 12 - 80 requests per sec: Both our sync workers are now hitting a blazing 12 requests per second

The Real Python Podcast
Unraveling Python's Syntax to Its Core With Brett Cannon

The Real Python Podcast

Play Episode Listen Later Feb 12, 2021 92:30


Do you feel like you understand how Python works under the hood? What is syntactic sugar, and how much of it should be in Python? This week on the show, we have Brett Cannon. Brett is a Python core developer and he's been working on a series of articles where he is unraveling the syntax of Python. His series is a fantastic resource for those wanting to learn how Python is structured and works at its core.

Python Bytes
#209 JITing Python with .NET, no irons in sight

Python Bytes

Play Episode Listen Later Nov 27, 2020 33:13


Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Michael #1: Running Python on .NET 5 by Anthony Shaw Talked about pyjion way back when on episode 49 with Brett Cannon. .NET 5 was released on November 10, 2020. It is the cross-platform and open-source replacement of the .NET Core project and the .NET project that ran exclusively on Windows since the late 90’s. See the conference about it if you want to go deeper. Performance: I just saw a SO post about someone complaining their Python was 31x slower than C#. The most common way around this performance barrier is to compile Python extensions from C or using something like Cython. .NET 5 CLR comes bundled with a performant JIT compiler (codenamed RyuJIT) that will compile .NETs IL into native machine instructions on Intel x86, x86-64, and ARM CPU architectures. Pyjion is a project to replace the core execution loop of CPython by transpiling CPython bytecode to ECMA CIL and then using the .NET 5 CLR to compile that into machine code. It then executes the machine-code compiled JIT frames at runtime instead of using the native execution loop of CPython. A few releases of Python ago (CPython specifically, the most commonly used version of Python) in 3.7 a new API was added to be able to swap out “frame execution” with a replacement implementation. This is otherwise known as PEP 523. This extension uses the same standard library as Python 3.9. Will this be compatible with my existing Python code? What about C Extensions? The short answer is- if your existing Python code runs on CPython 3.9 – yes it will be compatible. Tested against the full CPython “test suite” on all platforms. In fact, it was the first JIT ever to pass the test suite. Is this faster? The short answer a little, but not by much (yet). see also: https://twitter.com/anthonypjshaw/status/1328457723608928256?s=20 Brian #2: PEP 621 -- Storing project metadata in pyproject.toml Progress on standardizing what goes into pyproject.toml Authors Brett Cannon, Paul Ganssle, Pradyun Gedam, Sébastien Eustace (of poetry), Thomas Kluyver (of flit), Tzu-Ping Chung Motivators of this PEP are: Encourage users to specify core metadata statically for speed, ease of specification, unambiguity, and deterministic consumption by build back-ends Provide a tool-agnostic way of specifying metadata for ease of learning and transitioning between build back-ends Allow for more code sharing between build back-ends for the "boring parts" of a project's metadata Doesn’t change any existing core metadata Doesn’t attempt to standardize all possible metadata Included in table named [project]: name version description readme requires-python license authors/maintainers keywords classifiers urls entry points dependencies/optional-dependencies dynamic There’s an example in the PEP that helps clear things up Many items have synonyms specified for flit/poetry/setuptools (presumably for backward compatibility) Michael #3: GitHub revamps copyright takedown policy after restoring YouTube-dl In October following a DMCA complaint from the Recording Industry Association of America (RIAA) it was taken down at GitHub. Citing a letter from the Electronic Frontier Foundation (the EFF), GitHub says it ultimately found that the RIAA’s complaint didn’t have any merit. The RIAA argued the tool ran afoul of section 1201 of the US copyright law by giving people the means to circumvent YouTube’s DRM. the EFF dissects the RIAA’s claims, highlighting where the organization had either misinterpreted the law or how the code of YouTube-dl works. “Importantly, YouTube-dl does not decrypt video streams that are encrypted with commercial DRM technologies, such as Widevine, that are used by subscription videos sites, such as Netflix,” the organization points out when it comes to the RIAA’s primary claim. GitHub is implementing new policies to avoid a repeat of a repeat situation moving forward. First, it says a team of both technical and legal experts will manually evaluate every single section 1201 claim. If the company’s technical and legal teams ultimately find any issues with a project, GitHub will give its owners the chance to address those problems before it takes down their work. GitHub is establishing a $1 million legal defense fund for developers. Sidebar: EFF has just launched How to Fix the Internet, a new podcast mini-series that examines potential solutions to six ills facing the modern digital landscape. Brian #4: Install & Configure MongoDB on the Raspberry Pi Mark Smith Definitely a “wow, I didn’t know you could do that” article. Tutorial walks through Installing 64 bit Ubuntu Server on a Raspberry Pi Configure wifi Install MongoDB on Pi Set up a user account, to safely expose MongoDB on a home network. Now you’ve got a MongoDB server in your house. So cool Michael #5: Extra! extra! extra!, hear all about it! Follow up on my critique of things like SQL & CSS put next to Python and Java. Maybe best to grab the conversation from here. Guido joins Microsoft, why? People seem to see this as a positive for sure. But they checked him out! New code editor roaming the streets: Nova from Panic. Two thumbs up on Big Sur and now waiting on the Mac Mini M1. Brian #6: A Python driven AI Stylist Inspired by Social Media Dale Markowitz A bunch of Google tools (cloud storage, firebase, cloud vision api, product search api) Some React for front end Python to batch script General oversimplified process: photos from social media for inspiration photos of everything in your closet, multiple of each item use AI suggest outfits from your closet that match inspiration photos Ok. The process is really more of a promo for Google AI products, and not so much about Python, but it’s a cool “look what you can do with software” kinda thing. Also, many of the tools used by online retail, like “similar products” and such, are available to lots of people now, and that’s cool. Joke: Back to the [dev] future!

Python Bytes
#187 Ready to find out if you're git famous?

Python Bytes

Play Episode Listen Later Jun 26, 2020 29:25


Sponsored by us! Support our work through: Our courses at Talk Python Training Brian’s pytest book Brian #1: LEGO Mindstorms Robot Inventor supports Python Past NXT 2006 NXT 2.0 2009 EV3 2013 (plus, weird post apocalypse thing going on) Robot Inventor will be available Autumn 2020 (not sure what that means). Controllable with both Scratch and Python Great updates to help with STEM education Instructions for 5 different robots interesting: 5x5 LED matrix 6 input/output ports for connecting a variety of sensors and motors. 6 axis gyro/accelerometer color sensor distance sensor and Python! Can be programmed with Windows & Mac, of course. But also iOS & Android tablets and phones and even some FireOS devices. Related: MicroscoPy - IBM open source, motorized, modular microscope built using LEGO bricks, Arduino, Raspberry Pi and 3D printing. Michael #2: Step-by-step guide to contributing on GitHub by Kevin Markham Want to contribute to an open source project? Follow this detailed visual guide to make your first contribution TODAY Although there are other guides like it out there, mine is (1) up-to-date with the latest GitHub interface, (2) much more detailed, and (3) highly visual. Includes 16 annotated screenshots + 2 workflow diagrams. The only prerequisite is that the reader has a tiny bit of Git knowledge. They don't even have to be a great coder, because what I suggest is that they start by fixing a typo or broken link in the documentation. That way they can focus on learning the contribution workflow! Steps: choose a project to contribute to fork the project clone your fork locally load your local copy in an editor make sure you have an "origin" remote add the project repository as the "upstream" remote pull the latest changes from upstream into your local repository create a new branch make changes in your local repository commit your changes push your changes to your fork create the pull request review the pull request add more commits to your pull request discuss the pull request delete your branch from your fork synchronize your fork with the project repository Nice Tips for contributing code section too. Brian #3: sneklang Snek: A Python-inspired Language for Embedded Devices An even smaller footprint than MicroPython or CircuitPython Can’t wait for Robot Inventor? Snek supports Lego EV3. “Snek is a tiny embeddable language targeting processors with only a few kB of flash and ram. … These processors are too small to run MicroPython.” Can develop using Mu editor Custom Snekboard runs either Snek or CircuitPython. Or run Snek on Lego EV3. Smaller language than Python, but intended to have all learning of Snek transferable to later development with Python. “The goals of the Snek language are: Text-based. A text-based language offers a richer environment for people comfortable with using a keyboard. It is more representative of real-world programming than building software using icons and a mouse. Forward-looking. Skills developed while learning Snek should be transferable to other development environments. Small. This is not just to fit in smaller devices: the Snek language should be small enough to teach in a few hours to people with limited exposure to software. Snek is Python-inspired, but it is not Python. It is possible to write Snek programs that run under a full Python system, but most Python programs will not run under Snek.” Michael #4: Oh sh*t git via Andrew Simon, by Julia Evans Does cost $10, no affiliations This zine explains git fundamentals (what’s a SHA?) How to fix a lot of common git mistakes (I committed to the wrong branch!!). Fundamentals Mistakes and how to fix them Merge conflicts Committed the wrong file Going back in time Brian #5: Why I don't like SemVer anymore Brett Cannon Interesting thoughts on SemVer SemVer isn't as straightforward as it sounds; we don't all agree on what a major, minor, or micro change really is. Is adding a depreciation warning a bug fix? or a major interface break? What if projects depending on your project have CI with warnings as errors? Your version number represents your branching strategy, so you choose a versioning scheme that's appropriate your branching and release strategy. While maintaining multiple branches, x.y.z might make sense: x - current release x.y - current development x.y.z - bug fixes x+1 - crazy new stuff If you aren’t maintaining 3+ branches at all times, that might be overkill Maybe x.y is enough Maybe just x is enough Rely on CI, potentially on a cron job, to detect when a project breaks for you instead of leaving it up to the project to try and make that call based on their interpretation of SemVer; will inevitably disagree Remember to pin your dependencies in your apps if you really don't want to have to worry about a dependency breaking you unexpectedly Libraries/packages should be setting a floor, and if necessary excluding known buggy versions, but otherwise don't cap the maximum version as you can't predict future compatibility Michael #6: git fame via Björn Olsson Pretty-print git repository collaborators sorted by contributions. Install via pip: pip install --user git-fame Register with git: git config --global alias.fame "!python -m gitfame``" Run in a repo directory: git fame Get a table of contributors including: Author, Lines of Code, Files, Distribution (stats), sorted by most contributions. Extras: Patreon Shoutout: We have 26 supporters at https://www.patreon.com/pythonbytes Many donate $1 a month, and that’s awesome. A few go above and beyond with more than that: Special shout out to those above a buck: Brent Kincer Brian Cochrane Bert Raeymaekers Richard Stonehouse Jeff Keifer Thank you Michael: __pypackages__ follow up from Kushal Das Joke: https://www.commitstrip.com/en/2017/02/28/definitely-not-lazy/

Test & Code - Python Testing & Development
119: Editable Python Installs, Packaging Standardization, and pyproject.toml - Brett Cannon

Test & Code - Python Testing & Development

Play Episode Listen Later Jun 26, 2020 36:06


There's stuff going on in Python packaging and pyproject.toml. Brett and I talk about some upcoming work on Python packaging, such as: editable installs the need for standardization configuration of other tools in pyproject.toml And then get off on tangents and talk about: why it's good to have packages like pip, toml, setuptools, wheel, etc not part of the standard library should we remove some stuff from the standard library the standard library using unittest for testing the standard library why not hypothesis I didn't bring up "why not pytest?" but you know I was thinking it. why CPython and not C++Python and more Special Guest: Brett Cannon.

Test & Code - Python Testing & Development
117: Python extension for VS Code - Brett Cannon

Test & Code - Python Testing & Development

Play Episode Listen Later Jun 18, 2020 51:17


The Python extension for VS Code is most downloaded extension for VS Code. Brett Cannon is the manager for the distributed development team of the Python extension for VS Code. In this episode, Brett and I discuss the Python extension and VS Code, including: pytest support virtual environment support how settings work, including user and workspace settings multi root projects testing Python in VS Code debugging and pydevd jump to cursor feature upcoming features Special Guest: Brett Cannon.

This Life Ain't For Everybody
E139 - Brett Cannon - Southern Florida Fishing & Hunting

This Life Ain't For Everybody

Play Episode Listen Later Apr 23, 2020 64:30


Brett is a South Florida Outdoorsman who lives a hunter lifestyle. He hunts all over the country from whitetails in the midwest, gators in southern swamps, wild turkeys in Florida. Brett is also an accomplished fishermen with a billfish world record for catching and releasing all 9 billfish species of the world in just 26 days. Brett shares some of his amazing stories hunting and fishing including some close calls with sharks.

Python Bytes
#176 How python implements super long integers

Python Bytes

Play Episode Listen Later Apr 7, 2020 29:32


Sponsored by DigitalOcean: pythonbytes.fm/digitalocean Topic #0: Quick chat about COVID 19 Brian #1: What the heck is pyproject.toml? Brett Cannon pyproject.toml PEP 517 and 518 define what this file looks like and how to use it to build projects We’re familiar with it being used for flit and poetry based projects. Not so much with setuptools, but it does work with setuptools. You can add configuration for non-build related activities, such as coverage, tox, even though those tools support their own config files. Black is gaining popularity, probably more so than the use of flit. Black only uses pyproject.toml for configuration (what little config is available. But there is some.) So. Project adds use of black, ends up configuring with with pyproject.toml, but not specifying build steps, No builds are broken. :( Brett has the answers. Add the following to pyproject.toml. Then go read the rest of Brett’s article. It’s good. [build-system] requires = ["setuptools >= 40.6.0", "wheel"] build-backend = "setuptools.build_meta" Michael #2: Awesome Python Bytes Awesome List By Jack McKew Will be adding to this repo whenever I hear about awesome packages (in my opinion), PRs are welcome for anyone else though! Already has 5 PRs accepted Comes with graphics!!! Like all good presentations should. Some fun projects this made me recall: Great Expectations - for validating, documenting, and profiling, your data pandas-vet - a plugin for flake8 that provides opinionated linting for pandas code. GeoAlchemy - Using SQLAlchemy with Spatial Databases. vue.py - Provides Python bindings for Vue.js. It uses brython to run Python in the browser. Remember we have speedy search for our content over at pythonbytes.fm/search Brian #3: Publishing package distribution releases using GitHub Actions CI/CD workflows PyPA You’ve moved to flit (or not) and started using GitHub actions to build and test whenever you push to GitHub. So awesome. But now, there’s still a manual step to remember to publish to PyPI. And maybe we should be checking publish more often with the Test PyPI server. This article is a step by step walkthrough. It’s a bit dated, 3.7. So I’m trying to walk through all the steps with my cards project and it will be finished by the time this episode goes live. Stumbling blocks right now: I’ve left my email blank, no email for author or maintainer in pyproject.toml, because neither flit, nor pip require it. But PyPI still does. grrrr. Trying to decide between: normal email, setting up a new email for it, using a me+pypi gmail alias, setting up a new email address just for pypi, etc. test pypi fails due to “file already exists”, so, that’s always gonna be the case unless I bump the version, so gonna have to try to figure out a way around that. Michael #4: Rich text for terminals Rich is a Python library for rich text and beautiful formatting in the terminal. Add colorful text (up to 16.7 million colors) with styles (bold, italic, underline etc.) to your script or application. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, and tracebacks -- out of the box. Centered or justified text Tables, tables! Syntax highlighted code Markdown! Can replace print() and does pretty printing of dictionaries with color. Good Windows support for the new Windows Terminal Brian #5: psutil: Cross-platform lib for process and system monitoring in Python “psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. It is useful mainly for system monitoring, profiling and limiting process resources and management of running processes. It implements many functionalities offered by classic UNIX command line tools such as ps, top, iotop, lsof, netstat, ifconfig, free and others.” Useful for an incredible amount of information about the system you are running on: cpu times, stats, load, number of cores memory size and usage disk partitions, usage sensors, including battery users processes and process management getting ids, names, etc. cpu, memory, connections, files, threads, etc per process signaling processes, like suspend, resume, kill Michael #6: How python implements super long integers by Arpit Bhayani In C, you worry about picking the right data type and qualifiers for your integers; at every step, you need to think if int would suffice or should you go for a long or even higher to a long double. In python, you need not worry about these "trivial" things because python supports integers of arbitrary size. 2 ** 20000 in C is INF where as in Python’s it’s fine, just at 6,021 digit result. But how!?! Integers are represented as: typedef struct { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ } PyVarObject; Other types that has PyObject_VAR_HEAD are PyBytesObject PyTupleObject PyListObject # Python's number: struct _longobject { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ digit ob_digit[1]; }; A "digit" is base 230 hence if you convert 1152921504606846976 into base 230 you get 100 Operations on super long integers Addition: Integers are persisted "digit-wise", this means the addition is as simple as what we learned in the grade school Subtraction: Same Multiplication: In order to keep things efficient implements the Karatsuba algorithm that multiplies two n-digit numbers in O(nlog23) elementary steps. Optimization of commonly-used integers: Python preallocates small integers in a range of -5 to 256. This allocation happens during initialization Extras: Michael: We're coming to YouTube, probably. :) npm is joining GitHub Joke:

Python Bytes
#166 Misunderstanding software clocks and time

Python Bytes

Play Episode Listen Later Jan 27, 2020 28:21


Sponsored by DigitalOcean: pythonbytes.fm/digitalocean Michael #1: Amazon is now offering quantum computing as a service Amazon Braket – A fully managed service that allows scientists, researchers, and developers to begin experimenting with computers from multiple quantum hardware providers in a single place. We all know about bits. Quantum computers use a more sophisticated data representation known as a qubit or quantum bit. Each qubit can exist in state 1 or 0, but also in superpositions of 1 and 0, meaning that the qubit simultaneously occupies both states. Such states can be specified by a two-dimensional vector that contains a pair of complex numbers, making for an infinite number of states. Each of the complex numbers is a probability amplitude, basically the odds that the qubit is a 0 or a 1, respectively. Amazon Braket is a new service designed to let you get some hands-on experience with qubits and quantum circuits. You can build and test your circuits in a simulated environment and then run them on an actual quantum computer. See linked announcement. Language looks familiar: [1]: bell = Circuit().h(0).cnot(0, 1) print(device.run(bell, s3_folder).result().measurement_counts()) How it Works: Quantum computers work by manipulating the amplitudes of the state vector. To program a quantum computer, you figure out how many qubits you need, wire them together into a quantum circuit, and run the circuit. When you build the circuit, you set it up so that the correct answer is the most probable one, and all the rest are highly improbable. Brian #2: A quick-and-dirty guide on how to install packages for Python Brett Cannon Good modern intro to venv use. Pro short. simple. quick uses --prompt in every example (more people need to use this) and suggests using the directory name containing the env. send it to all your co-workers that STILL aren’t using virtual environments hints at an improved form of --prompt coming in Python 3.9 Con uses .venv, I’m a venv (no dot kinda guy) hints at an improved form of --prompt coming in Python 3.9 --prompt . will deduce the directory name. In 3.8 it just names your env “.”. Michael #3: Say No to the no code movement Article by Alex Hudson 2020 is going to be the year of “no code”: the movement that say you can write business logic and even entire applications without having the training of a software developer. Every company is a software company But software devs are in short supply and outcomes are variable two distinct benefits to transitioning business processes into the software domain “change control” becomes a software problem rather than a people problem. it’s easier to innovate on what makes a business distinct. The basic problem with “no code” the idea of writing business logic in text form according to the syntax of a technical programming language is anathema. The “simpler abstraction” misconception The “simpler syntax” misconception Configuration over code: Many No Code advocates are building significant systems by pulling together off-the-shelf applications and integrating them. But the logic has been implemented as configuration as opposed to code. The equivalence of code: There are reasons why developers still use plain text, if something came along that was better, many (not all!) developers would drop text like a hot rock. Where does “No code” fail in practice? 80% there and then … Where does “No code” succeed? “No Code” systems are extremely good for putting together proofs-of-concept which can demonstrate the value of moving forward with development. Brian #4: What I learned going from prison to Python Shadeed “Sha” Wallace-Stepter Presented at North Bay Python I got this recommended to be by many people, even those not in the Python community, including my good friends Chuck Forbes and Dr. Donna Beegle, who work to fight poverty. Amazing story. Go listen to it. Michael #5: A real QUICK → Qt5 based gUI generator for ClicK Via Ricky Teachey. Inspired by Gooey, the GUI generator for classical Python argparse-based command line programs. Take a standard Click-based app, add --gui to the command line and you get a GUI! Brian #6: Falsehoods programmers believe about time also More falsehoods programmers believe about time; “wisdom of the crowd” edition All of these assumptions are wrong There are always 24 hours in a day. Months have either 30 or 31 days. … A week always begins and ends in the same month. … The system clock will always be set to the correct local time The system clock will always be set to a time that is not wildly different from the correct local time. If the system clock is incorrect, it will at least always be off by a consistent number of seconds. … It will never be necessary to set the system time to any value other than the correct local time. Ok, testing might require setting the system time to a value other than the correct local time but it will never be necessary to do so in production. … Human-readable dates can be specified in universally understood formats such as 05/07/11. … from more … The day before Saturday is always Friday. … Two subsequent calls to a getCurrentTime() function will return distinct results. The second of two subsequent calls to a getCurrentTime() function will return a larger result. The software will never run on a space ship that is orbiting a black hole. Extras Michael: REMI GUI editor Joke https://twitter.com/mbbillz/status/921119218703257600

The Changelog
Python's new governance and core team

The Changelog

Play Episode Listen Later Jun 6, 2019 71:17 Transcription Available


We’re talking with Brett Cannon for a behind the scenes look at Guido stepping down as Python’s BDFL (Benevolent dictator for life) and the process they had to go through to establish a new governance model, the various proposed PEPs to establish this new direction, the winning PEP, and what the future holds for Python.

Changelog Master Feed
Python's new governance and core team (The Changelog #348)

Changelog Master Feed

Play Episode Listen Later Jun 6, 2019 71:17 Transcription Available


We’re talking with Brett Cannon for a behind the scenes look at Guido stepping down as Python’s BDFL (Benevolent dictator for life) and the process they had to go through to establish a new governance model, the various proposed PEPs to establish this new direction, the winning PEP, and what the future holds for Python.

The Business Communicators
The PR and Digital Influencer Machine behind SXSW

The Business Communicators

Play Episode Listen Later Feb 21, 2019 27:53


Held annually in Austin, Texas, since 1987, South By Southwest (SXSW) brings together experts from the tech, film, and music industries, to help creative people achieve their goals. SXSW senior publicist Brett Cannon and Giant Noise vice president Jennifer Sinski join The Business Communicators to break down the PR machine behind the festival, and how leveraging digital influencers has crafted power messaging to enhance the annual event on a global scale. This episode shares insights on how to reject complacency and maintain a competitive edge in public relations, how to effectively leverage influencers to enhance the reputation of your business or brand, and more. Connect with The Business Communicators on Twitter and Instagram, and find out more about our chapter at IABCHouston.com. And, if you haven't done so already, be sure to subscribe to our podcast on iTunes and leave us a five-star review. Questions or comments? Send us an email at podcast@iabchouston.com.

This Life Ain't For Everybody
E44 - Brett Cannon - Fishing World Record Holder & Avid Outdoorsman - Part 3

This Life Ain't For Everybody

Play Episode Listen Later Dec 21, 2018 66:17


Part 3 of our conversation with Brett Cannon who's earned the Billfish Royal Slam award talks about his experiences fishing and hunting. Follow him https://www.instagram.com/brett_cannon

This Life Ain't For Everybody
E43 - Brett Cannon - Fishing World Record Holder & Avid Outdoorsman - Part 2

This Life Ain't For Everybody

Play Episode Listen Later Dec 17, 2018 70:56


Part 2 with our conversation with Brett Canon. We get into some of the details of our experiences building a outdoor lifestyle brand and working with industry partners.

This Life Ain't For Everybody
E42 - Brett Cannon - Fishing World Record Holder & Avid Outdoorsman - Part 1

This Life Ain't For Everybody

Play Episode Listen Later Dec 10, 2018 72:01


Brett credits his Dad and Grandfather who introduced him into the world of being an outdoorsman. Brett was born in Texas and now resides in South Florida where saltwater competition fishing and spending time in the woods hunting takes up most of his time.

Test & Code - Python Testing & Development
52: pyproject.toml : the future of Python packaging - Brett Cannon

Test & Code - Python Testing & Development

Play Episode Listen Later Nov 5, 2018 50:51


Brett Cannon discusses the changes afoot in Python packaging as a result of PEP 517, PEP 518, starting with "How did we get here?" and "Where are we going?" Discussed: flit Poetry tox Continuous Integration setup.py, MANIFEST.in, etc. pipenv what's with lock files applications (doesn't go on PyPI) vs libraries (goes on PyPI) workflows dependency resolution deployment dependencies vs development dependencies will lock files be standarized multiple lock files requirements.txt Special Guest: Brett Cannon.

Changelog Master Feed
A call for kindness in open source (The Changelog #318)

Changelog Master Feed

Play Episode Listen Later Oct 10, 2018 91:27 Transcription Available


Adam and Jerod talk to Brett Cannon, core contributor to Python and a fantastic representative of the Python community. They talked through various details surrounding a talk and blog post he wrote titled “Setting expectations for open source participation” and covered questions like: What is the the purpose of open source? How do you sustain open source? And what’s the goal? They even talked through typical scenarios in open source and how kindness and recognizing that there’s a human on the other end of every action can really go a long way.

The Changelog
A call for kindness in open source

The Changelog

Play Episode Listen Later Oct 10, 2018 91:27 Transcription Available


Adam and Jerod talk to Brett Cannon, core contributor to Python and a fantastic representative of the Python community. They talked through various details surrounding a talk and blog post he wrote titled “Setting expectations for open source participation” and covered questions like: What is the the purpose of open source? How do you sustain open source? And what’s the goal? They even talked through typical scenarios in open source and how kindness and recognizing that there’s a human on the other end of every action can really go a long way.

Outdoor Ramblin' podcast
Episode 2 with Brett Cannon

Outdoor Ramblin' podcast

Play Episode Listen Later Apr 9, 2018 57:50


Brett Cannon is an avid Outdoorsman, a record holding fisherman, and as humble as they come.  Today we talked about his past hunting & fishing trips, his training for an upcoming triathlon, and any random thing that came to mind.   https://www.youtube.com/user/BACANNON18

outdoorsman brett cannon
Coffee Sprudgecast
Episode 051 - The One At SXSW

Coffee Sprudgecast

Play Episode Listen Later Mar 23, 2018 48:51


Live interviews from SXSW with Brett Cannon of Department of Brewology, Rebekah Miskin of the new web series Night Owl, and Mokhtar Alkhanshali of Port Of Mokha.

live coffee sxsw espresso night owls sprudge mokhtar alkhanshali brett cannon
Living Country in the City
Ep 39 - Fur, Feathers and Scales: Hunting and Fishing with Brett Cannon

Living Country in the City

Play Episode Listen Later Oct 18, 2017 88:05


Brett Cannon, hunter and deep-sea angler extraordinaire, hops on the line with Living Country in the City. See the show notes page at http://livingcountry.us/39. Learn more about your ad choices. Visit megaphone.fm/adchoices

hunting fishing scales feathers brett cannon living country
I Brew My Own Coffee
Episode 50 - The Department of Brewology

I Brew My Own Coffee

Play Episode Listen Later Dec 15, 2016 74:39


When it comes to combining coffee culture with great design, there’s no one working harder to fill the void than The Department of Brewology. We’re honored to welcome longtime friends of the show, David Salinas and Brett Cannon, to talk about how the company's inception, their current and past projects, and much much more. Listen along for a few juicy spoilers about what’s coming up next year!

Code Podcast
3: Concurrency – Event Loop & Coroutines

Code Podcast

Play Episode Listen Later Apr 14, 2016 37:20


Let's escape the world where the Big Brother constantly interrupts us. Free ourselves from the oppression of consumerism. Let's leave behind preemptive multitasking and enter the world of collaboration! Host: Andrey Salomatin https://twitter.com/flpvsk Dark side: Michael Beschastnov Please send us stories about your awkward tech talks! https://twitter.com/podcastcode andrey@codepodcast.com michael@codepodcast.com ### Guests ### - **A. Jesse Jiryu Davis** * https://emptysqua.re/blog/ * https://github.com/ajdavis - **Saúl Ibarra Corretgé** * https://about.me/saghul * https://github.com/saghul A much smarter way to spend your money The Architecture of Open Source Applications aosabook.org/ ### Sources ### * **Event loop** * What the heck is the event loop anyway? by Philip Roberts https://www.youtube.com/watch?v=8aGhZQkoFbQ * An Introduction to libuv by Nikhil Marathe https://nikhilm.github.io/uvbook/ * Taming the asynchronous beast with ES7 by Nolan Lawson https://pouchdb.com/2015/03/05/taming-the-async-beast-with-es7.html * How the heck does async/await work in Python 3.5? by Brett Cannon http://www.snarky.ca/how-the-heck-does-async-await-work-in-python-3-5 * **Coroutines** * Coroutines Live-Coding Demonstration, at SCALE14x by A. Jesse Jiryu Davis https://emptysqua.re/blog/scale14x-coroutines-talk/ * A Web Crawler With asyncio Coroutines from The Architecture Of Open Source Applications by A. Jesse Jiryu Davis and Guido van Rossum http://aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html * Unyielding by Glyph Lefkowitz https://glyph.twistedmatrix.com/2014/02/unyielding.html * A Curious Course on Coroutines and Concurrency by David Beazley http://www.dabeaz.com/coroutines/ * Generator Tricks for Systems Programmers by David Beazley http://www.dabeaz.com/generators/ ### Projects to check out ### * **Python** * Pyuv https://github.com/saghul/pyuv * Pymongo https://api.mongodb.org/python/current/index.html * Python Async IO Resources http://asyncio.org/ * curio - concurrent I/O https://github.com/dabeaz/curio * Tornado Web Server https://github.com/tornadoweb/tornado * **Node.js** * libuv http://docs.libuv.org/en/v1.x/ ### Music ### Mid-Air! https://soundcloud.com/mid_air

projects big brother io python taming guido node rossum unyielding concurrency event loop es7 brett cannon 500l nolan lawson open source applications philip roberts david beazley
The Python Podcast.__init__
Pyjion with Dino Viehland and Brett Cannon

The Python Podcast.__init__

Play Episode Listen Later Apr 1, 2016


Episode 51 - Pyjion with Dino Viehland and Brett Cannon

dino brett cannon