Skip to content

Releases: shakfu/py-js

Python 3.13.0 externals for Max/MSP

11 Oct 14:58
Compare
Choose a tag to compare

This 0.3.0 release includes py and pyjs externals for macOS based on the recently released Python 3.13.0 engine.

One positive outcome of this Python version change is that externals are measurably smaller than the prior release due to the removal of a number of deprecated modules.

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 extended overview of the specific differences between these variants, but basically the '-ext' suffix in the name means a self-contained Max external, the '-pkg' suffix means a Max package where the externals in the 'externals' folder depend on the python library in the 'support' folder:

  • shared-ext: self-contained external, fully loaded, dynamically linked.
  • shared-ext-tiny: self-contained external, size-minimized, dynamically linked.
  • static-ext: self-contained external, fully loaded, statically linked.
  • static-ext-tiny: self-contained external, size-minimized, statically linked.
  • framework-ext: self-contained external, fully loaded, built as a framework (dynamically linked).
  • framework-pkg: package-structure, Python.framework is in the support folder of the package with the py and pyjs externals linked to it.
  • homebrew-ext: self-contained external, fully loaded, built as a framework, (dynamically linked) but smaller than framework-ext.
  • homebrew-pkg: package-structure, Python.framework is in the support folder of the package with the py and pyjs externals linked to it (smaller than framework-pkg).

Variants which embed numpy have the -np suffix in their name:

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

Coming relatively soon after the prior 0.2.6 release, it only includes the following bug fixes, changes and enhancements:

  • Added support for Python 3.13.x

  • Added make install-numpy for automatically building and adding a shrunk version of numpy to the previously built external or package

Python 3.12.4 externals for Max/MSP

14 Jun 23:47
Compare
Choose a tag to compare

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.

Python 3.11.6+numpy externals for Max (pre-release)

06 Nov 18:46
Compare
Choose a tag to compare

This pre-release contains two pairs of codesigned and notarized Python 3.11.6 externals (py and pyjs) based on the minimal shared-tiny-ext variant.

Notably,

  1. The first pair includes a tiny (9.1 MB) version of py which contains a greatly enhanced builtin api module that wraps a decent subset of the Max c-api.

    The revised api module now includes a bunch of cython extension classes which correspond to Max objects and data-structures: MaxObject, Atom, Table, Buffer, Dictionary, Database, Binbuf, Atombuf, Patcher, and PyExternal.

    The Buffer class in particular, thanks to feedback from @jamesb93 now enables array-based modules such as the builtin array module and numpy to efficiently read from and write to buffer~ objects.

    A group of pure python tests for the api module are included in the examples/tests folder with related test patchers in the patchers/tests folder.

  2. The numpy version of the py external contains everything in (1) but also includes a recent version of numpy as well (but without the BLAS and LAPACK linear algebra libraries), and is around 20.9 MB in size.

  3. In addition, the latest version of the pyjs javascript extension is included to enable a bridge between python3 and the javascript Max api inside the [js] object (but without the api module or numpy) at around 8.1 MB in size.

Enjoy!

Python 3.11.2+ externals for Max

04 Apr 04:42
Compare
Choose a tag to compare

This release provides updated py and pyjs externals for macOS running Python 3.11.2 and also a handful of alternative builds with Python 3.8.x, Python 3.7.15 and Python 3.11.4 to demonstrate size variation across versions and build variants.

  • The externals come in a number of build variants (for both x86_64 and arm64 architectures) and are all signed and notarized (i.e can be used in Max Packages and Standalones).

  • A new addition to the build variants is the static-tiny-ext external which is designed to be as small and as functional as possible.

  • All externals include an updated api builtin module based on a cython wrapper of a subset of the max api.

  • All (x86_64 macOS Intel) externals are now compiled, packaged, signed and notarized using a GitHub workflow which should make it easier for future releases. Hopefully in the future it will be possible to also produce (arm64 Apple Silicon) versions using the same process.

  • An improved release infrastructure was developed to make it easier to sign, package, notarize and staple external distributions using the Makefile frontend. This was used to release the arm64 externals below.

  • A new variant, and a late addition to the release: shared-tiny-ext is the shared lib sibling of static-tiny-ext.