Saturday, September 23, 2023
HomePythonEpisode # 348 JavaScript in Your Python

Episode # 348 JavaScript in Your Python



Watch this episode on YouTube

View the online stream replay

Regarding the program

Funded by us! Assistance our resolve:

Get in touch with the hosts

Join us on YouTube at pythonbytes.fm/ online to be component of the target market. Normally Tuesdays at 11am PT. Older video clip variations readily available there as well.

Brian # 1: Distinguishing in between listing dependences to make use of bundles and also for bundles themselves

  • Brett Cannon
  • Why can not we simply make use of pyproject.toml and also quit making use of requirements.txt?
  • Nope. A minimum of not yet. They’re presently for various points.
  • pyproject.toml.
    • There’s project.dependencies and also project.optional-dependencies. examinations that kinda would certainly help noting dependences for an application.
    • Yet you can not state pip set up -r pyproject.toml It does not function. Which’s strange.
    • job is meant for packaged tasks.
  • requirements.txt.
    • for applications and also various other non-packaged tasks
    • It has particular variations
    • functions fantastic with pip
  • What after that?
    • Either we stick to requirements.txt
    • Or we create a few other documents, possibly requirements.toml?
    • Or possibly (Brian’s remark), include something like [application] and also application.dependencies and also application.optional-dependencies. examinations to pyproject.toml

Michael # 2: PythonMonkey

  • PythonMonkey is a Mozilla SpiderMonkey JavaScript engine installed right into the Python VM, making use of the Python engine to offer the JS host setting.
  • This item remains in a beginning, around 80% to MVP since July 2023. It is under energetic advancement by Distributive Outside payments and also responses rate and also urged.
  • It will certainly make it possible for JavaScript collections to be utilized perfectly in Python code and also the other way around– with no considerable efficiency charges.
  • Call Python bundles like NumPy from within a JavaScript collection, or make use of NPM bundles like [crypto-js]( https://www.npmjs.com/package/crypto-js) straight from Python.
  • Carrying out WebAssembly components in Python ends up being unimportant making use of the WebAssembly API and also engine from SpiderMonkey.
  • Even more information in Will certainly Pringle’s write-up

Brian # 3: Peculiarities of Python bundle versioning

  • Seth Larson
  • Yes, we have SemVer, 1.2.3, and also CalVer, 2023.6.1, and also suffixes for beta, 1.2.3 pre1.
  • Yet it obtains way much more enjoyable than that, if you obtain imaginative
  • Below’s a couple of.
    • v is an optional prefix, like v. 1.0
    • You can consist of an “Date” and also divide it from the variation with a !, like 20! 1.2.3
    • Neighborhood variations with alphanumerics, durations, dashboards, highlights, like 1.0.0+ ubuntu-1 PyPI turns down those. That’s most likely great.
    • Lengthy variations. There’s no max size for a variation number. Just how around 1.2.3.4000000000000000001?
    • Pre, blog post, dev aren’t equally unique: 1.0.0-pre0-post0-dev0
    • Extra insaneness in write-up
  • -.

Michael # 4: bear-type

  • Beartype is an open-source PEP-compliant near-real-time pure-Python runtime type-checker stressing effectiveness, use, and also thrilling word play heres.
  • Annotate @beartype- enhanced courses and also callables with kind tips.

    • Call those callables with legitimate criteria: Clear
    • Call those callables with void criteria: Boom

    Traceback:.
    increase exception_cls(.
    beartype.roar.BeartypeCallHintParamViolation: @beartyped.
    quote_wiggum() specification lines =[b’Oh, my God! A horrible plane
    crash!’, b’Hey, everybody! Get a load of thi…’] breaks kind tip.
    checklist[str], as checklist product 0 worth b’ Oh, my God! A dreadful aircraft collision!’.
    not str.

Additionals

Brian:

Michael:

Joke: Discovering JavaScript

RELATED ARTICLES

Most Popular

Recent Comments