Skip to content

0.2.0

Choose a tag to compare

@github-actions github-actions released this 03 Nov 16:37
· 96 commits to main since this release
ca9d894

Pyjoyment 0.2.0 brings INI files, lazy iterators, SHA-2 and Base64 for URLs to the toolkit. It also makes the ZIP files of AWS Lambda reproducible and much smaller with the public layers, and fixes buffers and queues that slowed down with the square of their size.

pip install -U Pyjoyment
uv add 'Pyjoyment>=0.2.0'

New

  • INI files. Pyjo.INI loads and dumps the INI files that well-known programs read and write, as ~/.aws/config and ~/.aws/credentials, php.ini and php-fpm.conf. It handles:

    • sections and keys that keep their case;
    • the nested settings of AWS, which load as a dict;
    • a key that comes again, which loads as a list;
    • quotes, kept by default or taken off with unquote;
    • comments, kept with comments=True, so that a file dumps back as it was.

    ~/.aws/config loads the same as botocore reads it. Pyjoyment.Plugin.INIConfig reads the configuration of an application from $moniker.ini, and its sections [plugin Name] load the deployment specific plugins. (#491)

  • Lazy iterators. Pyjo.Iterator iterates an iterable or an asynchronous iterable, with for and async for alike.

    • Its chain of map, grep, uniq, flatten, compact and head passes each element on as soon as it has it.
    • map(cb, concurrency=N) takes callbacks that return promises or are coroutines.
    • Its final methods block, and their forms with _p return promises.

    Streams, messages, datagrams and the events of Pyjo.EventEmitter iterate with it. dom.iterate(css) of Pyjo.DOM finds the matches one by one, so first stops the search. i() makes an iterator in the one-liners of python -m Pyjo. (#468, #469, #470)

  • SHA-2 and Base64 for URLs. Pyjo.Util has sha256_bytes, sha256_sum, sha512_bytes, sha512_sum, hmac_sha256_sum and hmac_sha512_sum beside those of SHA-1, and b64url_encode and b64url_decode of RFC 4648 for tokens, signatures and ids in URLs. Pyjo.String.Bytes and Pyjo.String.Unicode have all of them as methods that chain. (#477, #478)

  • Plain log messages. --log-format plain, PYJO_LOG_FORMAT=plain or the attribute plain of Pyjo.Log writes a message with its level only, as [info] Hello. This suits a CI log, which adds its own time to each line. (#480)

  • Reruns of subtests. subtest(name, reruns=2, reruns_delay=10) of Pyjo.Test runs a subtest again after a failure. Use it for a test of a remote host when the network fails. Only the last run counts, and the runs before it become diagnostic messages. (#494)

AWS Lambda

  • Public layers. generate lambda-zip --function-only writes function.zip alone, for the public layers of Python and Pyjoyment that Pyjoyment-Lambda-Layers publishes in the commercial regions of AWS. It reports the layer of Pyjoyment that the function needs. The cookbook explains where to find the ARNs of the layers. The OpenTofu examples lambda_zip, lambda and lambda_stream take the public layers by default. (#487)
  • Reproducible builds. The bytecode of the ZIP files is the same on every machine and with any number of CPUs, on the free-threaded Python too. (#485, #486)
  • Any machine. The generator installs the Python of the target version with uv before it installs the dependencies, so it also works on a machine that does not have that Python. (#473)

Fixes and speed

  • Buffers and queues. Pyjo.File.slurp, Pyjo.Asset.File.slurp, Pyjo.Asset.Memory, the bodies of HTTP messages and the request bodies of the ASGI and WSGI servers grow as a bytearray. Before, they took time in the square of their size: slurp of 50 MB took 1 s, and now takes 8 ms. find of Pyjo.DOM on a large document is 4 times faster, and all_text 14 times. (#475, #476)
  • Command output. The messages of the commands are flushed at once, so their progress shows as it happens in a pipe, as the log of CI. (#479)
  • Pyjo.GetOpt. An option whose target is not a list, a dict or a callback fails when it is added, with Invalid option linkage, as in Getopt::Long. Before, it failed only when the option was given. (#482)

The project

  • The repository is now pyjoyment/Pyjoyment. The plugin of Claude Code installs with claude plugin install pyjoyment --marketplace pyjoyment/Pyjoyment. (#464)
  • The skills for coding agents now cover the log of the application in the place of print, the commands of an application, the iterators, a signature in the event start of the user agent, and the functions of Pyjo.Util in the place of hashlib, hmac and base64. (#477, #478, #479, #482)

Supply chain

The wheel and the sdist come with an SBOM in SPDX and with attestations of their build provenance:

gh attestation verify pyjoyment-0.2.0.tar.gz -R pyjoyment/Pyjoyment

Full Changelog: 0.1.0...0.2.0