Skip to content

Commit c0a5634

Browse files
authored
Centralize Public API into dedicated API module (#648)
* partial work creating central api * add ispy to the api * add Py to the API * add PyException to the API * add pybuiltins to the API * fix Py constructor * fix imports * remove unneeded exports * add pyconst macro to the API * add wrapper types to API * add py macro to API * add pytable to API * add JlWrap functions to API * move PyObjectArray into API * reformat * don't need to re-export now * fix imports * remove unused imports * fix version * version has moved file * sort/deduplicate imports/exports --------- Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent b9fee86 commit c0a5634

38 files changed

+848
-529
lines changed

bump.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ bumpver("pyproject.toml", "version = \"{}\"\n", oldver, newver)
2626
bumpver("pysrc/juliacall/__init__.py", "__version__ = '{}'\n", oldver, newver)
2727
bumpver("pysrc/juliacall/juliapkg.json", "\"version\": \"={}\"", oldver, newver)
2828
bumpver("pysrc/juliacall/juliapkg-dev.json", "\"version\": \"={}\"", oldver, newver)
29-
bumpver("src/PythonCall.jl", "VERSION = v\"{}\"", oldver, newver)
29+
bumpver("src/API/API.jl", "VERSION = v\"{}\"", oldver, newver)
3030
bumpver("src/Core/Core.jl", "VERSION = v\"{}\"", oldver, newver)
3131
bump("docs/src/releasenotes.md", "## Unreleased", "## $newver ($(today()))")

src/API/API.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"The version of PythonCall."
2+
const VERSION = v"0.9.26"
3+
4+
include("types.jl")
5+
include("functions.jl")
6+
include("macros.jl")
7+
include("exports.jl")
8+
include("publics.jl")

src/API/exports.jl

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Core
2+
export @py
3+
export @pyconst
4+
export @pyeval
5+
export @pyexec
6+
export ispy
7+
export Py
8+
export pyabs
9+
export pyadd
10+
export pyall
11+
export pyand
12+
export pyany
13+
export pyascii
14+
export pybool
15+
export pybuiltins
16+
export pybytes
17+
export pycall
18+
export pycallable
19+
export pycollist
20+
export pycompile
21+
export pycomplex
22+
export pycontains
23+
export pydate
24+
export pydatetime
25+
export pydelattr
26+
export pydelitem
27+
export pydict
28+
export pydir
29+
export pydivmod
30+
export pyeq
31+
export pyeval
32+
export PyException
33+
export pyexec
34+
export pyfloat
35+
export pyfloordiv
36+
export pyfraction
37+
export pyfrozenset
38+
export pyge
39+
export pygetattr
40+
export pygetitem
41+
export pygt
42+
export pyhasattr
43+
export pyhash
44+
export pyhasitem
45+
export pyhelp
46+
export pyiadd
47+
export pyiand
48+
export pyifloordiv
49+
export pyilshift
50+
export pyimatmul
51+
export pyimod
52+
export pyimport
53+
export pyimul
54+
export pyin
55+
export pyindex
56+
export pyint
57+
export pyinv
58+
export pyior
59+
export pyipow
60+
export pyirshift
61+
export pyis
62+
export pyisinstance
63+
export pyissubclass
64+
export pyisub
65+
export pyiter
66+
export pyitruediv
67+
export pyixor
68+
export pyle
69+
export pylen
70+
export pylist
71+
export pylshift
72+
export pylt
73+
export pymatmul
74+
export pymod
75+
export pymul
76+
export pyne
77+
export pyneg
78+
export pynext
79+
export pynot
80+
export pyor
81+
export pypos
82+
export pypow
83+
export pyprint
84+
export pyrange
85+
export pyrepr
86+
export pyrowlist
87+
export pyrshift
88+
export pyset
89+
export pysetattr
90+
export pysetitem
91+
export pyslice
92+
export pystr
93+
export pysub
94+
export pytime
95+
export pytruediv
96+
export pytruth
97+
export pytuple
98+
export pytype
99+
export pywith
100+
export pyxor
101+
102+
# Convert
103+
export @pyconvert
104+
export pyconvert
105+
export pyconvert_add_rule
106+
export PYCONVERT_PRIORITY_ARRAY
107+
export PYCONVERT_PRIORITY_CANONICAL
108+
export PYCONVERT_PRIORITY_FALLBACK
109+
export PYCONVERT_PRIORITY_NORMAL
110+
export PYCONVERT_PRIORITY_WRAP
111+
export pyconvert_return
112+
export pyconvert_unconverted
113+
114+
# Wrap
115+
export PyArray
116+
export PyDict
117+
export PyIO
118+
export PyIterable
119+
export PyList
120+
export PyPandasDataFrame
121+
export PySet
122+
export PyTable
123+
124+
# JlWrap
125+
export pybinaryio
126+
export pyclassmethod
127+
export pyfunc
128+
export pyisjl
129+
export pyjl
130+
export pyjlraw
131+
export pyjltype
132+
export pyjlvalue
133+
export PyObjectArray
134+
export PyObjectMatrix
135+
export PyObjectVector
136+
export pyproperty
137+
export pystaticmethod
138+
export pytextio
139+
140+
# Compat
141+
export pytable

src/API/functions.jl

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# C
2+
function python_executable_path end
3+
function python_library_handle end
4+
function python_library_path end
5+
function python_version end
6+
7+
# Core
8+
function getptr end
9+
function ispy end
10+
function pyabs end
11+
function pyadd end
12+
function pyall end
13+
function pyand end
14+
function pyany end
15+
function pyascii end
16+
function pybool end
17+
function pybytes end
18+
function pycall end
19+
function pycallable end
20+
function pycollist end
21+
function pycompile end
22+
function pycomplex end
23+
function pycontains end
24+
function pycopy! end
25+
function pydate end
26+
function pydatetime end
27+
function pydel! end
28+
function pydelattr end
29+
function pydelitem end
30+
function pydict end
31+
function pydir end
32+
function pydivmod end
33+
function pyeq end
34+
function pyeval end
35+
function pyexec end
36+
function pyfloat end
37+
function pyfloordiv end
38+
function pyfraction end
39+
function pyfrozenset end
40+
function pyge end
41+
function pygetattr end
42+
function pygetitem end
43+
function pygt end
44+
function pyhasattr end
45+
function pyhash end
46+
function pyhasitem end
47+
function pyhelp end
48+
function pyiadd end
49+
function pyiand end
50+
function pyifloordiv end
51+
function pyilshift end
52+
function pyimatmul end
53+
function pyimod end
54+
function pyimport end
55+
function pyimul end
56+
function pyin end
57+
function pyindex end
58+
function pyint end
59+
function pyinv end
60+
function pyior end
61+
function pyipow end
62+
function pyirshift end
63+
function pyis end
64+
function pyisinstance end
65+
function pyisnull end
66+
function pyissubclass end
67+
function pyisub end
68+
function pyiter end
69+
function pyitruediv end
70+
function pyixor end
71+
function pyle end
72+
function pylen end
73+
function pylist end
74+
function pylshift end
75+
function pylt end
76+
function pymatmul end
77+
function pymod end
78+
function pymul end
79+
function pyne end
80+
function pyneg end
81+
function pynew end
82+
function pynext end
83+
function pynot end
84+
function pyor end
85+
function pypos end
86+
function pypow end
87+
function pyprint end
88+
function pyrange end
89+
function pyrepr end
90+
function pyrowlist end
91+
function pyrshift end
92+
function pyset end
93+
function pysetattr end
94+
function pysetitem end
95+
function pyslice end
96+
function pystr end
97+
function pysub end
98+
function pytime end
99+
function pytruediv end
100+
function pytruth end
101+
function pytuple end
102+
function pytype end
103+
function pywith end
104+
function pyxor end
105+
function unsafe_pynext end
106+
107+
# Convert
108+
function pyconvert end
109+
function pyconvert_add_rule end
110+
function pyconvert_return end
111+
function pyconvert_unconverted end
112+
113+
# JlWrap
114+
function pybinaryio end
115+
function pyclassmethod end
116+
function pyfunc end
117+
function pyisjl end
118+
function pyjl end
119+
function pyjlraw end
120+
function pyjltype end
121+
function pyjlvalue end
122+
function pyproperty end
123+
function pystaticmethod end
124+
function pytextio end
125+
126+
# Compat
127+
function event_loop_off end
128+
function event_loop_on end
129+
function fix_qt_plugin_path end
130+
function pytable end

src/API/macros.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Core
2+
macro pyconst end
3+
macro pyeval end
4+
macro pyexec end
5+
6+
# Convert
7+
macro pyconvert end
8+
9+
# PyMacro
10+
macro py end

src/API/publics.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
if Base.VERSION v"1.11"
2+
eval(Meta.parse("""
3+
public
4+
GC,
5+
GIL,
6+
VERSION,
7+
8+
# C
9+
python_executable_path,
10+
python_library_handle,
11+
python_library_path,
12+
python_version,
13+
14+
# Core
15+
CONFIG,
16+
getptr,
17+
pycopy!,
18+
pydel!,
19+
pyisnull,
20+
pynew,
21+
PyNULL,
22+
unsafe_pynext,
23+
24+
# Compat
25+
event_loop_off,
26+
event_loop_on,
27+
fix_qt_plugin_path
28+
"""))
29+
end

0 commit comments

Comments
 (0)