xnd 0.2.0dev3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +42 -0
  3. data/Gemfile +3 -0
  4. data/History.md +0 -0
  5. data/README.md +7 -0
  6. data/Rakefile +135 -0
  7. data/ext/ruby_xnd/extconf.rb +70 -0
  8. data/ext/ruby_xnd/float_pack_unpack.c +277 -0
  9. data/ext/ruby_xnd/float_pack_unpack.h +39 -0
  10. data/ext/ruby_xnd/gc_guard.c +36 -0
  11. data/ext/ruby_xnd/gc_guard.h +12 -0
  12. data/ext/ruby_xnd/include/xnd.h +449 -0
  13. data/ext/ruby_xnd/lib/libxnd.a +0 -0
  14. data/ext/ruby_xnd/lib/libxnd.so +1 -0
  15. data/ext/ruby_xnd/lib/libxnd.so.0 +1 -0
  16. data/ext/ruby_xnd/lib/libxnd.so.0.2.0dev3 +0 -0
  17. data/ext/ruby_xnd/memory_block_object.c +32 -0
  18. data/ext/ruby_xnd/memory_block_object.h +33 -0
  19. data/ext/ruby_xnd/ruby_xnd.c +1953 -0
  20. data/ext/ruby_xnd/ruby_xnd.h +61 -0
  21. data/ext/ruby_xnd/ruby_xnd_internal.h +85 -0
  22. data/ext/ruby_xnd/util.h +170 -0
  23. data/ext/ruby_xnd/xnd/AUTHORS.txt +5 -0
  24. data/ext/ruby_xnd/xnd/INSTALL.txt +134 -0
  25. data/ext/ruby_xnd/xnd/LICENSE.txt +29 -0
  26. data/ext/ruby_xnd/xnd/MANIFEST.in +3 -0
  27. data/ext/ruby_xnd/xnd/Makefile.in +80 -0
  28. data/ext/ruby_xnd/xnd/README.rst +44 -0
  29. data/ext/ruby_xnd/xnd/config.guess +1530 -0
  30. data/ext/ruby_xnd/xnd/config.h.in +22 -0
  31. data/ext/ruby_xnd/xnd/config.sub +1782 -0
  32. data/ext/ruby_xnd/xnd/configure +4867 -0
  33. data/ext/ruby_xnd/xnd/configure.ac +164 -0
  34. data/ext/ruby_xnd/xnd/doc/Makefile +14 -0
  35. data/ext/ruby_xnd/xnd/doc/_static/copybutton.js +66 -0
  36. data/ext/ruby_xnd/xnd/doc/conf.py +26 -0
  37. data/ext/ruby_xnd/xnd/doc/index.rst +44 -0
  38. data/ext/ruby_xnd/xnd/doc/libxnd/data-structures.rst +186 -0
  39. data/ext/ruby_xnd/xnd/doc/libxnd/functions.rst +148 -0
  40. data/ext/ruby_xnd/xnd/doc/libxnd/index.rst +25 -0
  41. data/ext/ruby_xnd/xnd/doc/releases/index.rst +34 -0
  42. data/ext/ruby_xnd/xnd/doc/xnd/align-pack.rst +96 -0
  43. data/ext/ruby_xnd/xnd/doc/xnd/buffer-protocol.rst +42 -0
  44. data/ext/ruby_xnd/xnd/doc/xnd/index.rst +30 -0
  45. data/ext/ruby_xnd/xnd/doc/xnd/quickstart.rst +62 -0
  46. data/ext/ruby_xnd/xnd/doc/xnd/types.rst +674 -0
  47. data/ext/ruby_xnd/xnd/install-sh +527 -0
  48. data/ext/ruby_xnd/xnd/libxnd/Makefile.in +102 -0
  49. data/ext/ruby_xnd/xnd/libxnd/Makefile.vc +112 -0
  50. data/ext/ruby_xnd/xnd/libxnd/bitmaps.c +345 -0
  51. data/ext/ruby_xnd/xnd/libxnd/contrib.h +313 -0
  52. data/ext/ruby_xnd/xnd/libxnd/copy.c +944 -0
  53. data/ext/ruby_xnd/xnd/libxnd/equal.c +1216 -0
  54. data/ext/ruby_xnd/xnd/libxnd/inline.h +154 -0
  55. data/ext/ruby_xnd/xnd/libxnd/overflow.h +147 -0
  56. data/ext/ruby_xnd/xnd/libxnd/split.c +286 -0
  57. data/ext/ruby_xnd/xnd/libxnd/tests/Makefile.in +39 -0
  58. data/ext/ruby_xnd/xnd/libxnd/tests/Makefile.vc +44 -0
  59. data/ext/ruby_xnd/xnd/libxnd/tests/README.txt +2 -0
  60. data/ext/ruby_xnd/xnd/libxnd/tests/runtest.c +101 -0
  61. data/ext/ruby_xnd/xnd/libxnd/tests/test.h +48 -0
  62. data/ext/ruby_xnd/xnd/libxnd/tests/test_fixed.c +108 -0
  63. data/ext/ruby_xnd/xnd/libxnd/xnd.c +1304 -0
  64. data/ext/ruby_xnd/xnd/libxnd/xnd.h +449 -0
  65. data/ext/ruby_xnd/xnd/python/test_xnd.py +3144 -0
  66. data/ext/ruby_xnd/xnd/python/xnd/__init__.py +290 -0
  67. data/ext/ruby_xnd/xnd/python/xnd/_xnd.c +2822 -0
  68. data/ext/ruby_xnd/xnd/python/xnd/contrib/pretty.py +850 -0
  69. data/ext/ruby_xnd/xnd/python/xnd/docstrings.h +129 -0
  70. data/ext/ruby_xnd/xnd/python/xnd/pyxnd.h +200 -0
  71. data/ext/ruby_xnd/xnd/python/xnd/util.h +182 -0
  72. data/ext/ruby_xnd/xnd/python/xnd_randvalue.py +1121 -0
  73. data/ext/ruby_xnd/xnd/python/xnd_support.py +106 -0
  74. data/ext/ruby_xnd/xnd/setup.py +303 -0
  75. data/ext/ruby_xnd/xnd/vcbuild/INSTALL.txt +42 -0
  76. data/ext/ruby_xnd/xnd/vcbuild/runtest32.bat +16 -0
  77. data/ext/ruby_xnd/xnd/vcbuild/runtest64.bat +14 -0
  78. data/ext/ruby_xnd/xnd/vcbuild/vcbuild32.bat +29 -0
  79. data/ext/ruby_xnd/xnd/vcbuild/vcbuild64.bat +29 -0
  80. data/ext/ruby_xnd/xnd/vcbuild/vcclean.bat +13 -0
  81. data/ext/ruby_xnd/xnd/vcbuild/vcdistclean.bat +14 -0
  82. data/lib/ruby_xnd.so +0 -0
  83. data/lib/xnd.rb +306 -0
  84. data/lib/xnd/monkeys.rb +29 -0
  85. data/lib/xnd/version.rb +6 -0
  86. data/spec/debug_spec.rb +9 -0
  87. data/spec/gc_guard_spec.rb +10 -0
  88. data/spec/leakcheck.rb +9 -0
  89. data/spec/spec_helper.rb +877 -0
  90. data/spec/type_inference_spec.rb +81 -0
  91. data/spec/xnd_spec.rb +2921 -0
  92. data/xnd.gemspec +47 -0
  93. metadata +215 -0
@@ -0,0 +1,61 @@
1
+ /* BSD 3-Clause License
2
+ *
3
+ * Copyright (c) 2018, Quansight and Sameer Deshmukh
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice, this
10
+ * list of conditions and the following disclaimer.
11
+ *
12
+ * * Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * * Neither the name of the copyright holder nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ /* File containing headers for Ruby XND wrapper.
33
+ *
34
+ * Author: Sameer Deshmukh (@v0dro)
35
+ */
36
+ #ifndef RUBY_XND_H
37
+ #define RUBY_XND_H
38
+
39
+ #ifdef __cplusplus
40
+ extern "C" {
41
+ #endif
42
+
43
+ #include "ruby.h"
44
+ #include "ndtypes.h"
45
+ #include "xnd.h"
46
+
47
+ size_t rb_xnd_hash_size(VALUE hash);
48
+ int rb_xnd_get_complex_values(VALUE comp, double *real, double *imag);
49
+ /* Return true if obj is of type XND. */
50
+ int rb_xnd_check_type(VALUE obj);
51
+ const xnd_t * rb_xnd_const_xnd(VALUE xnd);
52
+ VALUE rb_xnd_empty_from_type(ndt_t *t);
53
+ VALUE rb_xnd_from_xnd(xnd_t *x);
54
+
55
+ typedef struct XndObject XndObject;
56
+
57
+ #ifdef __cplusplus
58
+ }
59
+ #endif
60
+
61
+ #endif /* RUBY_XND_H */
@@ -0,0 +1,85 @@
1
+ /* BSD 3-Clause License
2
+ *
3
+ * Copyright (c) 2018, Quansight and Sameer Deshmukh
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice, this
10
+ * list of conditions and the following disclaimer.
11
+ *
12
+ * * Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * * Neither the name of the copyright holder nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+
33
+ /* File containing internal declarations for Ruby XND wrapper.
34
+ *
35
+ * Author: Sameer Deshmukh (@v0dro)
36
+ */
37
+
38
+ #ifndef RUBY_XND_INTERNAL_H
39
+ #define RUBY_XND_INTERNAL_H
40
+
41
+ //#define XND_DEBUG 1
42
+
43
+ #ifdef XND_DEBUG
44
+ #include <assert.h>
45
+ #endif
46
+
47
+ #include <float.h>
48
+ #include "ruby.h"
49
+ #include "ruby/encoding.h"
50
+ #include "ruby_ndtypes.h"
51
+ #include "ruby_xnd.h"
52
+ #include "util.h"
53
+ #include "float_pack_unpack.h"
54
+
55
+ extern VALUE mRubyXND_GCGuard;
56
+
57
+ /* typedefs */
58
+ typedef struct XndObject XndObject;
59
+ typedef struct MemoryBlockObject MemoryBlockObject;
60
+
61
+ #include "gc_guard.h"
62
+
63
+ /* macros */
64
+ #if SIZEOF_LONG == SIZEOF_VOIDP
65
+ # define PTR2NUM(x) (LONG2NUM((long)(x)))
66
+ # define NUM2PTR(x) ((void*)(NUM2ULONG(x)))
67
+ #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
68
+ # define PTR2NUM(x) (LL2NUM((LONG_LONG)(x)))
69
+ # define NUM2PTR(x) ((void*)(NUM2ULL(x)))
70
+ #else
71
+ # error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
72
+ #endif
73
+
74
+ /* Convert C int 't' to Ruby 'true' or 'false'. */
75
+ #define INT2BOOL(t) (t ? Qtrue : Qfalse)
76
+
77
+ #ifdef WORDS_BIGENDIAN
78
+ #define IEEE_BIG_ENDIAN_P 1
79
+ #define IEEE_LITTLE_ENDIAN_P NULL
80
+ #else
81
+ #define IEEE_LITTLE_ENDIAN_P 1
82
+ #define IEEE_BIG_ENDIAN_P NULL
83
+ #endif
84
+
85
+ #endif /* RUBY_XND_INTERNAL_H */
@@ -0,0 +1,170 @@
1
+ /* BSD 3-Clause License
2
+ *
3
+ * Copyright (c) 2018, Quansight and Sameer Deshmukh
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice, this
10
+ * list of conditions and the following disclaimer.
11
+ *
12
+ * * Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * * Neither the name of the copyright holder nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ /* Utility functions for Ruby XND wrapper.
33
+ *
34
+ * Author: Sameer Deshmukh (@v0dro)
35
+ */
36
+
37
+ #ifndef UTIL_H
38
+ #define UTIL_H
39
+
40
+ #include "ruby.h"
41
+ #include <stdlib.h>
42
+ #include <stdint.h>
43
+ #include <inttypes.h>
44
+ #include "ndtypes.h"
45
+
46
+ /* Raise an error stored in $!. Clears it before raising. */
47
+ inline void
48
+ raise_error(void)
49
+ {
50
+ VALUE exeception = rb_errinfo();
51
+
52
+ rb_set_errinfo(Qnil);
53
+ rb_exc_raise(exeception);
54
+ }
55
+
56
+ inline void
57
+ set_error_info(VALUE err, const char * msg)
58
+ {
59
+ rb_set_errinfo(rb_exc_new2(err, msg));
60
+ }
61
+
62
+ static inline size_t
63
+ safe_downcast(int64_t size)
64
+ {
65
+ #if SIZE_MAX < INT64_MAX
66
+ if (size > INT32_MAX) {
67
+ rb_raise(rb_eSizeError,
68
+ "sizes should never exceed INT32_MAX on 32-bit platforms.");
69
+ }
70
+ #endif
71
+ return (size_t)size;
72
+ }
73
+
74
+ static inline bool
75
+ check_invariants(const ndt_t *t)
76
+ {
77
+ #if SIZE_MAX < INT64_MAX
78
+ return safe_downcast(t->datasize) >= 0;
79
+ #else
80
+ (void)t;
81
+ return 1;
82
+ #endif
83
+ }
84
+
85
+ static inline VALUE
86
+ array_new(int64_t size)
87
+ {
88
+ #if SIZE_MAX < INT64_MAX
89
+ size_t n = safe_downcast(size);
90
+ return n < 0 ? NULL : rb_ary_new2(n);
91
+ #else
92
+ return rb_ary_new2(size);
93
+ #endif
94
+ }
95
+
96
+ static inline VALUE
97
+ bytes_from_string_and_size(const char *str, int64_t size)
98
+ {
99
+ #if SIZE_MAX < INT64_MAX
100
+ size_t n = safe_downcast(size);
101
+ return n < 0 ? NULL : rb_str_new(str, n);
102
+ #else
103
+ return rb_str_new(str, size);
104
+ #endif
105
+ }
106
+
107
+ static long long
108
+ mod(long long a, long long b)
109
+ {
110
+ long long r = a % b;
111
+ return r < 0 ? r + b : r;
112
+ }
113
+
114
+ static inline int
115
+ rb_range_unpack(VALUE range, long long *begin, long long *end, long long *step, size_t size)
116
+ {
117
+ /* FIXME: As of 27 Aug. 2018 Ruby trunk implements step as a property of
118
+ Range and XND will support it as and when it is available. Maybe for
119
+ now we can implement a #step iterator in a separate method.
120
+ */
121
+ *step = 1;
122
+ VALUE rb_begin = rb_funcall(range, rb_intern("begin"), 0, NULL);
123
+ VALUE rb_end = rb_funcall(range, rb_intern("end"), 0, NULL);
124
+ int exclude_end = RTEST(rb_funcall(range, rb_intern("exclude_end?"), 0, NULL));
125
+
126
+ if (RB_TYPE_P(rb_begin, T_FLOAT)) {
127
+ double value = RFLOAT_VALUE(rb_begin);
128
+
129
+ if (isinf(value)) {
130
+ *begin = 0;
131
+ }
132
+ }
133
+ else {
134
+ long long temp = NUM2LL(rb_begin);
135
+
136
+ if (temp < 0) { /* if negative index map to positive. */
137
+ temp = mod(temp, (long long)size);
138
+ }
139
+
140
+ *begin = temp;
141
+ }
142
+
143
+ if (RB_TYPE_P(rb_end, T_FLOAT)) {
144
+ double value = RFLOAT_VALUE(rb_end);
145
+
146
+ if (isinf(value)) {
147
+ *end = INT64_MAX;
148
+ return;
149
+ }
150
+ }
151
+ else {
152
+ long long temp = NUM2LL(rb_end);
153
+
154
+ if (temp < 0) { /* if negative index map to ppositive. */
155
+ temp = mod(temp, (long long)size);
156
+ }
157
+
158
+ *end = temp;
159
+ }
160
+
161
+ /* a[0..0] in Ruby returns the 0th index.
162
+ a[0...0] in Ruby returns empty array like a[0:0] in Python.
163
+ libxnd does not include the last index by default.
164
+ */
165
+ if (!exclude_end) {
166
+ *end += 1;
167
+ }
168
+ }
169
+
170
+ #endif /* UTIL_H */
@@ -0,0 +1,5 @@
1
+
2
+ Version 0.2.0
3
+ -------------
4
+
5
+ Stefan Krah <skrah@bytereef.org>, sponsored by Anaconda Inc. and Quansight LLC.
@@ -0,0 +1,134 @@
1
+
2
+
3
+ Requirements (libndtypes)
4
+ =========================
5
+
6
+ Unless libndtypes has already been installed in the system directories,
7
+ it is recommended to clone libndtypes into the xnd directory.
8
+
9
+
10
+ Get ndtypes
11
+ -----------
12
+ git clone https://github.com/plures/ndtypes.git
13
+
14
+
15
+ For building libxnd only
16
+ ------------------------
17
+ cd ndtypes
18
+ ./configure
19
+ make
20
+ cd ..
21
+
22
+
23
+ For building the xnd Python module
24
+ ----------------------------------
25
+ # This also builds libndtypes and copies the ndtypes Python package into
26
+ # the python directory next to the xnd package.
27
+ cd ndtypes
28
+ python3 setup.py install --local=../python
29
+ cd ..
30
+
31
+
32
+ Unix: libxnd build instructions
33
+ ===============================
34
+
35
+ # Build
36
+ ./configure
37
+ make
38
+
39
+ # Test
40
+ make check
41
+
42
+ # Install
43
+ make install
44
+
45
+ # Clean
46
+ make clean
47
+
48
+ # Distclean
49
+ make distclean
50
+
51
+
52
+ Windows: libxnd build instructions
53
+ ==================================
54
+
55
+ See vcbuild/INSTALL.txt.
56
+
57
+
58
+ Unix/Windows: Python module build instructions
59
+ ==============================================
60
+
61
+ To avoid shared library mismatches, the Python module builds with an rpath
62
+ and ships the library inside the package.
63
+
64
+ Unless you are a distributor with tight control over the system library
65
+ versions, it is not recommended to install the library for the Python
66
+ module.
67
+
68
+
69
+ Build all
70
+ ---------
71
+
72
+ # Build libxnd and the module (libxnd is copied into the package)
73
+ python3 setup.py build
74
+
75
+ # Test
76
+ python3 setup.py test
77
+
78
+ # Doctest (optional, relies on Sphinx)
79
+ python3 setup.py doctest
80
+
81
+ # Install
82
+ python3 setup.py install
83
+
84
+ # Clean libxnd and the module
85
+ python3 setup.py distclean
86
+
87
+
88
+ Build the module only (for developing)
89
+ --------------------------------------
90
+
91
+ First, build libxnd as above. This also copies the shared library into
92
+ the package. Then, to avoid rebuilding the library repeatedly, use:
93
+
94
+ # Build the module
95
+ python3 setup.py module
96
+
97
+ # Clean the module
98
+ python3 setup.py clean
99
+
100
+
101
+ Alternative install (for developing)
102
+ ------------------------------------
103
+
104
+ # Install the package into a local directory. This is mainly useful for
105
+ # developing gufuncs:
106
+ python3 setup.py install --local="$PWD/../python"
107
+
108
+ # Windows:
109
+ python.exe setup.py install --local="%cd%\..\python"
110
+
111
+
112
+ Alternative install with conda (for developing)
113
+ -----------------------------------------------
114
+
115
+ # Install the xnd package into a local directory.
116
+
117
+ # Create and activate a new conda environment:
118
+ conda create --name xnd python=3.7
119
+ conda activate xnd
120
+
121
+ # Use conda to install ndtypes (if you also want to work on ndtypes, please
122
+ # check the project repository https://github.com/plures/ndtypes):
123
+ conda install -c xnd/label/dev ndtypes
124
+
125
+ # Use conda to install numpy (optional, some tests require the library):
126
+ conda install numpy
127
+
128
+ # Use conda to build libxnd and xnd:
129
+ conda build .conda/libxnd -c xnd/label/dev
130
+ conda build .conda/xnd -c xnd/label/dev
131
+
132
+ # Use conda to install the local version of the library and the
133
+ # Python module:
134
+ conda install --use-local xnd