Skip to content

Commit b81c389

Browse files
author
Christopher Doris
committed
Merge remote-tracking branch 'origin/main' into v1
2 parents 19119b6 + b9aafe9 commit b81c389

File tree

24 files changed

+240
-35
lines changed

24 files changed

+240
-35
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ jobs:
5656
fail-fast: true
5757
matrix:
5858
os: [ubuntu-latest, windows-latest, macos-latest]
59-
pyversion: ["3.x", "3.7"]
59+
pyversion: ["3.x", "3.8"]
6060
steps:
6161
- uses: actions/checkout@v3
6262
- name: Set up Python ${{ matrix.pyversion }}
6363
uses: actions/setup-python@v4
6464
with:
6565
python-version: ${{ matrix.pyversion }}
66-
- name: Set up Julia 1.10.0
66+
- name: Set up Julia
6767
uses: julia-actions/setup-julia@v1
6868
with:
69-
version: '1.10.0'
69+
version: '1'
7070
- name: Install dependencies
7171
run: |
7272
python -m pip install --upgrade pip
73-
pip install flake8 pytest pytest-cov
73+
pip install flake8 pytest pytest-cov nbval numpy
7474
cp pysrc/juliacall/juliapkg-dev.json pysrc/juliacall/juliapkg.json
7575
pip install -e .
7676
- name: Lint with flake8
@@ -81,7 +81,7 @@ jobs:
8181
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
8282
- name: Run tests
8383
run: |
84-
pytest -s --cov=pysrc
84+
pytest -s --nbval --cov=pysrc ./pytest/
8585
- name: Upload coverage to Codecov
8686
uses: codecov/codecov-action@v2
8787
env:

CondaPkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ version = "<=julia"
33

44
[deps.python]
55
build = "**cpython**"
6-
version = ">=3.7,<4"
6+
version = ">=3.8,<4"

Project.toml

Lines changed: 1 addition & 1 deletion
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.17"
4+
version = "0.9.20"
55

66
[deps]
77
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
1414
- Fast non-copying conversion of numeric arrays in either direction: modify Python arrays (e.g. `bytes`, `array.array`, `numpy.ndarray`) from Julia or Julia arrays from Python.
1515
- Helpful wrappers: interpret Python sequences, dictionaries, arrays, dataframes and IO streams as their Julia counterparts, and vice versa.
1616
- Beautiful stack-traces.
17-
- Supports modern systems: tested on Windows, MacOS and Linux, 64-bit, Julia 1.6.1 upwards and Python 3.7 upwards.
17+
- Supports modern systems: tested on Windows, MacOS and Linux, 64-bit, Julia 1.6.1 upwards and Python 3.8 upwards.
1818

1919
⭐ If you like this, a GitHub star would be lovely thank you. ⭐
2020

@@ -45,4 +45,4 @@ The existing package [PyCall](https://github.com/JuliaPy/PyCall.jl) is another s
4545
- PythonCall by default never copies mutable objects when converting, but instead directly wraps the mutable object. This means that modifying the converted object modifies the original, and conversion is faster.
4646
- PythonCall does not usually automatically convert results to Julia values, but leaves them as Python objects. This makes it easier to do Pythonic things with these objects (e.g. accessing methods) and is type-stable.
4747
- PythonCall installs dependencies into a separate Conda environment for each Julia project. This means each Julia project can have an isolated set of Python dependencies.
48-
- PythonCall supports Julia 1.6.1+ and Python 3.7+ whereas PyCall supports Julia 0.7+ and Python 2.7+.
48+
- PythonCall supports Julia 1.6.1+ and Python 3.8+ whereas PyCall supports Julia 0.7+ and Python 2.7+.

docs/src/compat.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ The `juliacall` IPython extension adds these features to your IPython session:
6767

6868
The extension is experimental and unstable - the API can change at any time.
6969

70-
Enable the extension with `%load_ext juliacall`.
71-
See [the IPython docs](https://ipython.readthedocs.io/en/stable/config/extensions/).
70+
You can explicitly enable the extension with `%load_ext juliacall`, but
71+
it will automatically be loaded if `juliacall` is imported and IPython is detected.
72+
You can disable this behavior with an [environment variable](@ref julia-config).
7273

7374
The `%%julia` cell magic can synchronise variables between Julia and Python by listing them
7475
on the first line:
@@ -88,6 +89,9 @@ In [5]: z
8889
Out[5]: '2^8 = 256'
8990
```
9091

92+
Also see [the IPython docs](https://ipython.readthedocs.io/en/stable/config/extensions/)
93+
for more information on extensions.
94+
9195
## Asynchronous Julia code (including Makie)
9296

9397
Asynchronous Julia code will not normally run while Python is executing, unless it is in a

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
77
- Fast non-copying conversion of numeric arrays in either direction: modify Python arrays (e.g. `bytes`, `array.array`, `numpy.ndarray`) from Julia or Julia arrays from Python.
88
- Helpful wrappers: interpret Python sequences, dictionaries, arrays, dataframes and IO streams as their Julia counterparts, and vice versa.
99
- Beautiful stack-traces.
10-
- Works anywhere: tested on Windows, MacOS and Linux, 32- and 64-bit, Julia Julia 1.6.1 upwards and Python 3.7 upwards.
10+
- Works anywhere: tested on Windows, MacOS and Linux, 32- and 64-bit, Julia Julia 1.6.1 upwards and Python 3.8 upwards.

docs/src/juliacall.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,4 @@ be configured in two ways:
123123
| `-X juliacall-sysimage=<file>` | `PYTHON_JULIACALL_SYSIMAGE=<file>` | Use the given system image. |
124124
| `-X juliacall-threads=<N\|auto>` | `PYTHON_JULIACALL_THREADS=<N\|auto>` | Launch N threads. |
125125
| `-X juliacall-warn-overwrite=<yes\|no>` | `PYTHON_JULIACALL_WARN_OVERWRITE=<yes\|no>` | Enable or disable method overwrite warnings. |
126+
| `-X juliacall-autoload-ipython-extension=<yes\|no>` | `PYTHON_JULIACALL_AUTOLOAD_IPYTHON_EXTENSION=<yes\|no>` | Enable or disable IPython extension autoloading. |

docs/src/pycall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ Note also that JuliaCall will use a separate Julia project for each virtual/cond
7272

7373
### Compatibility
7474

75-
PyCall supports Julia 0.7+ and Python 2.7+, whereas PythonCall supports Julia 1.6.1+ and Python 3.7+. PyCall requires numpy to be installed, PythonCall doesn't (it provides the same fast array access through the buffer protocol and array interface).
75+
PyCall supports Julia 0.7+ and Python 2.7+, whereas PythonCall supports Julia 1.6.1+ and Python 3.8+. PyCall requires numpy to be installed, PythonCall doesn't (it provides the same fast array access through the buffer protocol and array interface).

docs/src/releasenotes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
## Unreleased (v1)
44
* `PythonCall.GC` is now more like `Base.GC`: `enable(true)` replaces `enable()`, `enable(false)` replaces `disable()`, and `gc()` is added.
55

6+
## 0.9.20 (2024-05-01)
7+
* The IPython extension is now automatically loaded upon import if IPython is detected.
8+
* JuliaCall now compatible with Julia 1.10.3.
9+
* Minimum supported Python version is now 3.8.
10+
11+
## 0.9.19 (2024-03-19)
12+
* Bug fixes.
13+
14+
## 0.9.18 (2024-03-18)
15+
* Bug fixes.
16+
617
## 0.9.17 (2024-03-16)
718
* Bug fixes.
819

pysrc/juliacall/__init__.py

Lines changed: 24 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.17'
4+
__version__ = '0.9.20'
55

66
_newmodule = None
77

@@ -248,8 +248,30 @@ def jlstr(x):
248248
"PYTHON_JULIACALL_HANDLE_SIGNALS=no."
249249
)
250250

251-
init()
251+
# Next, automatically load the juliacall extension if we are in IPython or Jupyter
252+
CONFIG['autoload_ipython_extension'] = choice('autoload_ipython_extension', ['yes', 'no'])[0]
253+
if CONFIG['autoload_ipython_extension'] in {'yes', None}:
254+
try:
255+
get_ipython = sys.modules['IPython'].get_ipython
256+
257+
if CONFIG['autoload_ipython_extension'] is None:
258+
# Only let the user know if it was not explicitly set
259+
print(
260+
"Detected IPython. Loading juliacall extension. See https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython"
261+
)
262+
263+
load_ipython_extension(get_ipython())
264+
except Exception as e:
265+
if CONFIG['autoload_ipython_extension'] == 'yes':
266+
# Only warn if the user explicitly requested the extension to be loaded
267+
warnings.warn(
268+
"Could not load juliacall extension in Jupyter notebook: " + str(e)
269+
)
270+
pass
271+
252272

253273
def load_ipython_extension(ip):
254274
import juliacall.ipython
255275
juliacall.ipython.load_ipython_extension(ip)
276+
277+
init()

0 commit comments

Comments
 (0)