|
Description:
|
|
Watch on YouTube
About the show
Sponsored by us! Support our work through:
Connect with the hosts
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:
Michael:
Joke: Learning JavaScript |