- ScalaPy is now published under the
dev.scalapyorganization - Add
py.execmethod, allowing to execute a piece of Python code (PR #299) - Exceptions thrown by Python APIs are now printed with a stack trace that includes both Scala and Python components (PR #297)
- Fix facades with methods taking empty-parens parameters reading an attribute instead of calling a function on Scala 3 (PR #313)
- Fix crashes due to
py.localcleaning up the underlyingPyValueof static facades (PR #313)
- No longer try to load other Python library versions when the one specified by user fails to load (PR #270)
- ScalaPy now tries to load the latest Python version first if no specific version was set by user (PR #273)
- Fix crashes in the
py.nativemacro when taking lambda parameters in Scala 3 (PR #237) - Avoid compiler crashes when accessing dynamic fields and methods whose names collide with internal names (PR #247)
- Fix instructions for
python-native-libsin Getting Started guide (PR 249) - Fix implicit resolution bugs when converting Scala collections to Python (PR #253)
- Fix Scala 3 compiler errors due to
@py.nativeandpy.nativebeing defined in separate files (PR #278)
- Add initial support for Scala 3. To create static facades use
classinstead oftraitin Scala 3 (PR #195, PR #225) - Add support for bracket syntax to facades. The annotation
@PyBracketAccesscan be used on methods to mark them as representing bracket access on an object. The target method must have one (to read the value) or two parameters (to update the value) (PR #194). - The version of the Python native library can now be controlled with the
scalapy.python.librarysystem property (PR #198) - Enable running
Py_SetProgramNamewith user provided input prior toPy_Initializeto set the correct paths to Python run-time libraries. Input toPy_SetProgramName, the Python interpreter executable, can be controlled with either thescalapy.python.programnamesystem property or theSCALAPY_PYTHON_PROGRAMNAMEenvironment variable (PR #200) - Add instructions on how to set up a ScalaPy sbt project using
python-native-libs(PR #210)
- Raise a
NameErrorexception when attempting to call a function or access a variable that does not exist in the global namespace (PR #207)
- Significantly optimize transfers from Scala to Python, which are now up to 5x faster on the JVM and 4x faster on Scala Native (PR #179)
- Optimize transfers from Python to Scala, which are now up to 4x faster on the JVM and 3x faster on Scala Native (PR #183)
- Introduce a pre-alpha type facade generator that generates Scala types through mypy (PR #110)
- This is pre-alpha in the sense that types generated for any module, including Python builtins, are likely to require manual patching to compile
- However, with a bit of patching, the types for many libraries are good enough to use directly without having to fall back to dynamic interfaces
- The current type generator has been merged as a very experimental feature just so that others in the community can try it out. It will be rewritten in the near future with a cleaner architecture that will enable generation of more complex types correctly.
- Python values can now be loaded into any immutable Scala collection type as a copy, not just
Seq(PR #179) - Allow converting nested sequences to Python using a single call to
toPythonCopyortoPythonProxy(PR #178) - Add API equivalents for the Python
delkeyword (del foo.bar,del foo["key"], anddel foo) (PR #175, PR #177) - Support referential equality of Python values with a corresponding hash-code implementation (PR #110)
- Reading a Python collection as an immutable sequence will now load a copy. To load a proxy that can observe changes, load sequences with
.as[mutable.Seq[...]](PR #179) - Calling the
applymethod on apy.Dynamicvalue will now directly call the original value as-is instead of theapplymethod of the value in Python (PR #177)- To call the original value with keyword arguments, you can use the new
applyNamedAPI, passing in tuples of keyword arguments and values - To call the original
applymethod in Python, useapplyDynamicexplicitly (myValue.applyDynamic("apply")(arg1, arg2, ...))
- To call the original value with keyword arguments, you can use the new
- Upgrade Scala Native to 0.4.0, which brings support for Scala 2.12 and 2.13 (PR #147)
- Add support for Python 3.8 and 3.9 (PR #139)
- Support for Scala 2.11 has been dropped in order to focus efforts on 2.12/2.13 (PR #147)
- Fix Python library loading on the JVM to correctly fall back to other library names (PR #132)
- Add
python3.7mto the default list of Python native libraries to search for, since Conda does not exposepython3.7(without them) (PR #119) - Add a writer for
Unitthat generates aNonevalue, which is useful for callbacks that don't return anything (PR #120)
- The JVM interface to Python has been completely rewritten from scratch to share all of its logic with the Scala Native backend by binding directly to CPython with JNA. This means that moving forward, ScalaPy JVM and Native will always have the same features and use near-identical logic for talking to Python libraries
- Readers and Writers have been simplified to always work in terms of Python interpreter values, simplifying the implementation and reducing intermediate allocations
- Adds support for sending Scala functions into Python as lambdas, and reading Python lambdas into Scala functions
- Adds proxy collections, which are Python objects that wrap over Scala collections instead of copying the underlying data
- Introduces
StaticModuleAPI for loading modules into statically-typed objects - Expands support of
bracketAccessto anypy.Anytype for the index - Adds
bracketUpdateAPI to perform the equivalent of a Pythonobj[key] = newValue - The version of the Python native library can now be controlled with
SCALAPY_PYTHON_LIBRARY
- Renamed
py.globaltopy.Dynamic.globalto emphasize that global access through it is not type-safe - Drops automatic conversion of Scala collections to Python in favor of
toPythonCopyandtoPythonProxymethods from thepy.SeqConvertersextension - Renames
arrayAccesstobracketAccess - The
CPythonInterpreterobject should now be used to access low-level interpreter functions instead ofpy.interpreter
- Various reference count synchronization bugs have been fixed to ensure that Python values are not being leaked or used after being freed
- Fix a segfault in Scala Native when the interpreter is initialized outside of a
py.local { ... }block - Correctly handle reading a list-like object (such as a NumPy array) into a
Seq
- ScalaPy now has a website! Check it out at scalapy.dev
- The
py""interpolator now makes it possible to interpret bits of Python code with references to Scala values
py.Anyis now the default type taken in and returned by operations- The apply method of
py.Objectto interpret abritrary strings has been replaced by theeval()method. py.DynamicObjecthas been renamed topy.Dynamicto better match the Scala.js naming scheme- Casting to
DynamicObjectwith.asInstanceOf[DynamicObject]has been replaced by just calling.as[Dynamic] - Facades are now declared as
@py.native trait MyFacade extends Object { ... }instead of a class that extendsObjectFacade(which has been removed)