Skip to content

Commit 257a765

Browse files
committed
merge latest master
2 parents 3c0b737 + 23527d1 commit 257a765

File tree

241 files changed

+15337
-8896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+15337
-8896
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ csharp_new_line_before_finally = true
3434
[*.sln]
3535
indent_style = tab
3636

37+
[*.csproj]
38+
charset = utf-8
39+
insert_final_newline = true
40+
3741
# bumpversion reformats itself after every bump
3842
[.bumpversion.cfg]
3943
trim_trailing_whitespace = false

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Pythonnet version:
44
- Python version:
55
- Operating System:
6+
- .NET Runtime:
67

78
### Details
89

.github/workflows/main.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: GitHub Actions
2+
3+
on: [ pull_request, push ]
4+
5+
jobs:
6+
build-test:
7+
name: Build and Test
8+
runs-on: ${{ matrix.os }}-latest
9+
timeout-minutes: 5
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [windows, ubuntu, macos]
15+
python: ["3.6", "3.7", "3.8", "3.9"]
16+
platform: [x64]
17+
shutdown_mode: [Normal, Soft]
18+
19+
env:
20+
PYTHONNET_SHUTDOWN_MODE: ${{ matrix.SHUTDOWN_MODE }}
21+
22+
steps:
23+
- name: Set Environment on macOS
24+
uses: maxim-lobanov/setup-xamarin@v1
25+
if: ${{ matrix.os == 'macos' }}
26+
with:
27+
mono-version: latest
28+
29+
- name: Checkout code
30+
uses: actions/checkout@v2
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v1
34+
35+
- name: Set up Python ${{ matrix.python }}
36+
uses: actions/setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python }}
39+
architecture: ${{ matrix.platform }}
40+
41+
- name: Install dependencies
42+
run: |
43+
pip install --upgrade -r requirements.txt
44+
45+
- name: Build and Install
46+
run: |
47+
pip install -v .
48+
49+
- name: Set Python DLL path (non Windows)
50+
if: ${{ matrix.os != 'windows' }}
51+
run: |
52+
python -m pythonnet.find_libpython --export >> $GITHUB_ENV
53+
54+
- name: Set Python DLL path (Windows)
55+
if: ${{ matrix.os == 'windows' }}
56+
run: |
57+
python -m pythonnet.find_libpython --export | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
58+
59+
- name: Python Tests (Mono)
60+
if: ${{ matrix.os != 'windows' }}
61+
run: pytest --runtime mono
62+
63+
- name: Python Tests (.NET Core)
64+
run: pytest --runtime netcore
65+
66+
- name: Python Tests (.NET Framework)
67+
if: ${{ matrix.os == 'windows' }}
68+
run: pytest --runtime netfx
69+
70+
- name: Embedding tests
71+
run: dotnet test --runtime any-${{ matrix.platform }} src/embed_tests/
72+
73+
- name: Python tests run from .NET
74+
run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/
75+
76+
# TODO: Run perf tests
77+
# TODO: Run mono tests on Windows?

.github/workflows/nuget-preview.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: NuGet Preview Release
2+
3+
on:
4+
schedule:
5+
- cron: "5 4 3 */1 *" # once a month, at 4:05 on 3rd
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
name: Release Preview
11+
runs-on: ubuntu-latest
12+
environment: NuGet
13+
timeout-minutes: 10
14+
15+
env:
16+
PYTHONNET_SHUTDOWN_MODE: Normal
17+
18+
steps:
19+
- name: Get Date
20+
run: |
21+
echo "DATE_VER=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
22+
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v1
28+
29+
- name: Set up Python 3.8
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 3.8
33+
architecture: x64
34+
35+
- name: Install dependencies
36+
run: |
37+
pip install --upgrade -r requirements.txt
38+
39+
- name: Build and Install
40+
run: |
41+
pip install -v .
42+
43+
- name: Python Tests
44+
run: pytest
45+
env:
46+
PYTHONNET_PYDLL: libpython3.8.so
47+
48+
- name: Embedding tests
49+
run: dotnet test --runtime any-ubuntu src/embed_tests/
50+
env:
51+
PYTHONNET_PYDLL: libpython3.8.so
52+
53+
- name: Pack
54+
run: dotnet pack --configuration Release --version-suffix preview${{env.DATE_VER}} --output "Release-Preview"
55+
56+
- name: Publish NuGet
57+
run: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_MONTHLY }} Release-Preview/*.nupkg
58+
59+
# TODO: Run perf tests
60+
# TODO: Run mono tests on Windows?

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
/src/runtime/interopNative.cs
2+
13
# General binaries and Build results
24
*.dll
35
*.exe
46
*.pdb
7+
*.deps.json
58

69
### JetBrains ###
710
.idea/
@@ -15,6 +18,7 @@ __pycache__/
1518
build/
1619
dist/
1720
*.egg-info/
21+
.eggs/
1822

1923
# Unit test / coverage reports
2024
htmlcov/

.travis.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

AUTHORS.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@
2020
- Alexandre Catarino([@AlexCatarino](https://github.com/AlexCatarino))
2121
- Andrey Sant'Anna ([@andreydani](https://github.com/andreydani))
2222
- Arvid JB ([@ArvidJB](https://github.com/ArvidJB))
23+
- Avinash Maddikonda ([@SFM61319](https://github.com/SFM61319))
2324
- Benoît Hudson ([@benoithudson](https://github.com/benoithudson))
2425
- Bradley Friedman ([@leith-bartrich](https://github.com/leith-bartrich))
2526
- Callum Noble ([@callumnoble](https://github.com/callumnoble))
27+
- Christabella Irwanto([@christabella](https://github.com/christabella))
2628
- Christian Heimes ([@tiran](https://github.com/tiran))
2729
- Christoph Gohlke ([@cgohlke](https://github.com/cgohlke))
2830
- Christopher Bremner ([@chrisjbremner](https://github.com/chrisjbremner))
2931
- Christopher Pow ([@christopherpow](https://github.com/christopherpow))
32+
- Daniel Abrahamsson ([@danabr](https://github.com/danabr))
3033
- Daniel Fernandez ([@fdanny](https://github.com/fdanny))
3134
- Daniel Santana ([@dgsantana](https://github.com/dgsantana))
3235
- Dave Hirschfeld ([@dhirschfeld](https://github.com/dhirschfeld))
3336
- David Lassonde ([@lassond](https://github.com/lassond))
3437
- David Lechner ([@dlech](https://github.com/dlech))
3538
- Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse))
39+
- Félix Bourbonnais ([@BadSingleton](https://github.com/BadSingleton))
3640
- Florian Treurniet ([@ftreurni](https://github.com/ftreurni))
3741
- He-chien Tsai ([@t3476](https://github.com/t3476))
3842
- Inna Wiesel ([@inna-w](https://github.com/inna-w))
@@ -57,21 +61,25 @@
5761
- Sean Freitag ([@cowboygneox](https://github.com/cowboygneox))
5862
- Serge Weinstock ([@sweinst](https://github.com/sweinst))
5963
- Simon Mourier ([@smourier](https://github.com/smourier))
64+
- Tom Minka ([@tminka](https://github.com/tminka))
6065
- Viktoria Kovescses ([@vkovec](https://github.com/vkovec))
6166
- Ville M. Vainio ([@vivainio](https://github.com/vivainio))
6267
- Virgil Dupras ([@hsoft](https://github.com/hsoft))
6368
- Wenguang Yang ([@yagweb](https://github.com/yagweb))
64-
- William Sardar ([@williamsardar])(https://github.com/williamsardar)
69+
- William Sardar ([@williamsardar](https://github.com/williamsardar))
6570
- Xavier Dupré ([@sdpython](https://github.com/sdpython))
6671
- Zane Purvis ([@zanedp](https://github.com/zanedp))
72+
- ([@amos402](https://github.com/amos402))
6773
- ([@bltribble](https://github.com/bltribble))
6874
- ([@civilx64](https://github.com/civilx64))
6975
- ([@GSPP](https://github.com/GSPP))
7076
- ([@omnicognate](https://github.com/omnicognate))
7177
- ([@OneBlue](https://github.com/OneBlue))
7278
- ([@rico-chet](https://github.com/rico-chet))
7379
- ([@rmadsen-ks](https://github.com/rmadsen-ks))
80+
- ([@SnGmng](https://github.com/SnGmng))
7481
- ([@stonebig](https://github.com/stonebig))
7582
- ([@testrunner123](https://github.com/testrunner123))
7683
- ([@DanBarzilian](https://github.com/DanBarzilian))
77-
84+
- ([@alxnull](https://github.com/alxnull))
85+
- ([@gpetrou](https://github.com/gpetrou))

CHANGELOG.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,73 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
99

1010
### Added
1111

12+
- Ability to instantiate new .NET arrays using `Array[T](dim1, dim2, ...)` syntax
13+
- Python operator method will call C# operator method for supported binary and unary operators ([#1324][p1324]).
14+
- Add GetPythonThreadID and Interrupt methods in PythonEngine
15+
- Ability to implement delegates with `ref` and `out` parameters in Python, by returning the modified parameter values in a tuple. ([#1355][i1355])
16+
- `PyType` - a wrapper for Python type objects, that also permits creating new heap types from `TypeSpec`
1217
- Improved exception handling:
1318
- exceptions can now be converted with codecs
1419
- `InnerException` and `__cause__` are propagated properly
15-
- .NET and Python exceptions are preserved when crossing Python/.NET boundary
1620

1721
### Changed
22+
- Drop support for Python 2, 3.4, and 3.5
23+
- `wchar_t` size aka `Runtime.UCS` is now determined at runtime
24+
- `clr.AddReference` may now throw errors besides `FileNotFoundException`, that provide more
25+
details about the cause of the failure
26+
- `clr.AddReference` no longer adds ".dll" implicitly
27+
- `PyIter(PyObject)` constructor replaced with static `PyIter.GetIter(PyObject)` method
28+
- BREAKING: Return values from .NET methods that return an interface are now automatically
29+
wrapped in that interface. This is a breaking change for users that rely on being
30+
able to access members that are part of the implementation class, but not the
31+
interface. Use the new __implementation__ or __raw_implementation__ properties to
32+
if you need to "downcast" to the implementation class.
33+
- BREAKING: Parameters marked with `ParameterAttributes.Out` are no longer returned in addition
34+
to the regular method return value (unless they are passed with `ref` or `out` keyword).
35+
- BREAKING: Drop support for the long-deprecated CLR.* prefix.
36+
- `PyObject` now implements `IEnumerable<PyObject>` in addition to `IEnumerable`
37+
- floating point values passed from Python are no longer silently truncated
38+
when .NET expects an integer [#1342][i1342]
39+
- More specific error messages for method argument mismatch
40+
- BREAKING: Methods with `ref` or `out` parameters and void return type return a tuple of only the `ref` and `out` parameters.
41+
- BREAKING: to call Python from .NET `Runtime.PythonDLL` property must be set to Python DLL name
42+
or the DLL must be loaded in advance. This must be done before calling any other Python.NET functions.
43+
- BREAKING: `PyObject.Length()` now raises a `PythonException` when object does not support a concept of length.
44+
- BREAKING: disabled implicit conversion from C# enums to Python `int` and back.
45+
One must now either use enum members (e.g. `MyEnum.Option`), or use enum constructor
46+
(e.g. `MyEnum(42)` or `MyEnum(42, True)` when `MyEnum` does not have a member with value 42).
47+
- Sign Runtime DLL with a strong name
48+
- Implement loading through `clr_loader` instead of the included `ClrModule`, enables
49+
support for .NET Core
50+
- .NET and Python exceptions are preserved when crossing Python/.NET boundary
51+
- BREAKING: custom encoders are no longer called for instances of `System.Type`
1852

1953
### Fixed
2054

21-
- Fix incorrect dereference of wrapper object in tp_repr, which may result in a program crash
55+
- Fix incorrect dereference of wrapper object in `tp_repr`, which may result in a program crash
56+
- Fix incorrect dereference in params array handling
57+
- Fixes issue with function resolution when calling overloaded function with keyword arguments from python ([#1097][i1097])
58+
- Fix `object[]` parameters taking precedence when should not in overload resolution
59+
- Fixed a bug where all .NET class instances were considered Iterable
60+
- Fix incorrect choice of method to invoke when using keyword arguments.
61+
- Fix non-delegate types incorrectly appearing as callable.
62+
- Indexers can now be used with interface objects
63+
- Fixed a bug where indexers could not be used if they were inherited
64+
- Made it possible to use `__len__` also on `ICollection<>` interface objects
65+
- Fixed issue when calling PythonException.Format where another exception would be raise for unnormalized exceptions
66+
- Made it possible to call `ToString`, `GetHashCode`, and `GetType` on inteface objects
67+
- Fixed objects returned by enumerating `PyObject` being disposed too soon
68+
- Incorrectly using a non-generic type with type parameters now produces a helpful Python error instead of throwing NullReferenceException
69+
- `import` may now raise errors with more detail than "No module named X"
70+
- Exception stacktraces on `PythonException.StackTrace` are now properly formatted
71+
- Providing an invalid type parameter to a generic type or method produces a helpful Python error
72+
- Empty parameter names (as can be generated from F#) do not cause crashes
73+
74+
### Removed
75+
76+
- implicit assembly loading (you have to explicitly `clr.AddReference` before doing import)
77+
- support for .NET Framework 4.0-4.6; Mono before 5.4. Python.NET now requires .NET Standard 2.0
78+
(see [the matrix](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support))
2279

2380
## [2.5.0][] - 2020-06-14
2481

@@ -38,6 +95,7 @@ This version improves performance on benchmarks significantly compared to 2.3.
3895
- Support for Python 3.8
3996
- Codecs as the designated way to handle automatic conversions between
4097
.NET and Python types
98+
- Added Python 3 buffer api support and PyBuffer interface for fast byte and numpy array read/write ([#980][p980])
4199

42100
### Changed
43101

@@ -100,6 +158,7 @@ This version improves performance on benchmarks significantly compared to 2.3.
100158
- PythonEngine.Intialize will now call `Py_InitializeEx` with a default value of 0, so signals will not be configured by default on embedding. This is different from the previous behaviour, where `Py_Initialize` was called instead, which sets initSigs to 1. ([#449][i449])
101159
- Refactored MethodBinder.Bind in preparation to make it extensible (#829)
102160
- Look for installed Windows 10 sdk's during installation instead of relying on specific versions.
161+
- Remove `LoadLibrary` call. ([#880][p880])
103162

104163
### Fixed
105164

@@ -776,3 +835,4 @@ This version improves performance on benchmarks significantly compared to 2.3.
776835
[i755]: https://github.com/pythonnet/pythonnet/pull/755
777836
[p534]: https://github.com/pythonnet/pythonnet/pull/534
778837
[i449]: https://github.com/pythonnet/pythonnet/issues/449
838+
[i1342]: https://github.com/pythonnet/pythonnet/issues/1342

0 commit comments

Comments
 (0)