Skip to content

Commit bfe282a

Browse files
author
Christopher Doris
committed
make API clearer
1 parent d5e03a7 commit bfe282a

File tree

8 files changed

+313
-117
lines changed

8 files changed

+313
-117
lines changed

src/API/API.jl

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
"The version of PythonCall."
2+
const VERSION = v"0.9.23"
3+
4+
# types
5+
include("types.jl")
6+
7+
# submodules
8+
include("GIL.jl")
9+
include("GC.jl")
10+
11+
# functions
12+
function python_executable_path end
13+
function python_library_handle end
14+
function python_library_path end
15+
function python_version end
16+
function ispy end
17+
function pynew end
18+
function pyisnull end
19+
function pycopy! end
20+
function getptr end
21+
function pydel! end
22+
function unsafe_pynext end
23+
function pyconvert_add_rule end
24+
function pyconvert_return end
25+
function pyconvert_unconverted end
26+
function event_loop_on end
27+
function event_loop_off end
28+
function fix_qt_plugin_path end
29+
function pyis end
30+
function pyrepr end
31+
function pyascii end
32+
function pyhasattr end
33+
function pygetattr end
34+
function pysetattr end
35+
function pydelattr end
36+
function pyissubclass end
37+
function pyisinstance end
38+
function pyhash end
39+
function pytruth end
40+
function pynot end
41+
function pylen end
42+
function pyhasitem end
43+
function pygetitem end
44+
function pysetitem end
45+
function pydelitem end
46+
function pydir end
47+
function pycall end
48+
function pyeq end
49+
function pyne end
50+
function pyle end
51+
function pylt end
52+
function pyge end
53+
function pygt end
54+
function pycontains end
55+
function pyin end
56+
function pyneg end
57+
function pypos end
58+
function pyabs end
59+
function pyinv end
60+
function pyindex end
61+
function pyadd end
62+
function pysub end
63+
function pymul end
64+
function pymatmul end
65+
function pyfloordiv end
66+
function pytruediv end
67+
function pymod end
68+
function pydivmod end
69+
function pylshift end
70+
function pyrshift end
71+
function pyand end
72+
function pyxor end
73+
function pyor end
74+
function pyiadd end
75+
function pyisub end
76+
function pyimul end
77+
function pyimatmul end
78+
function pyifloordiv end
79+
function pyitruediv end
80+
function pyimod end
81+
function pyilshift end
82+
function pyirshift end
83+
function pyiand end
84+
function pyixor end
85+
function pyior end
86+
function pypow end
87+
function pyipow end
88+
function pyiter end
89+
function pynext end
90+
function pybool end
91+
function pystr end
92+
function pybytes end
93+
function pyint end
94+
function pyfloat end
95+
function pycomplex end
96+
function pytype end
97+
function pyslice end
98+
function pyrange end
99+
function pytuple end
100+
function pylist end
101+
function pycollist end
102+
function pyrowlist end
103+
function pyset end
104+
function pyfrozenset end
105+
function pydict end
106+
function pydate end
107+
function pytime end
108+
function pydatetime end
109+
function pyfraction end
110+
function pyeval end
111+
function pyexec end
112+
function pywith end
113+
function pyimport end
114+
function pyprint end
115+
function pyhelp end
116+
function pyall end
117+
function pyany end
118+
function pycallable end
119+
function pycompile end
120+
121+
# macros
122+
macro pyeval end
123+
macro pyexec end
124+
macro pyconst end
125+
126+
# exports
127+
export Py
128+
export PyException
129+
export ispy
130+
export pyis
131+
export pyrepr
132+
export pyascii
133+
export pyhasattr
134+
export pygetattr
135+
export pysetattr
136+
export pydelattr
137+
export pyissubclass
138+
export pyisinstance
139+
export pyhash
140+
export pytruth
141+
export pynot
142+
export pylen
143+
export pyhasitem
144+
export pygetitem
145+
export pysetitem
146+
export pydelitem
147+
export pydir
148+
export pycall
149+
export pyeq
150+
export pyne
151+
export pyle
152+
export pylt
153+
export pyge
154+
export pygt
155+
export pycontains
156+
export pyin
157+
export pyneg
158+
export pypos
159+
export pyabs
160+
export pyinv
161+
export pyindex
162+
export pyadd
163+
export pysub
164+
export pymul
165+
export pymatmul
166+
export pyfloordiv
167+
export pytruediv
168+
export pymod
169+
export pydivmod
170+
export pylshift
171+
export pyrshift
172+
export pyand
173+
export pyxor
174+
export pyor
175+
export pyiadd
176+
export pyisub
177+
export pyimul
178+
export pyimatmul
179+
export pyifloordiv
180+
export pyitruediv
181+
export pyimod
182+
export pyilshift
183+
export pyirshift
184+
export pyiand
185+
export pyixor
186+
export pyior
187+
export pypow
188+
export pyipow
189+
export pyiter
190+
export pynext
191+
export pybool
192+
export pystr
193+
export pybytes
194+
export pyint
195+
export pyfloat
196+
export pycomplex
197+
export pytype
198+
export pyslice
199+
export pyrange
200+
export pytuple
201+
export pylist
202+
export pycollist
203+
export pyrowlist
204+
export pyset
205+
export pyfrozenset
206+
export pydict
207+
export pydate
208+
export pytime
209+
export pydatetime
210+
export pyfraction
211+
export pyeval
212+
export pyexec
213+
export @pyeval
214+
export @pyexec
215+
export pywith
216+
export pyimport
217+
export pyprint
218+
export pyhelp
219+
export pyall
220+
export pyany
221+
export pycallable
222+
export pycompile
223+
export pybuiltins
224+
export @pyconst
225+
226+
# public bindings
227+
if Base.VERSION v"1.11"
228+
eval(
229+
Expr(
230+
:public,
231+
:VERSION,
232+
:GIL,
233+
:GC,
234+
:CONFIG,
235+
# :PyNULL,
236+
# :PYCONVERT_PRIORITY_WRAP,
237+
# :PYCONVERT_PRIORITY_ARRAY,
238+
# :PYCONVERT_PRIORITY_CANONICAL,
239+
# :PYCONVERT_PRIORITY_NORMAL,
240+
# :PYCONVERT_PRIORITY_FALLBACK,
241+
:python_executable_path,
242+
:python_library_handle,
243+
:python_library_path,
244+
:python_version,
245+
:pynew,
246+
:pyisnull,
247+
:pycopy!,
248+
:getptr,
249+
:pydel!,
250+
:unsafe_pynext,
251+
:pyconvert_add_rule,
252+
:pyconvert_return,
253+
:pyconvert_unconverted,
254+
:event_loop_on,
255+
:event_loop_off,
256+
:fix_qt_plugin_path,
257+
),
258+
)
259+
end

src/API/GC.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
module PythonCall.GC
3+
4+
Garbage collection of Python objects.
5+
6+
See [`gc`](@ref).
7+
"""
8+
module GC
9+
10+
# functions
11+
function enable end
12+
function disable end
13+
function gc end
14+
15+
# public bindings
16+
if Base.VERSION v"1.11"
17+
eval(Expr(:public, :enable, :disable, :gc))
18+
end
19+
20+
end

src/API/GIL.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
module PythonCall.GIL
3+
4+
Handling the Python Global Interpreter Lock.
5+
6+
See [`lock`](@ref), [`@lock`](@ref), [`unlock`](@ref) and [`@unlock`](@ref).
7+
"""
8+
module GIL
9+
10+
# functions
11+
function lock end
12+
function unlock end
13+
14+
# macros
15+
macro lock end
16+
macro unlock end
17+
18+
# public bindings
19+
if Base.VERSION v"1.11"
20+
eval(Expr(:public, :lock, :unlock, Symbol("@lock"), Symbol("@unlock")))
21+
end
22+
23+
end
File renamed without changes.

src/GC-api.jl

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/GIL-api.jl

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/PythonCall.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
module PythonCall
22

3-
include("api.jl")
3+
include("API/API.jl")
44

55
module Internals
66

77
using ..PythonCall
88

9+
@kwdef mutable struct Config
10+
meta::String = ""
11+
auto_sys_last_traceback::Bool = true
12+
auto_fix_qt_plugin_path::Bool = true
13+
end
14+
915
include("Utils.jl")
1016
include("C/C.jl")
1117
include("GIL.jl")
@@ -19,6 +25,10 @@ include("GC.jl")
1925

2026
end
2127

28+
# config
29+
"Configuration for PythonCall."
30+
const CONFIG = Internals.Config()
31+
2232
# # not API but used in tests
2333
# for k in [
2434
# :pyjlanytype,

0 commit comments

Comments
 (0)