Skip to content

Commit 56e9b1e

Browse files
committed
fix plain vanilla *.csproj build in visual studio 2015
1 parent bdbccc9 commit 56e9b1e

3 files changed

Lines changed: 16 additions & 108 deletions

File tree

README.md

Lines changed: 7 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,12 @@
1-
# pythonnet - Python for .NET
1+
This is just simple build fix for c# developer without much knowledge of python
2+
(based on [amos's fork of python.net](https://github.com/amos402/pythonnet) which is believed memory leak issues have been resolved)
23

3-
[![Join the chat at https://gitter.im/pythonnet/pythonnet](https://badges.gitter.im/pythonnet/pythonnet.svg)](https://gitter.im/pythonnet/pythonnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
# How To Get Python.Runtime.dll(Either DEBUG/RELEASE)
45

5-
[![appveyor shield][]](https://ci.appveyor.com/project/pythonnet/pythonnet/branch/master)
6-
[![travis shield][]](https://travis-ci.org/pythonnet/pythonnet)
7-
[![codecov shield][]](https://codecov.io/github/pythonnet/pythonnet)
8-
[![coverity shield][]](https://scan.coverity.com/projects/pythonnet)
6+
- Open pythonnet.sln in visual studio 2015
7+
- Choose "ReleaseWin"/"DebugWin" (If you use Python2.7), or "ReleaseWinPy3"/"DebugWinPy3"(for Python3.x) with AnyCpu Platform
8+
- When built, copy ./src/runtime/bin/Python.Runtime.dll to your own project.
99

10-
[![license shield][]](./LICENSE)
11-
[![pypi package version][]](https://pypi.python.org/pypi/pythonnet)
12-
[![python supported shield][]](https://pypi.python.org/pypi/pythonnet)
13-
[![stackexchange shield][]](http://stackoverflow.com/questions/tagged/python.net)
14-
[![slack][]](https://pythonnet.slack.com)
10+
Please also refer to original [Python.Net repo](https://github.com/pythonnet/pythonnet)
1511

16-
Python for .NET is a package that gives Python programmers nearly
17-
seamless integration with the .NET Common Language Runtime (CLR) and
18-
provides a powerful application scripting tool for .NET developers.
19-
It allows Python code to interact with the CLR, and may also be used to
20-
embed Python into a .NET application.
2112

22-
## Calling .NET code from Python
23-
24-
Python for .NET allows CLR namespaces to be treated essentially
25-
as Python packages.
26-
27-
```python
28-
import clr
29-
from System import String
30-
from System.Collections import *
31-
```
32-
33-
To load an assembly, use the `AddReference` function in the `clr` module:
34-
35-
```python
36-
import clr
37-
clr.AddReference("System.Windows.Forms")
38-
from System.Windows.Forms import Form
39-
```
40-
41-
## Embedding Python in .NET
42-
43-
- All calls to python should be inside
44-
a `using (Py.GIL()) {/* Your code here */}` block.
45-
- Import python modules using `dynamic mod = Py.Import("mod")`,
46-
then you can call functions as normal, eg `mod.func(args)`.
47-
- Use `mod.func(args, Py.kw("keywordargname", keywordargvalue))` or `mod.func(args, keywordargname: keywordargvalue)`
48-
to apply keyword arguments.
49-
- All python objects should be declared as `dynamic` type.
50-
- Mathematical operations involving python and literal/managed types must
51-
have the python object first, eg. `np.pi * 2` works, `2 * np.pi` doesn't.
52-
53-
### Example
54-
55-
```csharp
56-
static void Main(string[] args)
57-
{
58-
using (Py.GIL())
59-
{
60-
dynamic np = Py.Import("numpy");
61-
Console.WriteLine(np.cos(np.pi * 2));
62-
63-
dynamic sin = np.sin;
64-
Console.WriteLine(sin(5));
65-
66-
double c = np.cos(5) + sin(5);
67-
Console.WriteLine(c);
68-
69-
dynamic a = np.array(new List<float> { 1, 2, 3 });
70-
Console.WriteLine(a.dtype);
71-
72-
dynamic b = np.array(new List<float> { 6, 5, 4 }, dtype: np.int32);
73-
Console.WriteLine(b.dtype);
74-
75-
Console.WriteLine(a * b);
76-
Console.ReadKey();
77-
}
78-
}
79-
```
80-
81-
Output:
82-
83-
```c
84-
1.0
85-
-0.958924274663
86-
-0.6752620892
87-
float64
88-
int32
89-
[ 6. 10. 12.]
90-
```
91-
92-
Information on installation, FAQ, troubleshooting, debugging, and projects using pythonnet can be found in the Wiki:
93-
94-
https://github.com/pythonnet/pythonnet/wiki
95-
96-
[appveyor shield]: https://img.shields.io/appveyor/ci/pythonnet/pythonnet/master.svg?label=AppVeyor
97-
98-
[codecov shield]: https://img.shields.io/codecov/c/github/pythonnet/pythonnet/master.svg?label=Codecov
99-
100-
[coverity shield]: https://img.shields.io/coverity/scan/7830.svg
101-
102-
[license shield]: https://img.shields.io/badge/license-MIT-blue.svg?maxAge=3600
103-
104-
[pypi package version]: https://img.shields.io/pypi/v/pythonnet.svg
105-
106-
[python supported shield]: https://img.shields.io/pypi/pyversions/pythonnet.svg
107-
108-
[slack]: https://img.shields.io/badge/chat-slack-color.svg?style=social
109-
110-
[stackexchange shield]: https://img.shields.io/badge/StackOverflow-python.net-blue.svg
111-
112-
[travis shield]: https://img.shields.io/travis/pythonnet/pythonnet/master.svg?label=Travis

src/runtime/Python.Runtime.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
<Reference Include="System" />
7777
</ItemGroup>
7878
<ItemGroup>
79+
<Compile Include="delegatecaller.cs" />
80+
<Compile Include="dynamicgenerichelper.cs" />
81+
<Compile Include="fastcaller.cs" />
82+
<Compile Include="methodcaller.cs" />
7983
<Compile Include="operator.cs" />
8084
<Compile Include="Properties\AssemblyInfo.cs" />
8185
<Compile Include="..\SharedAssemblyInfo.cs">
@@ -130,15 +134,19 @@
130134
<Compile Include="pylong.cs" />
131135
<Compile Include="pynumber.cs" />
132136
<Compile Include="pyobject.cs" />
137+
<Compile Include="pyobject_.cs" />
133138
<Compile Include="pyscope.cs" />
134139
<Compile Include="pysequence.cs" />
135140
<Compile Include="pystring.cs" />
136141
<Compile Include="pythonengine.cs" />
137142
<Compile Include="pythonexception.cs" />
138143
<Compile Include="pytuple.cs" />
139144
<Compile Include="runtime.cs" />
145+
<Compile Include="tuplepacker.cs" />
146+
<Compile Include="typecheck.cs" />
140147
<Compile Include="typemanager.cs" />
141148
<Compile Include="typemethod.cs" />
149+
<Compile Include="typetraits.cs" />
142150
<Compile Include="Util.cs" />
143151
</ItemGroup>
144152
<ItemGroup Condition=" '$(PythonInteropFile)' != '' ">

src/runtime/delegatemanager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Python.Runtime
77
{
8-
using Python.Runtime.Method;
8+
//using Python.Runtime.Method;
99
#if !AOT
1010
using System.Reflection.Emit;
1111
#endif

0 commit comments

Comments
 (0)