Skip to content

Commit e168d63

Browse files
committed
numpy: fixed missing numpy wheel installing for Numpy.NET
1 parent 71c16d2 commit e168d63

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public ApiGenerator()
9696
SharpToSharpConversions =
9797
{
9898
SpecialGenerators.ArrayToNDarrayConversion,
99-
}
99+
},
100+
InitializationGenerators = { SpecialGenerators.InitNumpyGenerator },
100101
};
101102
}
102103

@@ -117,7 +118,6 @@ public string Generate()
117118
StaticName = "np", // name of the static API class
118119
ImplName = "NumPy", // name of the singleton that implements the static API behind the scenes
119120
PythonModule = "numpy", // name of the Python module that the static api wraps
120-
InitializationGenerators = { SpecialGenerators.InitNumpyGenerator },
121121
};
122122
_generator.StaticApis.Add(array_creation_api);
123123
ParseNumpyApi(array_creation_api, "routines.array-creation.html");
@@ -267,7 +267,7 @@ public string Generate()
267267
// generate Numpy.Bare
268268
// it is based on Python.Runtime only and doesn't pack anything. Python 3.7 installation including numpy pip module are required for this to run
269269
// ----------------------------------------------------
270-
array_creation_api.InitializationGenerators = new List<Action<CodeWriter>>(); // <--- do not install wheel in numpy bare
270+
_generator.InitializationGenerators = new List<Action<CodeWriter>>(); // <--- do not install wheel in numpy bare
271271
ndarray_api.OutputPath = Path.Combine(src_dir, "Numpy.Bare/Models");
272272
_generator.ModelsPath = Path.Combine(src_dir, "Numpy.Bare/Models");
273273
_generator.StaticApiFilesPath = Path.Combine(src_dir, "Numpy.Bare");

src/Numpy.Bare/np.io.gen.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ public static void savetxt(string fname, NDarray X, string[] fmt = null, string
484484
/// If usemask is True, this is a
485485
/// masked array.
486486
/// </returns>
487-
public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes")
487+
public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, string replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes")
488488
{
489489
//auto-generated code, do not change
490490
var __self__=self;
@@ -906,7 +906,7 @@ public static void array_str(NDarray a, int? max_line_width = null, int? precisi
906906
/// <returns>
907907
/// The string representation of the floating point value
908908
/// </returns>
909-
public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null)
909+
public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null)
910910
{
911911
//auto-generated code, do not change
912912
var __self__=self;
@@ -974,7 +974,7 @@ public static string format_float_positional(python float or numpy floating scal
974974
/// <returns>
975975
/// The string representation of the floating point value
976976
/// </returns>
977-
public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null)
977+
public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null)
978978
{
979979
//auto-generated code, do not change
980980
var __self__=self;

src/Numpy.Bare/np.linalg.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public static NDarray einsum(string subscripts, NDarray[] operands, NDarray @out
549549
/// string_repr
550550
/// A printable representation of the einsum path.
551551
/// </returns>
552-
public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy")
552+
public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, string optimize = "greedy")
553553
{
554554
//auto-generated code, do not change
555555
var __self__=self;

src/Numpy/np.io.gen.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ public static void savetxt(string fname, NDarray X, string[] fmt = null, string
485485
/// If usemask is True, this is a
486486
/// masked array.
487487
/// </returns>
488-
public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, char replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes")
488+
public static NDarray genfromtxt(string fname, Dtype dtype = null, string comments = null, string delimiter = null, int? skiprows = null, int? skip_header = 0, int? skip_footer = 0, variable converters = null, variable missing = null, variable missing_values = null, variable filling_values = null, sequence usecols = null, {None names = null, sequence excludelist = null, string deletechars = null, string defaultfmt = "f%i", bool? autostrip = false, string replace_space = "_", {True case_sensitive = true, bool? unpack = null, bool? usemask = false, bool? loose = true, bool? invalid_raise = true, int? max_rows = null, string encoding = "bytes")
489489
{
490490
//auto-generated code, do not change
491491
var __self__=self;
@@ -907,7 +907,7 @@ public static void array_str(NDarray a, int? max_line_width = null, int? precisi
907907
/// <returns>
908908
/// The string representation of the floating point value
909909
/// </returns>
910-
public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null)
910+
public static string format_float_positional(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, bool? fractional = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer pad_right = null)
911911
{
912912
//auto-generated code, do not change
913913
var __self__=self;
@@ -975,7 +975,7 @@ public static string format_float_positional(python float or numpy floating scal
975975
/// <returns>
976976
/// The string representation of the floating point value
977977
/// </returns>
978-
public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, one of ‘k’ trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null)
978+
public static string format_float_scientific(python float or numpy floating scalar x, non-negative integer or None precision = null, bool? unique = true, string trim = "k", bool? sign = false, non-negative integer pad_left = null, non-negative integer exp_digits = null)
979979
{
980980
//auto-generated code, do not change
981981
var __self__=self;

src/Numpy/np.linalg.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ public static NDarray einsum(string subscripts, NDarray[] operands, NDarray @out
550550
/// string_repr
551551
/// A printable representation of the einsum path.
552552
/// </returns>
553-
public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, {bool optimize = "greedy")
553+
public static (list of tuples, string) einsum_path(string subscripts, NDarray[] operands, string optimize = "greedy")
554554
{
555555
//auto-generated code, do not change
556556
var __self__=self;

src/Numpy/np.module.gen.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ private static PyObject InstallAndImport(bool force = false)
3737
{
3838
var installer = new Installer();
3939
installer.SetupPython(force).Wait();
40+
installer.InstallWheel(typeof(NumPy).Assembly, "numpy-1.16.3-cp37-cp37m-win_amd64.whl").Wait();
4041
PythonEngine.Initialize();
4142
var mod = Py.Import("numpy");
4243
return mod;

0 commit comments

Comments
 (0)