Skip to content

Commit b3cc79f

Browse files
committed
Merge remote-tracking branch 'origin/main' into hh-timedelta64
2 parents 1e8d410 + ce8bd7a commit b3cc79f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2935
-1918
lines changed

.JuliaFormatter.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ignore = [
2+
"examples",
3+
".git",
4+
".CondaPkg",
5+
".ipynb_checkpoints",
6+
".pytest_cache",
7+
".venv",
8+
]

.github/workflows/tagbot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ on:
44
types:
55
- created
66
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: "3"
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
723
jobs:
824
TagBot:
925
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
@@ -12,4 +28,6 @@ jobs:
1228
- uses: JuliaRegistries/TagBot@v1
1329
with:
1430
token: ${{ secrets.GITHUB_TOKEN }}
31+
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
1532
ssh: ${{ secrets.DOCUMENTER_KEY }}
33+
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}

CondaPkg.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[deps.libstdcxx-ng]
22
version = "<=julia"
33

4+
[deps.openssl]
5+
version = "<=julia"
6+
47
[deps.python]
58
build = "**cpython**"
69
version = ">=3.8,<4"

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PythonCall"
22
uuid = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
33
authors = ["Christopher Doris <github.com/cjdoris>"]
4-
version = "0.9.20"
4+
version = "0.9.21"
55

66
[deps]
77
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
@@ -18,7 +18,7 @@ UnsafePointers = "e17b2a0c-0bdf-430a-bd0c-3a23cae4ff39"
1818

1919
[compat]
2020
Aqua = "0 - 999"
21-
CondaPkg = "0.2.21"
21+
CondaPkg = "0.2.23"
2222
Dates = "1"
2323
Libdl = "1"
2424
MacroTools = "0.5"

bump.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function bump(file, oldpat, newpat)
99
oldtext = read(file, String)
1010
newtext = replace(oldtext, oldpat => newpat)
1111
@assert newtext != oldtext
12-
write(file, newtext)
12+
write(file, newtext)
1313
end
1414

1515
function bumpver(file, pattern, oldver, newver)

docs/customdocs.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function runner(::Type{CustomDocExpander}, node, page, doc)
5353
Dict{Symbol,Any}( # NOTE: Not sure about what to put here.
5454
:module => Main, # This is supposed to be tracking python code.
5555
:path => "",
56-
:linenumber => 0
57-
)
56+
:linenumber => 0,
57+
),
5858
)::Docs.DocStr
5959

6060
# NOTE: This was modified because the original Documenter.create_docsnode was generating unreachable links
@@ -80,12 +80,10 @@ function _parse_docs(code::AbstractString)
8080
m = match(r"^(.+?)\s*-\s*(.+?)\s*(\n[\s\S]*)$", strip(code))
8181

8282
if isnothing(m)
83-
error(
84-
"""
85-
Invalid docstring:
86-
$(code)
87-
"""
88-
)
83+
error("""
84+
Invalid docstring:
85+
$(code)
86+
""")
8987
end
9088

9189
name = Symbol(m[1])
@@ -134,4 +132,4 @@ function _create_docsnode(docstring, result, object, page, doc)
134132
return MarkdownAST.Node(docsnode)
135133
end
136134

137-
end # module CustomDocs
135+
end # module CustomDocs

docs/make.jl

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@ include("customdocs.jl")
55
makedocs(
66
sitename = "PythonCall & JuliaCall",
77
modules = [PythonCall],
8-
format = Documenter.HTML(
9-
assets = ["assets/favicon.ico"],
10-
),
8+
format = Documenter.HTML(assets = ["assets/favicon.ico"]),
119
warnonly = [:missing_docs], # avoid raising error when docs are missing
1210
pages = [
1311
"Home" => "index.md",
14-
"The Julia module PythonCall" => [
15-
"Guide" => "pythoncall.md",
16-
"Reference" => "pythoncall-reference.md",
17-
],
18-
"The Python module JuliaCall" => [
19-
"Guide" => "juliacall.md",
20-
"Reference" => "juliacall-reference.md",
21-
],
12+
"The Julia module PythonCall" =>
13+
["Guide" => "pythoncall.md", "Reference" => "pythoncall-reference.md"],
14+
"The Python module JuliaCall" =>
15+
["Guide" => "juliacall.md", "Reference" => "juliacall-reference.md"],
2216
"Conversion" => [
2317
"Julia to Python" => "conversion-to-python.md",
2418
"Python to Julia" => "conversion-to-julia.md",
@@ -27,10 +21,7 @@ makedocs(
2721
"faq.md",
2822
"pycall.md",
2923
"releasenotes.md",
30-
]
24+
],
3125
)
3226

33-
deploydocs(
34-
repo = raw"github.com/JuliaPy/PythonCall.jl.git",
35-
push_preview = true
36-
)
27+
deploydocs(repo = raw"github.com/JuliaPy/PythonCall.jl.git", push_preview = true)

docs/src/releasenotes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Release Notes
22

3-
## Unreleased
3+
## 0.9.21 (2024-07-20)
44
* `Serialization.serialize` can use `dill` instead of `pickle` by setting the env var `JULIA_PYTHONCALL_PICKLE=dill`.
55
* `numpy.bool_` can now be converted to `Bool` and other number types.
66
* `datetime.timedelta` can now be converted to `Dates.Nanosecond`, `Microsecond`, `Millisecond` and `Second`. This behaviour was already documented.
7+
* In JuliaCall, the Julia runtime is now properly terminated when Python exits. This means all finalizers should always run.
8+
* NULL Python objects (such as from `pynew()`) can be safely displayed in multimedia contexts (VSCode/Pluto/etc.)
79

810
## 0.9.20 (2024-05-01)
911
* The IPython extension is now automatically loaded upon import if IPython is detected.

pysrc/juliacall/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This module gets modified by PythonCall when it is loaded, e.g. to include Core, Base
22
# and Main modules.
33

4-
__version__ = '0.9.20'
4+
__version__ = '0.9.21'
55

66
_newmodule = None
77

@@ -49,6 +49,7 @@ def backtrace(self):
4949
CONFIG = {'inited': False}
5050

5151
def init():
52+
import atexit
5253
import os
5354
import ctypes as c
5455
import sys
@@ -177,7 +178,7 @@ def args_from_config():
177178
os.environ['PATH'] = libdir
178179

179180
# Open the library
180-
CONFIG['lib'] = lib = c.CDLL(libpath, mode=c.RTLD_GLOBAL)
181+
CONFIG['lib'] = lib = c.PyDLL(libpath, mode=c.RTLD_GLOBAL)
181182

182183
# parse options
183184
argc, argv = args_from_config()
@@ -199,6 +200,15 @@ def args_from_config():
199200
None if sysimg is None else sysimg.encode('utf8'),
200201
)
201202

203+
# call jl_atexit_hook() when python exits to gracefully stop the julia runtime,
204+
# including running finalizers for any objects that still exist
205+
@atexit.register
206+
def at_jl_exit():
207+
jl_atexit_hook = lib.jl_atexit_hook
208+
jl_atexit_hook.argtypes = [c.c_int]
209+
jl_atexit_hook.restype = None
210+
jl_atexit_hook(0)
211+
202212
# initialise PythonCall
203213
jl_eval = lib.jl_eval_string
204214
jl_eval.argtypes = [c.c_char_p]

pysrc/juliacall/juliapkg-dev.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages": {
44
"PythonCall": {
55
"uuid": "6099a3de-0909-46bc-b1f4-468b9a2dfc0d",
6-
"version": "=0.9.20",
6+
"version": "=0.9.21",
77
"path": "../..",
88
"dev": true
99
}

0 commit comments

Comments
 (0)