Skip to content

Python 3.12.4 externals for Max/MSP

Latest
Compare
Choose a tag to compare
@shakfu shakfu released this 14 Jun 23:47
· 10 commits to main since this release

This 0.2.6 release provides the py and pyjs externals for macOS based on the recently released Python 3.12.4 engine and focuses on stability, bug fixes, and incremental usability enhancements across a number of categories.

As usual, many arm64 and x86_64 external build variants are provided in this release. All are fully codesigned and notarized, which makes them also usable in your own projects and standalones. Please refer to the project's README for an overview of the specific differences between these variants.

Also provided is a couple ofpy external variants which embed numpy. These have the -np suffix in their name:

  • py-js-shared-tiny-ext-darwin-arm64-3.12.4-np.dmg
  • py-js-shared-tiny-ext-darwin-x86_64-3.12.4-np.dmg

In this case, the provided example of using numpy to read/write Max buffer~ objects will likely be useful:

  • py-js/patchers/tests/test_api/test_api_buffer_np.maxpat.

Changelog

The release includes the followings bug fixes, changes and enhancements:

Bug Fixes

  • Fixed a bug which caused Max to crash if more than one py instance was created.

  • Fixed codesigning bug in homebrew-ext and homebrew-pkg, both are now codesigned by default

  • Fixed error caused by removal of distutils in 3.12

  • Fix for broken xz-utils dependency due to its main repo being taken offline due to a well-known security issue. xz-5.2.5, which is known to be safe, is now only downloaded from the cpython dependencies repo instead.

  • Fixed broken static-ext build with improved setup config

  • Fixed a bug where python-static was not building its dependencies

UI Enhancements

  • Added py_textedit bpatcher to handle python code in the patcher.

  • Added fold, which wraps functools.reduce

  • Added mechanism to remove \\ escape sequences to enable commas, double quotes and multi-argument functions to work correctly.

  • Added py_prelude.py which is converted to py_prelude.h, essentially another way of extending the py external by embedding a python module which is loaded into all py instances.

  • Added another simpler method of retrieving the t_py *x object pointer in api module via uintptr_t round-trip conversion.

  • Add bpatcher for editing with external editor with filewatching and reloading on save

  • Added patchers/py_external_editor.maxpat prototype of using external editor with filewatcher and py_load <path> message.

  • pipe is now much more versatile and can handle multiple arguments and multiple functions.

  • Changed py_call to a more versatile pure python function which can handle keyword arguments. Now call message can be [call fn x1 x2 y1=z1 y2=z2]

Scripting / API Enhancements

  • Added patcher scripting methods to api.Patcher

  • Added generic api.MaxObject object for improved scripting options.

  • Added tests and tested methods for api.Binbuf object.

  • Added buffer protocol support to api.Buffer with numpy test

  • Combined buffer tests (except numpy and array tests) into test_buffer.py and test_buffer.maxpat

  • Added additional message method support for api.Buffer

  • Added auto-resizing to api.Buffer.set_samples and methods to set duration, samplerate as well as methods for generic message sending to a buffer for examples "fill" operations.

  • Added api.Patcher object to facilitate patcher-scripting from python.

  • Added additional capabilities and tests to Buffer extension in the api module. This includes retrieval by buffer name, buffer creation, setting / getting samples from python code using either python's builtin array module or numpy, and a set of demonstrative set of tests:

    pure python tests:

    • examples/tests/test_buffer.py
    • examples/tests/test_buffer_np.py
    • examples/tests/test_buffer_array.py

    patcher tests:

    • patchers/tests/test_buffer_np.maxpat
    • patchers/tests/test_buffer_array.maxpat
    • examples/tests/test_buffer_resize.maxpat

Builder Enhancements

  • Added make release for automatic packaging, codesigning, notarizing of pyjs externals.

  • Improved shared-ext, static-ext, shared-tiny-ext, static-tiny-ext variants for python 3.12

  • Added unstable proof-of-concept for building python via cmake. Next step will be to integrate this into the builder system. This capability is provided courtesy of the python-cmake-buildsystem project, but the python tests fails so this is a work-in-progress

  • Added builder.factory.FactoryManager to encapsulate dispatch functions.

  • Made it easier to build specific python versions (3.7 - 3.12) by providing an optional environment parameter. If provided, the specific version will be downloaded from python.org and used as follows:

    # build both python variant and external
    
    make shared-ext PYTHON_VERSION=3.7.17
    
    # or to build python variant only
    
    make python-shared-ext PYTHON_VERSION=3.7.17
    
    # and then use that to build the external
    
    make build-shared-ext PYTHON_VERSION=3.7.17
  • Added patch/3.8/setup-static-min6.local to enable tiny variants in python 3.8

  • Added shared-tiny-ext Makefile target which is the shared lib counterpart to static-tiny-ext.

  • Added log-<variant> Makefile targets for timed and file logged builds

  • Slight Reduction of builder-based externals' size by removing deprecated modules including distutils.