Releases: tonybaloney/CSnakes
v1.0.35
What's Changed
Major updates
Simple Async return Syntax
Simple async return type syntax is now supported. Where previously you needed to annotate a function as Coroutine[TYield, TSend, TReturn]
the source generator supports simple return types, e.g.:
async def example() -> list[int]:
...
Package install API
If you need to install a single, or multiple packages at runtime using pip
or uv pip
you can use the IPythonPackageInstaller
.InstallPackageand
.InstallPackages` methods. See docs for more details
Disable Signal Handlers
Python will automatically install signal handlers to capture CTRL+C (SIGINT) or SIGTERM. There is now an extension method on IPythonEnvironmentBuilder
to .DisableSignalHandlers()
see docs for an example. This feature is opt-in, so the default remains that Python will handle SIGINT whilst Python has been activated. Carefully consider where in your process you want to handle SIGINT.
Better error reporting in source generation
If the source generator sees invalid syntax, it will now provide more robust and detailed reporting, see #395 for more details.
Dev Updates
- Simple async return type syntax by @tonybaloney in #484
- Run type checkers in CI by @tonybaloney in #483
- Fix reload hashes in test snapshots by @atifaziz in #487
- Start work on a roadmap document by @tonybaloney in #477
- Add .NET 10 preview 4 to test pipelines by @tonybaloney in #472
- Upgrade to the new CreateApplicationBuilder .NET Generic Host by @copilot-swe-agent in #490
- Migrate from xUnit 2.9.3 to xUnit 3 by @copilot-swe-agent in #492
Bug Fixes
- Add missing disposal of buffer exporters in proxies by @atifaziz in #488
- Discard result when function returns
None
by @atifaziz in #493 - Fix Python parameter parsing to reject invalid syntax by @atifaziz in #395
- Fix bug where Python arg name was used on C# side by @atifaziz in #498
New Contributors
- @copilot-swe-agent made their first contribution in #490
Full Changelog: v1.0.34...v1.0.35
v1.0.34
What's Changed
This release is mostly a bugfix release, including several optimizations to the PyBuffer
implementation.
Bug fixes
- Change all spawned processes to use argument lists. Add
InstallPackage
toIPythonPackageInstaller
by @tonybaloney in #470 - Fix memory leak in
PythonRunString
by @atifaziz in #458 - Fix leaks by making
IPyBuffer
disposable by @atifaziz in #469
Performance improvements
- Reduce allocations, leaks & decoding when embedding source by @atifaziz in #455
- Use by-ref initialisation of
Py_buffer
by @atifaziz in #466 - Use by-ref release of
Py_buffer
by @atifaziz in #467 - Make
PyBuffer
constructor safe by @atifaziz in #468
Full Changelog: v1.0.33...v1.0.34
v1.0.33
What's Changed
Highlights:
- Async function calls are 50-70% faster
- Loggers are no longer required when establishing environments
Performance Improvements
- Refactor to use a single event loop for coroutines by @atifaziz in #438
- Make all loggers & logging optional by @atifaziz in #446
- Improve performance with per-type overloads for
PyObject.From
by @atifaziz in #445
Features
- (Experimental) Optionally embed source code for modules in generated classes by @tonybaloney in #451
- Implement truthy-falsy for
PyObject
by @atifaziz in #437
Other
- Update test-related packages to their latest versions by @atifaziz in #439
- Fix typo in error message when configuring Conda environment by @atifaziz in #444
Full Changelog: v.1.32.0...v1.0.33
v1.0.32
What's Changed
- Async methods are now cancelleable via CancellationTokens
- A general performance guide is now available on the docs
- Optional parameters are marked as nullable even when they don't have a default value of
None
- Optional returns are typed as nullable
General Improvements
- Add
CancellationToken
parameter to generated async methods by @atifaziz in #431 - Make generator iterator disposal idempotent by @atifaziz in #423
- Make GIL acquisition a
ref struct
by @atifaziz in #430 - Make coroutine task result to be just
TYield
by @atifaziz in #425 - Add a doc page on performance considerations by @tonybaloney in #421
- Fix optionality of function parameters & return by @atifaziz in #299
Bug fixes
- Fix
CancellationToken
parameters to be non-nullable by @atifaziz in #424 - Fix
AsEnumerable
semantics by @atifaziz in #432
Other changes
- Add a generator buffer test by @tonybaloney in #422
- Use positional ordinals consistently for tuple test data by @atifaziz in #428
- Fix typo in GIL check error message by @atifaziz in #426
- Skip C# proxies for underscored functions by @atifaziz in #427
- Remove recognition of
typing.Buffer
that never was by @atifaziz in #429 - Use "Basic.Reference.Assemblies" to simplify test compilation setup by @atifaziz in #262
- Use
BenchmarkSwitcher
in profiling project by @atifaziz in #433 - Add memory diagnoser to benchmarks by @atifaziz in #434
- Refresh doc on
CancellationToken
support by @atifaziz in #436
Full Changelog: v1.0.31...v.1.32.0
v1.0.31
What's Changed
This project includes experimental NativeAOT support if you use the source generator.
Performance improvements
Functions returning tuples will be 20-30% faster:
- Move known conversions to (AOT-friendly) generated code by @atifaziz in #413
- Return immortals from
PyObject.From
forlong
+BigInteger
by @atifaziz in #417
Bug Fixes
- More rebust search for conda source folder by @gukoff in #391
- Fix
PyObject.As
forint
on LP64 & LLP64 by @atifaziz in #415 - Fix formatting inconsistencies by @atifaziz in #389
- Fix
FromRedistributable
overload resolution error by @atifaziz in #409 - Add missing
System.Threading.Tasks
import in generated code by @atifaziz in #410
Other Changes
- Remove prototype warning by @tonybaloney in #411
- Refactor benchmarks into two suites by @tonybaloney in #419
- Demo AOT built project by @tonybaloney in #382
- Allow run Conda tests with Miniconda3 by @gabrielgt in #384
- Typo: imortals -> immortals by @gukoff in #392
- Use PolySharp package for poly-filling by @atifaziz in #386
New Contributors
- @gabrielgt made their first contribution in #384
- @gukoff made their first contribution in #392
Full Changelog: v1.0.30...v1.0.31
v1.0.30
What's Changed
Bug Fixes
sys.executable
is now thepython
executable path instead of the .NET host process. Stops confusion from packages (like spacy) which assume you can callsys.executable
to pip install packages. PR by @tonybaloney in #380- Make GIL disposal idempotent once disposed by @atifaziz in #372
Improvements
- Create no window on pip and virtualenv commands by @tonybaloney in #376
Other
- Add basic tests to exercise GIL management by @atifaziz in #373
- Cleanup dependencies now that .NET 9 has hit RTM by @buvinghausen in #375
New Contributors
- @buvinghausen made their first contribution in #375
Full Changelog: v1.0.29...v1.0.30
v1.0.29
What's Changed
- Fix crash on GIL acquisition within pybind11 extensions by @tonybaloney in #369
Full Changelog: v1.0.28...v1.0.29
v1.0.28
What's Changed
.FromRedistributable()
locator now has arguments for Python version (3.9-3.14), free-threaded builds and debug builds.
Other Changes
- Fix warning by @AaronRobinsonMSFT in #356
- Avoid freeze if initialization fails by @atifaziz in #360
- Allow choosing the Python version from redistrib by @tonybaloney in #365
- Remove no longer needed initialization lock by @atifaziz in #363
Full Changelog: v1.0.27...v1.0.28
v1.0.27
What's Changed
- Add support for async functions by @tonybaloney in #313
- Update versions for Python static build to 3.12.9 by @tonybaloney in #349
Full Changelog: v1.0.26...v1.0.27
v1.0.26
What's Changed
- Fix
PATH
path separator in package installers by @atifaziz in #336 - Add ARM64 on Windows path locators by @tonybaloney in #339
- Reduce memory load of redistributable download by @atifaziz in #342
- Allow users to run Python code from a string by @tonybaloney in #340
- Allow trailing commas in parameter list by @tonybaloney in #344
- Configure awaits in
RedistributableLocator
to continue on any thread by @atifaziz in #345
Full Changelog: v1.0.25...v1.0.26