Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
87fc365
Tests for operators on type CS type with codec
gertdreyer Feb 23, 2024
01d6772
Bugfix: RecursionError when reverse/righthand operations invoked. e.g…
gertdreyer Feb 21, 2024
d3bde9d
Update Authors and Changelog
gertdreyer Feb 23, 2024
1542cc9
Normalized names. Added HashCode and Equals to testing objects
gertdreyer Feb 26, 2024
71ca063
Cleanup Codec/Argument Reversing Passing.
gertdreyer Feb 26, 2024
9d18a24
Added `ToPythonAs<T>()` extension method to allow for explicit conver…
lostmsu Feb 28, 2024
563e369
IComparable and IEquatable implementations for PyInt, PyFloat, and Py…
lostmsu Feb 15, 2024
6a8a97d
Fix CI by using macos-13 explicitly, adjust OS config (#2373)
filmor May 5, 2024
195cde6
Use non-BOM encodings (#2370)
filmor May 10, 2024
32051cb
Expose serialization api (#2336)
BadSingleton May 10, 2024
b112885
handle bad paths in sys.path (#2383)
lostmsu May 11, 2024
4e5afdf
Fix access violation exception on shutdown (#1977)
Frawak May 13, 2024
6f0f671
Restrict first garbage collection
Frawak May 13, 2024
f82aeea
Simplify UTF8 StrPtr usage (#2374)
filmor Jun 8, 2024
9ebfbde
Fix crash when event does not have `Add` method and improve message f…
lostmsu Jul 2, 2024
c99cdf3
Throw exception trying to add a reflected object after the hashset is…
Frawak Jul 8, 2024
6cdd6d7
Move reflected object creation block
Frawak Aug 5, 2024
ea059ca
Merge pull request #2386 from Frawak/fix/1977-access-violation-gc
lostmsu Aug 6, 2024
6690310
Bump to 3.0.4
filmor Sep 19, 2024
5c50b20
Back to dev
filmor Sep 19, 2024
de7a1d2
Drop console application (#2456)
filmor Oct 1, 2024
0ea1d29
Drop reference to Py_Main (#2504)
filmor Nov 8, 2024
7a9e3bf
Stick to ubuntu-22.04 for now as that image still contains Mono
filmor Dec 11, 2024
5cf2534
First attempt at Python 3.13
filmor Sep 19, 2024
2f3a0e7
Add Python 3.13 to CI
filmor Oct 25, 2024
5a7b5be
Update project file
filmor Oct 25, 2024
f3face0
Use PyThreadState_GetUnchecked on Python 3.13
filmor Dec 11, 2024
88d98f2
Workaround for geninterop failure to handle non-pointer fields
filmor Dec 12, 2024
4bb673f
Bump clr-loader and dev dependencies
filmor Dec 12, 2024
8283627
Raise maximum supported version
filmor Dec 12, 2024
1920b19
Xfail a test that only fails locally on my machine right now
filmor Dec 12, 2024
60a057f
Skip embed tests on Python 3.13 for now
filmor Dec 13, 2024
8f0ccb7
Add changelog entry
filmor Dec 13, 2024
7c87fec
Workaround for setuptools bug #4759
filmor Dec 13, 2024
0ea8e6f
Remove win-x86-py3.13 entirely for now
filmor Dec 13, 2024
4132a36
Merge pull request #2454 from pythonnet/python3.13
filmor Dec 13, 2024
0826fc0
Release 3.0.5
filmor Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@ on:
jobs:
build-test:
name: Build and Test
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os.instance }}
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
os: [windows, ubuntu, macos]
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [x64, x86]
exclude:
- os: ubuntu
platform: x86
- os: macos
os:
- category: windows
platform: x86
instance: windows-latest

- category: windows
platform: x64
instance: windows-latest

- category: ubuntu
platform: x64
instance: ubuntu-22.04

- category: macos
platform: x64
instance: macos-13

python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

# This fails in pytest with:
# CSC : error CS4023: /platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe [D:\a\pythonnet\pythonnet\src\runtime\Python.Runtime.csproj]
exclude:
- os: { category: windows, platform: x86 }
python: ["3.13"]

steps:
- name: Set Environment on macOS
uses: maxim-lobanov/setup-xamarin@v1
if: ${{ matrix.os == 'macos' }}
if: ${{ matrix.os.category == 'macos' }}
with:
mono-version: latest

Expand All @@ -43,7 +59,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.platform }}
architecture: ${{ matrix.os.platform }}

- name: Install dependencies
run: |
Expand All @@ -55,42 +71,44 @@ jobs:
pip install -v .

- name: Set Python DLL path and PYTHONHOME (non Windows)
if: ${{ matrix.os != 'windows' }}
if: ${{ matrix.os.category != 'windows' }}
run: |
echo PYTHONNET_PYDLL=$(python -m find_libpython) >> $GITHUB_ENV
echo PYTHONHOME=$(python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV

- name: Set Python DLL path and PYTHONHOME (Windows)
if: ${{ matrix.os == 'windows' }}
if: ${{ matrix.os.category == 'windows' }}
run: |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(python -m find_libpython)"
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=$(python -c 'import sys; print(sys.prefix)')"

- name: Embedding tests
run: dotnet test --runtime any-${{ matrix.platform }} --logger "console;verbosity=detailed" src/embed_tests/
if: ${{ matrix.python != '3.13' }}
run: dotnet test --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/embed_tests/
env:
MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466

- name: Python Tests (Mono)
if: ${{ matrix.os != 'windows' }}
if: ${{ matrix.os.category != 'windows' }}
run: pytest --runtime mono

# TODO: Run these tests on Windows x86
- name: Python Tests (.NET Core)
if: ${{ matrix.platform == 'x64' }}
if: ${{ matrix.os.platform == 'x64' }}
run: pytest --runtime coreclr

- name: Python Tests (.NET Framework)
if: ${{ matrix.os == 'windows' }}
if: ${{ matrix.os.category == 'windows' }}
run: pytest --runtime netfx

- name: Python tests run from .NET
run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/
if: ${{ matrix.python != '3.13' }}
run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/

- name: Perf tests
if: ${{ (matrix.python == '3.8') && (matrix.platform == 'x64') }}
if: ${{ (matrix.python == '3.8') && (matrix.os.platform == 'x64') }}
run: |
pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2
dotnet test --configuration Release --runtime any-${{ matrix.platform }} --logger "console;verbosity=detailed" src/perf_tests/
dotnet test --configuration Release --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/perf_tests/

# TODO: Run mono tests on Windows?
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse))
- Félix Bourbonnais ([@BadSingleton](https://github.com/BadSingleton))
- Florian Treurniet ([@ftreurni](https://github.com/ftreurni))
- Frank Witscher ([@Frawak](https://github.com/Frawak))
- He-chien Tsai ([@t3476](https://github.com/t3476))
- Inna Wiesel ([@inna-w](https://github.com/inna-w))
- Ivan Cronyn ([@cronan](https://github.com/cronan))
Expand Down Expand Up @@ -86,3 +87,4 @@
- ([@gpetrou](https://github.com/gpetrou))
- Ehsan Iran-Nejad ([@eirannejad](https://github.com/eirannejad))
- ([@legomanww](https://github.com/legomanww))
- ([@gertdreyer](https://github.com/gertdreyer))
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,38 @@ project adheres to [Semantic Versioning][].

This document follows the conventions laid out in [Keep a CHANGELOG][].

## [Unreleased][]
## [3.0.5](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.5) - 2024-12-13

### Added

- Support for Python 3.13 (#2454)


## [3.0.4](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.4) - 2024-09-19

### Added

- Added `ToPythonAs<T>()` extension method to allow for explicit conversion
using a specific type. ([#2311][i2311])
- Added `IComparable` and `IEquatable` implementations to `PyInt`, `PyFloat`,
and `PyString` to compare with primitive .NET types like `long`.

### Changed

- Added a `FormatterFactory` member in RuntimeData to create formatters with
parameters. For compatibility, the `FormatterType` member is still present
and has precedence when defining both `FormatterFactory` and `FormatterType`
- Added a post-serialization and a pre-deserialization step callbacks to
extend (de)serialization process
- Added an API to stash serialized data on Python capsules

### Fixed

- Fixed RecursionError for reverse operators on C# operable types from python. See #2240
- Fixed crash when .NET event has no `AddMethod`
- Fixed probing for assemblies in `sys.path` failing when a path in `sys.path`
has invalid characters. See #2376
- Fixed possible access violation exception on shutdown. See ([#1977][i1977])

## [3.0.3](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.3) - 2023-10-11

Expand Down Expand Up @@ -959,3 +983,5 @@ This version improves performance on benchmarks significantly compared to 2.3.
[i238]: https://github.com/pythonnet/pythonnet/issues/238
[i1481]: https://github.com/pythonnet/pythonnet/issues/1481
[i1672]: https://github.com/pythonnet/pythonnet/pull/1672
[i2311]: https://github.com/pythonnet/pythonnet/issues/2311
[i1977]: https://github.com/pythonnet/pythonnet/issues/1977
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ license = {text = "MIT"}
readme = "README.rst"

dependencies = [
"clr_loader>=0.2.6,<0.3.0"
"clr_loader>=0.2.7,<0.3.0"
]

requires-python = ">=3.7, <3.13"
requires-python = ">=3.7, <3.14"

classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -27,13 +27,23 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
]

dynamic = ["version"]

[dependency-groups]
dev = [
"pytest >= 6",
"find_libpython >= 0.3.0",
"numpy >=2 ; python_version >= '3.10'",
"numpy <2 ; python_version < '3.10'",
"psutil"
]

[[project.authors]]
name = "The Contributors of the Python.NET Project"
email = "pythonnet@python.org"
Expand All @@ -45,6 +55,7 @@ Sources = "https://github.com/pythonnet/pythonnet"
[tool.setuptools]
zip-safe = false
py-modules = ["clr"]
license-files = []

[tool.setuptools.dynamic.version]
file = "version.txt"
Expand Down
2 changes: 0 additions & 2 deletions pythonnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime", "src\runtime\Python.Runtime.csproj", "{4E8C8FE2-0FB8-4517-B2D9-5FB2D5FC849B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console", "src\console\Console.csproj", "{E6B01706-00BA-4144-9029-186AC42FBE9A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest", "src\embed_tests\Python.EmbeddingTest.csproj", "{819E089B-4770-400E-93C6-4F7A35F0EA12}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test", "src\testing\Python.Test.csproj", "{14EF9518-5BB7-4F83-8686-015BD2CC788E}"
Expand Down
27 changes: 0 additions & 27 deletions src/console/Console.csproj

This file was deleted.

Binary file removed src/console/python-clear.ico
Binary file not shown.
Binary file removed src/console/python-clear.png
Binary file not shown.
82 changes: 0 additions & 82 deletions src/console/pythonconsole.cs

This file was deleted.

9 changes: 9 additions & 0 deletions src/embed_tests/TestConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ public void RawPyObjectProxy()
Assert.AreEqual(pyObject.DangerousGetAddressOrNull(), proxiedHandle);
}

[Test]
public void GenericToPython()
{
int i = 42;
var pyObject = i.ToPythonAs<IConvertible>();
var type = pyObject.GetPythonType();
Assert.AreEqual(nameof(IConvertible), type.Name);
}

// regression for https://github.com/pythonnet/pythonnet/issues/451
[Test]
public void CanGetListFromDerivedClass()
Expand Down
Loading
Loading