pycall 1.3.0.dev → 1.3.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +67 -0
- data/.travis.yml +45 -19
- data/CHANGES.md +17 -1
- data/README.md +2 -1
- data/appveyor.yml +0 -12
- data/ci/travis_install.sh +30 -9
- data/ext/pycall/libpython.c +7 -1
- data/lib/pycall/libpython/finder.rb +4 -5
- data/lib/pycall/pyobject_wrapper.rb +1 -1
- data/lib/pycall/python/investigator.py +0 -4
- data/lib/pycall/pytypeobject_wrapper.rb +10 -0
- data/lib/pycall/version.rb +1 -1
- data/pycall.gemspec +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6f356d0a95d938f235c348ca3825d261590d2870b3e9bf9f27325d25a5e39e
|
4
|
+
data.tar.gz: 232853fded2a1afb7c6f0a8fdd7e49030879087f00528383c48c7039f0bb8c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25afa008419432d52ac88a8488341426eaf6287d51b686d5d5dbdb83f8673920a0370b194cfba6b8bbe34c173584d0c7e0c10575b312d0c86e97140b2b561276
|
7
|
+
data.tar.gz: 9a31e7fd32ef9267210e93ab0404f89835a237bcad65c07c8c382cb341969c6e087bede158d0218f591cf73e53cebbc3d5672915ced8942bf5d58aa190d7dcc9
|
@@ -0,0 +1,67 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
name: Test
|
9
|
+
runs-on: ${{ matrix.os }}
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os:
|
15
|
+
- ubuntu-18.04
|
16
|
+
#- macos-latest
|
17
|
+
ruby_version:
|
18
|
+
- 2.7.x
|
19
|
+
- 2.6.x
|
20
|
+
- 2.5.x
|
21
|
+
- 2.4.x
|
22
|
+
python_version:
|
23
|
+
- 3.8.x
|
24
|
+
- 3.7.x
|
25
|
+
- 3.6.x
|
26
|
+
- 2.7.x
|
27
|
+
python_architecture:
|
28
|
+
- x64
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- name: Setup Ruby
|
32
|
+
if: matrix.ruby_version != 'master-nightly'
|
33
|
+
uses: actions/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby_version }}
|
36
|
+
|
37
|
+
- name: Setup Python
|
38
|
+
uses: actions/setup-python@v1
|
39
|
+
with:
|
40
|
+
python-version: ${{ matrix.python_version }}
|
41
|
+
architecture: ${{ matrix.python_architecture }}
|
42
|
+
|
43
|
+
- name: Checkout
|
44
|
+
uses: actions/checkout@v1
|
45
|
+
with:
|
46
|
+
fetch-depth: 1
|
47
|
+
|
48
|
+
- name: Prepare environment
|
49
|
+
run: |
|
50
|
+
gem install bundler
|
51
|
+
|
52
|
+
- name: Install requirements
|
53
|
+
run: |
|
54
|
+
pip install --user numpy
|
55
|
+
bundle install
|
56
|
+
|
57
|
+
- name: Compile pycall.so
|
58
|
+
run: |
|
59
|
+
bundle exec rake compile
|
60
|
+
|
61
|
+
- name: Python investigator
|
62
|
+
run: |
|
63
|
+
python lib/pycall/python/investigator.py
|
64
|
+
|
65
|
+
- name: Test
|
66
|
+
run: |
|
67
|
+
PYTHON=python bundle exec rake
|
data/.travis.yml
CHANGED
@@ -2,48 +2,74 @@ language: ruby
|
|
2
2
|
|
3
3
|
os: linux
|
4
4
|
|
5
|
-
dist:
|
5
|
+
dist: bionic
|
6
6
|
sudo: required
|
7
7
|
|
8
8
|
rvm:
|
9
9
|
- ruby-head
|
10
|
-
- 2.
|
11
|
-
- 2.
|
12
|
-
- 2.
|
10
|
+
- 2.7
|
11
|
+
- 2.6
|
12
|
+
- 2.5
|
13
|
+
- 2.4
|
13
14
|
|
14
15
|
env:
|
15
16
|
global:
|
16
17
|
- PYCALL_DEBUG_FIND_LIBPYTHON=1
|
17
18
|
matrix:
|
18
|
-
- PYENV_VERSION=
|
19
|
-
- PYENV_VERSION=3.
|
20
|
-
- PYENV_VERSION=
|
21
|
-
- PYENV_VERSION=
|
22
|
-
- PYENV_VERSION=
|
19
|
+
- PYENV_VERSION=3.8.0
|
20
|
+
- PYENV_VERSION=3.7.5
|
21
|
+
- PYENV_VERSION=2.7.17
|
22
|
+
- PYENV_VERSION=system LIBPYTHON=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
|
23
|
+
- PYENV_VERSION=system LIBPYTHON=/usr/lib/x86_64-linux-gnu/libpython2.7.so
|
24
|
+
- PYENV_VERSION=miniconda2-4.3.30
|
25
|
+
- PYENV_VERSION=miniconda3-4.3.30
|
23
26
|
|
24
27
|
matrix:
|
25
28
|
include:
|
26
29
|
- os: osx
|
27
|
-
osx_image:
|
30
|
+
osx_image: xcode11.2
|
28
31
|
compiler: clang
|
29
|
-
rvm: 2.
|
30
|
-
env: PYENV_VERSION=3.
|
32
|
+
rvm: 2.7
|
33
|
+
env: PYENV_VERSION=3.8.0
|
31
34
|
- os: osx
|
32
|
-
osx_image:
|
35
|
+
osx_image: xcode11.2
|
33
36
|
compiler: clang
|
34
|
-
rvm: 2.
|
35
|
-
env: PYENV_VERSION=
|
37
|
+
rvm: 2.6
|
38
|
+
env: PYENV_VERSION=3.8.0
|
36
39
|
- os: osx
|
37
|
-
osx_image:
|
40
|
+
osx_image: xcode11.2
|
38
41
|
compiler: clang
|
39
|
-
rvm: 2.
|
42
|
+
rvm: 2.5
|
43
|
+
env: PYENV_VERSION=3.8.0
|
44
|
+
- os: osx
|
45
|
+
osx_image: xcode11.2
|
46
|
+
compiler: clang
|
47
|
+
rvm: 2.4
|
48
|
+
env: PYENV_VERSION=3.8.0
|
49
|
+
- os: osx
|
50
|
+
osx_image: xcode11.2
|
51
|
+
compiler: clang
|
52
|
+
rvm: 2.7
|
53
|
+
env: PYENV_VERSION=miniconda3-4.3.11
|
54
|
+
- os: osx
|
55
|
+
osx_image: xcode11.2
|
56
|
+
compiler: clang
|
57
|
+
rvm: 2.6
|
58
|
+
env: PYENV_VERSION=miniconda3-4.3.11
|
59
|
+
- os: osx
|
60
|
+
osx_image: xcode11.2
|
61
|
+
compiler: clang
|
62
|
+
rvm: 2.5
|
63
|
+
env: PYENV_VERSION=miniconda3-4.3.11
|
64
|
+
- os: osx
|
65
|
+
osx_image: xcode11.2
|
66
|
+
compiler: clang
|
67
|
+
rvm: 2.4
|
40
68
|
env: PYENV_VERSION=miniconda3-4.3.11
|
41
69
|
allow_failures:
|
42
70
|
- os: osx
|
43
71
|
|
44
72
|
before_install:
|
45
|
-
- gem update --system
|
46
|
-
- gem update bundler
|
47
73
|
- export PATH="$(pyenv root)/bin:$PATH"
|
48
74
|
- eval "$(pyenv init -)"
|
49
75
|
|
data/CHANGES.md
CHANGED
@@ -1,9 +1,25 @@
|
|
1
1
|
# The change history of PyCall
|
2
2
|
|
3
|
-
##
|
3
|
+
## 1.3.0
|
4
4
|
|
5
5
|
* Add `PyCall.without_gvl` for explicitly releasing the RubyVM GVL
|
6
6
|
|
7
|
+
* Fix for missing if in PyObjectWrapper
|
8
|
+
|
9
|
+
*Kouhei Sutou*
|
10
|
+
|
11
|
+
* Fix for Anaconda environment
|
12
|
+
|
13
|
+
*Ryo MATSUMIYA*
|
14
|
+
|
15
|
+
* Fix against `unknown symbol "PyInt_AsSsize_t"` (Fiddle::DLError)
|
16
|
+
|
17
|
+
*Kouhei Sutou*
|
18
|
+
|
19
|
+
* Fix for `TypeError: Compared with non class/module`
|
20
|
+
|
21
|
+
*Archonic*
|
22
|
+
|
7
23
|
## 1.2.1
|
8
24
|
|
9
25
|
* Prevent circular require in pycall/iruby.rb
|
data/README.md
CHANGED
@@ -5,8 +5,9 @@
|
|
5
5
|
|
6
6
|
# PyCall: Calling Python functions from the Ruby language
|
7
7
|
|
8
|
+
[](https://github.com/mrkn/pycall.rb/actions?query=workflow%3ACI)
|
8
9
|
[](https://travis-ci.org/mrkn/pycall.rb)
|
9
|
-
[](https://ci.appveyor.com/project/mrkn/pycall-rb/branch/master)
|
10
11
|
|
11
12
|
This library provides the features to directly call and partially interoperate
|
12
13
|
with Python from the Ruby language. You can import arbitrary Python modules
|
data/appveyor.yml
CHANGED
@@ -6,10 +6,6 @@ environment:
|
|
6
6
|
PYTHONDIR: "C:\\Python27"
|
7
7
|
PYTHON: "C:\\Python27\\python.exe"
|
8
8
|
|
9
|
-
- ruby_version: "24"
|
10
|
-
PYTHONDIR: "C:\\Python34"
|
11
|
-
PYTHON: "C:\\Python34\\python.exe"
|
12
|
-
|
13
9
|
- ruby_version: "24"
|
14
10
|
PYTHONDIR: "C:\\Python35"
|
15
11
|
PYTHON: "C:\\Python35\\python.exe"
|
@@ -23,10 +19,6 @@ environment:
|
|
23
19
|
PYTHONDIR: "C:\\Python27-x64"
|
24
20
|
PYTHON: "C:\\Python27-x64\\python.exe"
|
25
21
|
|
26
|
-
- ruby_version: "24-x64"
|
27
|
-
PYTHONDIR: "C:\\Python34-x64"
|
28
|
-
PYTHON: "C:\\Python34-x64\\python.exe"
|
29
|
-
|
30
22
|
- ruby_version: "24-x64"
|
31
23
|
PYTHONDIR: "C:\\Python35-x64"
|
32
24
|
PYTHON: "C:\\Python35-x64\\python.exe"
|
@@ -57,10 +49,6 @@ environment:
|
|
57
49
|
PYTHONDIR: "C:\\Python27-x64"
|
58
50
|
PYTHON: "C:\\Python27-x64\\python.exe"
|
59
51
|
|
60
|
-
- ruby_version: "23-x64"
|
61
|
-
PYTHONDIR: "C:\\Python34-x64"
|
62
|
-
PYTHON: "C:\\Python34-x64\\python.exe"
|
63
|
-
|
64
52
|
- ruby_version: "23-x64"
|
65
53
|
PYTHONDIR: "C:\\Python35-x64"
|
66
54
|
PYTHON: "C:\\Python35-x64\\python.exe"
|
data/ci/travis_install.sh
CHANGED
@@ -10,19 +10,35 @@ if test -z "$PYENV_VERSION"; then
|
|
10
10
|
exit 1
|
11
11
|
fi
|
12
12
|
|
13
|
+
pyenv_root=$(pyenv root)
|
14
|
+
|
13
15
|
if test -n "$LIBPYTHON"; then
|
14
|
-
|
16
|
+
if test ! -f $LIBPYTHON; then
|
17
|
+
if test -f ${pyenv_root}/$LIBPYTHON; then
|
18
|
+
export LIBPYTHON=${pyenv_root}/$LIBPYTHON
|
19
|
+
else
|
20
|
+
echo "Invalid value in LIBPYTHON: ${LIBPYTHON}" >&2
|
21
|
+
exit 1
|
22
|
+
fi
|
23
|
+
fi
|
15
24
|
fi
|
16
25
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
26
|
+
(
|
27
|
+
cd $(pyenv root)
|
28
|
+
if [ -d .git ]; then
|
29
|
+
git fetch origin
|
30
|
+
git checkout master
|
31
|
+
git reset --hard origin/master
|
21
32
|
fi
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
33
|
+
)
|
34
|
+
|
35
|
+
case $PYENV_VERSION in
|
36
|
+
system)
|
37
|
+
;;
|
38
|
+
*)
|
39
|
+
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f $PYENV_VERSION
|
40
|
+
;;
|
41
|
+
esac
|
26
42
|
|
27
43
|
case "$PYENV_VERSION" in
|
28
44
|
*conda*)
|
@@ -40,6 +56,11 @@ case "$PYENV_VERSION" in
|
|
40
56
|
travis_retry conda create -q -n test-environment python=$python_version numpy
|
41
57
|
source $(pyenv prefix)/bin/activate test-environment
|
42
58
|
;;
|
59
|
+
system)
|
60
|
+
travis_retry pip install --user numpy
|
61
|
+
sudo sh -c "apt-get update && apt-get install --no-install-recommends -y python3-pip"
|
62
|
+
travis_retry python3.6 -m pip install --user numpy
|
63
|
+
;;
|
43
64
|
*)
|
44
65
|
travis_retry pip install --user numpy
|
45
66
|
;;
|
data/ext/pycall/libpython.c
CHANGED
@@ -30,7 +30,13 @@ lookup_libpython_api(VALUE libpython_handle, char const *name)
|
|
30
30
|
arg.libpython_handle = libpython_handle;
|
31
31
|
arg.name = name;
|
32
32
|
addr = rb_protect((VALUE (*)(VALUE))lookup_libpython_api_0, (VALUE)&arg, &state);
|
33
|
-
|
33
|
+
if (state) {
|
34
|
+
rb_set_errinfo(Qnil);
|
35
|
+
return NULL;
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
return NIL_P(addr) ? NULL : NUM2PTR(addr);
|
39
|
+
}
|
34
40
|
}
|
35
41
|
|
36
42
|
#define LOOKUP_API_ENTRY(api_name) lookup_libpython_api(libpython_handle, #api_name)
|
@@ -40,10 +40,6 @@ module PyCall
|
|
40
40
|
debug_report("find_libpython(#{python.inspect})")
|
41
41
|
python, python_config = find_python_config(python)
|
42
42
|
|
43
|
-
set_PYTHONHOME(python_config)
|
44
|
-
libs = make_libs(python_config)
|
45
|
-
libpaths = make_libpaths(python_config)
|
46
|
-
|
47
43
|
# Try LIBPYTHON environment variable first.
|
48
44
|
if (libpython = ENV['LIBPYTHON'])
|
49
45
|
if File.file?(libpython)
|
@@ -59,6 +55,9 @@ module PyCall
|
|
59
55
|
end
|
60
56
|
|
61
57
|
# Find libpython (we hope):
|
58
|
+
set_PYTHONHOME(python_config)
|
59
|
+
libs = make_libs(python_config)
|
60
|
+
libpaths = make_libpaths(python_config)
|
62
61
|
multiarch = python_config[:MULTIARCH] || python_config[:multiarch]
|
63
62
|
libs.each do |lib|
|
64
63
|
libpaths.each do |libpath|
|
@@ -121,7 +120,7 @@ module PyCall
|
|
121
120
|
end
|
122
121
|
|
123
122
|
def set_PYTHONHOME(python_config)
|
124
|
-
if !ENV.has_key?('PYTHONHOME')
|
123
|
+
if !ENV.has_key?('PYTHONHOME')
|
125
124
|
case RUBY_PLATFORM
|
126
125
|
when /mingw32/, /cygwin/, /mswin/
|
127
126
|
ENV['PYTHONHOME'] = python_config[:exec_prefix]
|
@@ -178,7 +178,7 @@ module PyCall
|
|
178
178
|
def check_isclass(pyptr)
|
179
179
|
pyptr = pyptr.__pyptr__ if pyptr.kind_of? PyObjectWrapper
|
180
180
|
return if pyptr.kind_of? LibPython::API::PyType_Type
|
181
|
-
return defined?(LibPython::API::PyClass_Type) && pyptr.kind_of?(LibPython::API::PyClass_Type)
|
181
|
+
return if defined?(LibPython::API::PyClass_Type) && pyptr.kind_of?(LibPython::API::PyClass_Type)
|
182
182
|
raise TypeError, "PyType object is required"
|
183
183
|
end
|
184
184
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
from distutils.sysconfig import get_config_var
|
2
2
|
import sys
|
3
3
|
|
4
|
-
def conda():
|
5
|
-
return 'conda' in sys.version or 'Continuum' in sys.version
|
6
|
-
|
7
4
|
for var in ('executable', 'exec_prefix', 'prefix'):
|
8
5
|
print(var + ': ' + str(getattr(sys, var)))
|
9
|
-
print('conda: ' + ('true' if conda() else 'false'))
|
10
6
|
print('multiarch: ' + str(getattr(getattr(sys, 'implementation', sys), '_multiarch', None)))
|
11
7
|
for var in ('VERSION', 'INSTSONAME', 'LIBRARY', 'LDLIBRARY', 'LIBDIR', 'PYTHONFRAMEWORKPREFIX', 'MULTIARCH'):
|
12
8
|
print(var + ': ' + str(get_config_var(var)))
|
@@ -51,8 +51,18 @@ module PyCall
|
|
51
51
|
|
52
52
|
def <(other)
|
53
53
|
case other
|
54
|
+
when self
|
55
|
+
false
|
54
56
|
when PyTypeObjectWrapper
|
55
57
|
__pyptr__ < other.__pyptr__
|
58
|
+
when Class
|
59
|
+
false if other.ancestors.include?(self)
|
60
|
+
when Module
|
61
|
+
if ancestors.include?(other)
|
62
|
+
true
|
63
|
+
elsif other.ancestors.include?(self)
|
64
|
+
false
|
65
|
+
end
|
56
66
|
else
|
57
67
|
raise TypeError, "compared with non class/module"
|
58
68
|
end
|
data/lib/pycall/version.rb
CHANGED
data/pycall.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.require_paths = ["lib"]
|
37
37
|
spec.extensions = ["ext/pycall/extconf.rb"]
|
38
38
|
|
39
|
-
spec.add_development_dependency "bundler"
|
39
|
+
spec.add_development_dependency "bundler"
|
40
40
|
spec.add_development_dependency "rake"
|
41
41
|
spec.add_development_dependency "rake-compiler"
|
42
42
|
spec.add_development_dependency "rake-compiler-dock"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pycall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +130,7 @@ extensions:
|
|
130
130
|
- ext/pycall/extconf.rb
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
+
- ".github/workflows/ci.yml"
|
133
134
|
- ".gitignore"
|
134
135
|
- ".rspec"
|
135
136
|
- ".travis.yml"
|
@@ -216,11 +217,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
217
|
version: '0'
|
217
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
219
|
requirements:
|
219
|
-
- - "
|
220
|
+
- - ">="
|
220
221
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
222
|
+
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.0.
|
224
|
+
rubygems_version: 3.0.6
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: pycall
|