Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into hh-timedelta64
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Jul 28, 2024
2 parents 1e8d410 + ce8bd7a commit b3cc79f
Show file tree
Hide file tree
Showing 74 changed files with 2,935 additions and 1,918 deletions.
8 changes: 8 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ignore = [
"examples",
".git",
".CondaPkg",
".ipynb_checkpoints",
".pytest_cache",
".venv",
]
18 changes: 18 additions & 0 deletions .github/workflows/tagbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ on:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand All @@ -12,4 +28,6 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
ssh: ${{ secrets.DOCUMENTER_KEY }}
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
3 changes: 3 additions & 0 deletions CondaPkg.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[deps.libstdcxx-ng]
version = "<=julia"

[deps.openssl]
version = "<=julia"

[deps.python]
build = "**cpython**"
version = ">=3.8,<4"
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PythonCall"
uuid = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
authors = ["Christopher Doris <github.com/cjdoris>"]
version = "0.9.20"
version = "0.9.21"

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

[compat]
Aqua = "0 - 999"
CondaPkg = "0.2.21"
CondaPkg = "0.2.23"
Dates = "1"
Libdl = "1"
MacroTools = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion bump.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function bump(file, oldpat, newpat)
oldtext = read(file, String)
newtext = replace(oldtext, oldpat => newpat)
@assert newtext != oldtext
write(file, newtext)
write(file, newtext)
end

function bumpver(file, pattern, oldver, newver)
Expand Down
16 changes: 7 additions & 9 deletions docs/customdocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function runner(::Type{CustomDocExpander}, node, page, doc)
Dict{Symbol,Any}( # NOTE: Not sure about what to put here.
:module => Main, # This is supposed to be tracking python code.
:path => "",
:linenumber => 0
)
:linenumber => 0,
),
)::Docs.DocStr

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

if isnothing(m)
error(
"""
Invalid docstring:
$(code)
"""
)
error("""
Invalid docstring:
$(code)
""")
end

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

end # module CustomDocs
end # module CustomDocs
23 changes: 7 additions & 16 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ include("customdocs.jl")
makedocs(
sitename = "PythonCall & JuliaCall",
modules = [PythonCall],
format = Documenter.HTML(
assets = ["assets/favicon.ico"],
),
format = Documenter.HTML(assets = ["assets/favicon.ico"]),
warnonly = [:missing_docs], # avoid raising error when docs are missing
pages = [
"Home" => "index.md",
"The Julia module PythonCall" => [
"Guide" => "pythoncall.md",
"Reference" => "pythoncall-reference.md",
],
"The Python module JuliaCall" => [
"Guide" => "juliacall.md",
"Reference" => "juliacall-reference.md",
],
"The Julia module PythonCall" =>
["Guide" => "pythoncall.md", "Reference" => "pythoncall-reference.md"],
"The Python module JuliaCall" =>
["Guide" => "juliacall.md", "Reference" => "juliacall-reference.md"],
"Conversion" => [
"Julia to Python" => "conversion-to-python.md",
"Python to Julia" => "conversion-to-julia.md",
Expand All @@ -27,10 +21,7 @@ makedocs(
"faq.md",
"pycall.md",
"releasenotes.md",
]
],
)

deploydocs(
repo = raw"github.com/JuliaPy/PythonCall.jl.git",
push_preview = true
)
deploydocs(repo = raw"github.com/JuliaPy/PythonCall.jl.git", push_preview = true)
4 changes: 3 additions & 1 deletion docs/src/releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Release Notes

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

## 0.9.20 (2024-05-01)
* The IPython extension is now automatically loaded upon import if IPython is detected.
Expand Down
14 changes: 12 additions & 2 deletions pysrc/juliacall/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This module gets modified by PythonCall when it is loaded, e.g. to include Core, Base
# and Main modules.

__version__ = '0.9.20'
__version__ = '0.9.21'

_newmodule = None

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

def init():
import atexit
import os
import ctypes as c
import sys
Expand Down Expand Up @@ -177,7 +178,7 @@ def args_from_config():
os.environ['PATH'] = libdir

# Open the library
CONFIG['lib'] = lib = c.CDLL(libpath, mode=c.RTLD_GLOBAL)
CONFIG['lib'] = lib = c.PyDLL(libpath, mode=c.RTLD_GLOBAL)

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

# call jl_atexit_hook() when python exits to gracefully stop the julia runtime,
# including running finalizers for any objects that still exist
@atexit.register
def at_jl_exit():
jl_atexit_hook = lib.jl_atexit_hook
jl_atexit_hook.argtypes = [c.c_int]
jl_atexit_hook.restype = None
jl_atexit_hook(0)

# initialise PythonCall
jl_eval = lib.jl_eval_string
jl_eval.argtypes = [c.c_char_p]
Expand Down
2 changes: 1 addition & 1 deletion pysrc/juliacall/juliapkg-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": {
"PythonCall": {
"uuid": "6099a3de-0909-46bc-b1f4-468b9a2dfc0d",
"version": "=0.9.20",
"version": "=0.9.21",
"path": "../..",
"dev": true
}
Expand Down
2 changes: 1 addition & 1 deletion pysrc/juliacall/juliapkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": {
"PythonCall": {
"uuid": "6099a3de-0909-46bc-b1f4-468b9a2dfc0d",
"version": "=0.9.20"
"version": "=0.9.21"
}
}
}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = juliacall
version = 0.9.20
version = 0.9.21
description = Julia and Python in seamless harmony
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
4 changes: 2 additions & 2 deletions src/C/C.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ using UnsafePointers: UnsafePtr
using CondaPkg: CondaPkg
using Pkg: Pkg
using Requires: @require
using Libdl: dlpath, dlopen, dlopen_e, dlclose, dlsym, dlsym_e, RTLD_LAZY, RTLD_DEEPBIND, RTLD_GLOBAL
using Libdl:
dlpath, dlopen, dlopen_e, dlclose, dlsym, dlsym_e, RTLD_LAZY, RTLD_DEEPBIND, RTLD_GLOBAL

include("consts.jl")
include("pointers.jl")
include("extras.jl")
include("context.jl")
include("gil.jl")
include("api.jl")

function __init__()
Expand Down
Loading

0 comments on commit b3cc79f

Please sign in to comment.