Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit580128d

Browse files
authored
Merge branch 'master' into improve-ci
2 parents0764612 +16f04e9 commit580128d

File tree

67 files changed

+1805
-582
lines changed

Some content is hidden

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

67 files changed

+1805
-582
lines changed

‎.github/workflows/nuget-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name:GitHub Actions
1+
name:NuGet Preview Release
22

33
on:
44
schedule:
55
-cron:"5 4 3 */1 *"# once a month, at 4:05 on 3rd
6+
workflow_dispatch:
67

78
jobs:
89
release:
@@ -37,7 +38,6 @@ jobs:
3738
3839
-name:Build and Install
3940
run:|
40-
python setup.py configure
4141
pip install -v .
4242
4343
-name:Python Tests

‎CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
1313
- Python operator method will call C# operator method for supported binary and unary operators ([#1324][p1324]).
1414
- Add GetPythonThreadID and Interrupt methods in PythonEngine
1515
- 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`
1617

1718
###Changed
1819
- Drop support for Python 2, 3.4, and 3.5
@@ -36,9 +37,14 @@ when .NET expects an integer [#1342][i1342]
3637
- BREAKING: Methods with`ref` or`out` parameters and void return type return a tuple of only the`ref` and`out` parameters.
3738
- BREAKING: to call Python from .NET`Runtime.PythonDLL` property must be set to Python DLL name
3839
or the DLL must be loaded in advance. This must be done before calling any other Python.NET functions.
40+
- BREAKING:`PyObject.Length()` now raises a`PythonException` when object does not support a concept of length.
41+
- BREAKING: disabled implicit conversion from C# enums to Python`int` and back.
42+
One must now either use enum members (e.g.`MyEnum.Option`), or use enum constructor
43+
(e.g.`MyEnum(42)` or`MyEnum(42, True)` when`MyEnum` does not have a member with value 42).
3944
- Sign Runtime DLL with a strong name
4045
- Implement loading through`clr_loader` instead of the included`ClrModule`, enables
4146
support for .NET Core
47+
- BREAKING: custom encoders are no longer called for instances of`System.Type`
4248

4349
###Fixed
4450

‎Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyCopyright>Copyright (c) 2006-2020 The Contributors of the Python.NET Project</AssemblyCopyright>
55
<AssemblyCompany>pythonnet</AssemblyCompany>
66
<AssemblyProduct>Python.NET</AssemblyProduct>
7-
<LangVersion>7.3</LangVersion>
7+
<LangVersion>9.0</LangVersion>
88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
1010
<ItemGroup>

‎README.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ pythonnet - Python.NET
55

66
|gh shield| |appveyor shield|
77

8-
|license shield| |pypi package version| |conda-forge version| |python supported shield|
8+
|license shield|
9+
10+
|pypi package version| |conda-forge version| |python supported shield|
11+
12+
|nuget preview shield| |nuget release shield|
913

1014
Python.NET is a package that gives Python programmers nearly
1115
seamless integration with the .NET Common Language Runtime (CLR) and
@@ -41,6 +45,10 @@ module:
4145
Embedding Python in .NET
4246
------------------------
4347

48+
- You must set `Runtime.PythonDLL` property or `PYTHONNET_PYDLL` environment variable
49+
starting with version 3.0, otherwise you will receive `TypeInitializationException`.
50+
Typical values are `python38.dll` (Windows), `libpython3.8.dylib` (Mac),
51+
`libpython3.8.so` (most other *nix).
4452
- All calls to python should be inside a
4553
``using (Py.GIL()) {/* Your code here */}`` block.
4654
- Import python modules using ``dynamic mod = Py.Import("mod")``, then
@@ -130,5 +138,9 @@ This project is supported by the `.NET Foundation <https://dotnetfoundation.org>
130138
:target:http://stackoverflow.com/questions/tagged/python.net
131139
.. |conda-forge version|image::https://img.shields.io/conda/vn/conda-forge/pythonnet.svg
132140
:target:https://anaconda.org/conda-forge/pythonnet
141+
.. |nuget preview shield|image::https://img.shields.io/nuget/vpre/pythonnet
142+
:target:https://www.nuget.org/packages/pythonnet/
143+
.. |nuget release shield|image::https://img.shields.io/nuget/v/pythonnet
144+
:target:https://www.nuget.org/packages/pythonnet/
133145
.. |gh shield|image::https://github.com/pythonnet/pythonnet/workflows/GitHub%20Actions/badge.svg
134146
:target:https://github.com/pythonnet/pythonnet/actions?query=branch%3Amaster

‎pythonnet/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def load():
2929
if_LOADED:
3030
return
3131

32-
from .find_libpythonimportlinked_libpython
3332
fromos.pathimportjoin,dirname
3433

3534
if_RUNTIMEisNone:
@@ -38,21 +37,11 @@ def load():
3837
set_default_runtime()
3938

4039
dll_path=join(dirname(__file__),"runtime","Python.Runtime.dll")
41-
libpython=linked_libpython()
42-
43-
iflibpythonand_FFIisNoneandsys.platform!="win32":
44-
# Load and leak libpython handle s.t. the .NET runtime doesn't dlcloses
45-
# it
46-
importposix
47-
48-
importcffi
49-
_FFI=cffi.FFI()
50-
_FFI.dlopen(libpython,posix.RTLD_NODELETE|posix.RTLD_LOCAL)
51-
40+
5241
_LOADER_ASSEMBLY=_RUNTIME.get_assembly(dll_path)
5342

5443
func=_LOADER_ASSEMBLY["Python.Runtime.Loader.Initialize"]
55-
iffunc(f"{libpythonor''}".encode("utf8"))!=0:
44+
iffunc(''.encode("utf8"))!=0:
5645
raiseRuntimeError("Failed to initialize Python.Runtime.dll")
5746

5847
importatexit

‎pythonnet/find_libpython/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ class Dl_info(ctypes.Structure):
7777

7878

7979
def_linked_libpython_unix():
80+
ifnotsysconfig.get_config_var("Py_ENABLE_SHARED"):
81+
returnNone
82+
8083
libdl=ctypes.CDLL(ctypes.util.find_library("dl"))
8184
libdl.dladdr.argtypes= [ctypes.c_void_p,ctypes.POINTER(Dl_info)]
8285
libdl.dladdr.restype=ctypes.c_int
@@ -88,8 +91,6 @@ def _linked_libpython_unix():
8891
ifretcode==0:# means error
8992
returnNone
9093
path=os.path.realpath(dlinfo.dli_fname.decode())
91-
ifpath==os.path.realpath(sys.executable):
92-
returnNone
9394
returnpath
9495

9596

‎setup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def run(self):
9494
# Add build_dotnet to the build tasks:
9595
fromdistutils.command.buildimportbuildas_build
9696
fromsetuptools.command.developimportdevelopas_develop
97+
fromwheel.bdist_wheelimportbdist_wheelas_bdist_wheel
9798
fromsetuptoolsimportDistribution
9899
importsetuptools
99100

@@ -111,13 +112,22 @@ def install_for_development(self):
111112
returnsuper().install_for_development()
112113

113114

115+
classbdist_wheel(_bdist_wheel):
116+
deffinalize_options(self):
117+
# Monkey patch bdist_wheel to think the package is pure even though we
118+
# include DLLs
119+
super().finalize_options()
120+
self.root_is_pure=True
121+
122+
114123
# Monkey-patch Distribution s.t. it supports the dotnet_libs attribute
115124
Distribution.dotnet_libs=None
116125

117126
cmdclass= {
118127
"build":build,
119128
"build_dotnet":build_dotnet,
120129
"develop":develop,
130+
"bdist_wheel":bdist_wheel,
121131
}
122132

123133

@@ -142,9 +152,8 @@ def install_for_development(self):
142152
author="The Contributors of the Python.NET Project",
143153
author_email="pythonnet@python.org",
144154
packages=["pythonnet","pythonnet.find_libpython"],
145-
install_requires=["pycparser","clr_loader"],
155+
install_requires=["clr_loader"],
146156
long_description=long_description,
147-
# data_files=[("{install_platlib}", ["{build_lib}/pythonnet"])],
148157
py_modules=["clr"],
149158
dotnet_libs=dotnet_libs,
150159
classifiers=[
@@ -156,6 +165,7 @@ def install_for_development(self):
156165
"Programming Language :: Python :: 3.6",
157166
"Programming Language :: Python :: 3.7",
158167
"Programming Language :: Python :: 3.8",
168+
"Programming Language :: Python :: 3.9",
159169
"Operating System :: Microsoft :: Windows",
160170
"Operating System :: POSIX :: Linux",
161171
"Operating System :: MacOS :: MacOS X",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp