Skip to content

Commit 5b743a8

Browse files
authored
Merge branch 'master' into patch-1
2 parents ec3a030 + ff10f4a commit 5b743a8

38 files changed

+223
-205
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- uses: julia-actions/julia-buildpkg@v1
5555
- uses: julia-actions/julia-runtest@v1
5656
env:
57-
JULIA_DEBUG: Python
57+
JULIA_DEBUG: PythonCall
5858
- uses: julia-actions/julia-processcoverage@v1
5959
- uses: codecov/codecov-action@v1
6060
with:
@@ -88,8 +88,8 @@ jobs:
8888
- uses: julia-actions/julia-buildpkg@v1
8989
- uses: julia-actions/julia-runtest@v1
9090
env:
91-
JULIA_DEBUG: Python
92-
PYTHONJL_EXE: CONDA
91+
JULIA_DEBUG: PythonCall
92+
JULIA_PYTHONCALL_EXE: CONDA
9393
- uses: julia-actions/julia-processcoverage@v1
9494
- uses: codecov/codecov-action@v1
9595
with:
@@ -111,8 +111,8 @@ jobs:
111111
- run: |
112112
julia --project=docs -e '
113113
using Documenter: doctest
114-
using Python
115-
doctest(Python)'
114+
using PythonCall
115+
doctest(PythonCall)'
116116
- run: julia --project=docs docs/make.jl
117117
env:
118118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "Python"
1+
name = "PythonCall"
22
uuid = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
33
authors = ["Christopher Doris <github.com/cjdoris>"]
44
version = "0.1.0"

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
![Python.jl logo](https://raw.githubusercontent.com/cjdoris/Python.jl/master/logo-text.svg)
1+
![PythonCall.jl logo](https://raw.githubusercontent.com/cjdoris/PythonCall.jl/master/logo-text.svg)
22
---
3-
[![Stable Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://cjdoris.github.io/Python.jl/stable)
4-
[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://cjdoris.github.io/Python.jl/dev)
5-
[![Test Status](https://github.com/cjdoris/Python.jl/workflows/Tests/badge.svg)](https://github.com/cjdoris/Python.jl/actions?query=workflow%3ATests)
6-
[![Codecov](https://codecov.io/gh/cjdoris/Python.jl/branch/master/graph/badge.svg?token=A813UUIHGS)](https://codecov.io/gh/cjdoris/Python.jl)
3+
[![Stable Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://cjdoris.github.io/PythonCall.jl/stable)
4+
[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://cjdoris.github.io/PythonCall.jl/dev)
5+
[![Test Status](https://github.com/cjdoris/PythonCall.jl/workflows/Tests/badge.svg)](https://github.com/cjdoris/PythonCall.jl/actions?query=workflow%3ATests)
6+
[![Codecov](https://codecov.io/gh/cjdoris/PythonCall.jl/branch/master/graph/badge.svg?token=A813UUIHGS)](https://codecov.io/gh/cjdoris/PythonCall.jl)
77

88
Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://julialang.org/) together in seamless harmony:
99
- Call Python code from Julia and Julia code from Python via a symmetric interface.
@@ -16,22 +16,22 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
1616

1717
⭐ If you like this, a GitHub star would be lovely thank you. ⭐
1818

19-
To get started, read the [documentation](https://cjdoris.github.io/Python.jl/stable).
19+
To get started, read the [documentation](https://cjdoris.github.io/PythonCall.jl/stable).
2020

2121
## Example 1: Calling Python from Julia
2222

23-
In this example, we use `Python.jl` from an IJulia notebook to inspect the Iris dataset:
23+
In this example, we use `PythonCall.jl` from an IJulia notebook to inspect the Iris dataset:
2424
- We load the Iris dataset as a Julia `DataFrame` using `RDatasets.jl`.
2525
- We use `pypandasdataframe(df)` to convert it to a Python `pandas.DataFrame`.
2626
- We use the Python package `seaborn` to produce a pair-plot, which is automatically displayed.
2727

28-
![Seaborn example screenshot](https://raw.githubusercontent.com/cjdoris/Python.jl/master/examples/seaborn.png)
28+
![Seaborn example screenshot](https://raw.githubusercontent.com/cjdoris/PythonCall.jl/master/examples/seaborn.png)
2929

3030
## Example 2: Calling Julia from Python
3131

32-
In this example we use the Python module `juliaaa` from an IPython notebook to train a simple neural network:
32+
In this example we use the Python module `juliacall` from an IPython notebook to train a simple neural network:
3333
- We generate some random training data using Python's `numpy`.
3434
- We construct and train a neural network model using Julia' `Flux`.
3535
- We plot some sample output from the model using Python's `matplotlib.pyplot`.
3636

37-
![Flux example screenshot](https://raw.githubusercontent.com/cjdoris/Python.jl/master/examples/flux.png)
37+
![Flux example screenshot](https://raw.githubusercontent.com/cjdoris/PythonCall.jl/master/examples/flux.png)

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
Python = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
3+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"

docs/make.jl

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
using Documenter, Python, Markdown
1+
using Documenter, PythonCall, Markdown
22

3+
# This is a bit of a hack to let us insert documentation blocks with custom content.
4+
# It means we can document Python things directly in the documentation source, and they
5+
# are searchable.
6+
#
7+
# It's a hack because of the `doccat` overload, requiring a special kind of "signature"
8+
# to embed the information we want.
9+
#
10+
# The first line is of the form "name - category", the rest is Markdown documentation.
11+
# For example:
12+
# ```@customdoc
13+
# foo - Function
14+
# Documentation for `foo`.
15+
# ```
316
struct CustomCat{cat} end
417
Documenter.Utilities.doccat(::Base.Docs.Binding, ::Type{CustomCat{cat}}) where {cat} = string(cat)
518
struct CustomDocBlocks <: Documenter.Expanders.ExpanderPipeline end
@@ -18,19 +31,19 @@ Documenter.Expanders.Selectors.runner(::Type{CustomDocBlocks}, x, page, doc) = b
1831
end
1932

2033
makedocs(
21-
sitename = "Python.jl",
22-
modules = [Python],
34+
sitename = "PythonCall.jl",
35+
modules = [PythonCall],
2336
pages = [
2437
"Home" => "index.md",
2538
"getting-started.md",
26-
"pythonjl.md",
27-
"juliapy.md",
39+
"pythoncall.md",
40+
"juliacall.md",
2841
"conversion.md",
2942
"compat.md",
3043
"pycall.md",
3144
]
3245
)
3346

3447
deploydocs(
35-
repo = "github.com/cjdoris/Python.jl.git",
48+
repo = "github.com/cjdoris/PythonCall.jl.git",
3649
)

docs/src/compat.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Some of these are "fixes" that are silently applied for you, and some are just e
66

77
## Stdlib
88

9-
Whenever a Python exception is displayed by Julia, `sys.last_traceback` and friends are set. This allows the post-mortem debugger `pdb.pm()` to work. Disable by setting `Python.CONFIG.sysautolasttraceback = false`.
9+
Whenever a Python exception is displayed by Julia, `sys.last_traceback` and friends are set. This allows the post-mortem debugger `pdb.pm()` to work. Disable by setting `PythonCall.CONFIG.sysautolasttraceback = false`.
1010

1111
## Tabular data & Pandas
1212

@@ -26,7 +26,7 @@ pypandasdataframe
2626
pyplotshow
2727
```
2828

29-
If Julia is running an IJulia kernel, `pyplotshow()` is automatically called after executing a cell, so that plots generated in a cell are always shown (similar to IPython). It can be disabled by setting `Python.CONFIG.pyplotautoshow = false`.
29+
If Julia is running an IJulia kernel, `pyplotshow()` is automatically called after executing a cell, so that plots generated in a cell are always shown (similar to IPython). It can be disabled by setting `PythonCall.CONFIG.pyplotautoshow = false`.
3030

3131
## GUIs (including MatPlotLib)
3232

@@ -35,8 +35,8 @@ If Julia is running an IJulia kernel, `pyplotshow()` is automatically called aft
3535
If for example you wish to use PyPlot in interactive mode (`matplotlib.pyplot.ion()`) then activating the correct event loop will allow it to work.
3636

3737
```@docs
38-
Python.event_loop_on
39-
Python.event_loop_off
38+
PythonCall.event_loop_on
39+
PythonCall.event_loop_off
4040
```
4141

4242
### Interaction
@@ -50,7 +50,7 @@ pyinteract
5050
### Qt path fix
5151

5252
```@docs
53-
Python.fix_qt_plugin_path
53+
PythonCall.fix_qt_plugin_path
5454
```
5555

5656
## IPython

docs/src/conversion.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ The user can always explicitly choose a different conversion (e.g. by calling `p
2424
| Standard integer range (`AbstractRange{T}`, `T` a standard integer) | `range` |
2525
| `Date`, `Time`, `DateTime` (from `Dates`) | `date`, `time`, `datetime` (from `datetime`) |
2626
| `Second`, `Millisecond`, `Microsecond`, `Nanosecond` (from `Dates`) | `timedelta` (from `datetime`) |
27-
| `Number` | `juliaaa.NumberValue`, `juliaaa.ComplexValue`, etc. |
28-
| `AbstractArray` | `juliaaa.ArrayValue`, `juliaaa.VectorValue` |
29-
| `AbstractDict` | `juliaaa.DictValue` |
30-
| `AbstractSet` | `juliaaa.SetValue` |
31-
| `IO` | `juliaaa.BufferedIOValue` |
32-
| `Module` | `juliaaa.ModuleValue` |
33-
| `Type` | `juliaaa.TypeValue` |
34-
| Anything else | `juliaaa.AnyValue` |
27+
| `Number` | `juliacall.NumberValue`, `juliacall.ComplexValue`, etc. |
28+
| `AbstractArray` | `juliacall.ArrayValue`, `juliacall.VectorValue` |
29+
| `AbstractDict` | `juliacall.DictValue` |
30+
| `AbstractSet` | `juliacall.SetValue` |
31+
| `IO` | `juliacall.BufferedIOValue` |
32+
| `Module` | `juliacall.ModuleValue` |
33+
| `Type` | `juliacall.TypeValue` |
34+
| Anything else | `juliacall.AnyValue` |
3535

36-
The `juliaaa.*Value` types are all subtypes of `juliaaa.AnyValue`. They wrap a Julia value, providing access to Julia semantics: it can be called, indexed, and so on. Subtypes add additional Pythonic semantics. Read more [here](@ref julia-wrappers).
36+
The `juliacall.*Value` types are all subtypes of `juliacall.AnyValue`. They wrap a Julia value, providing access to Julia semantics: it can be called, indexed, and so on. Subtypes add additional Pythonic semantics. Read more [here](@ref julia-wrappers).
3737

38-
This conversion policy is defined/implemented by `Python.C.PyObject_From` and `Python.C.PyJuliaValue_From`. Package authors can (carefully) overload these with additional rules for custom types.
38+
This conversion policy is defined/implemented by `PythonCall.C.PyObject_From` and `PythonCall.C.PyJuliaValue_From`. Package authors can (carefully) overload these with additional rules for custom types.
3939

4040
## [Python to Julia](@id py2jl)
4141

@@ -54,7 +54,7 @@ The following table specifies the conversion rules in place. If the initial Pyth
5454
| From | To |
5555
| :----------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |
5656
| **Top priority (wrapped values).** | |
57-
| `juliaaa.AnyValue` | `Any` |
57+
| `juliacall.AnyValue` | `Any` |
5858
| **Very high priority (arrays).** | |
5959
| Objects satisfying the buffer or array interface (inc. `bytes`, `bytearray`, `array.array`, `numpy.ndarray`) | `PyArray` |
6060
| **High priority (canonical conversions).** | |
@@ -96,4 +96,4 @@ The following table specifies the conversion rules in place. If the initial Pyth
9696
| Objects satisfying the buffer interface | `PyBuffer` |
9797
| Anything | `PyRef` |
9898

99-
Package authors can (carefully) add extra rules by calling `Python.C.PyObject_TryConvert_AddRule` in `__init__`.
99+
Package authors can (carefully) add extra rules by calling `PythonCall.C.PyObject_TryConvert_AddRule` in `__init__`.

docs/src/getting-started.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,48 @@
22

33
## You will need
44

5-
* Julia 1.0 or higher.
6-
* Python 3.5 or higher.
5+
* Julia 1.0 or higher — download [here](https://julialang.org/downloads).
6+
* Python 3.5 or higher — download [here](https://www.python.org/downloads) or set `JULIA_PYTHONCALL_EXE=CONDA` (see below).
77

8-
## Install the Julia package
8+
## Install the Julia package `PythonCall`
99

1010
```julia
1111
using Pkg
12-
pkg"add Python"
12+
pkg"add PythonCall"
1313
```
1414

15-
## Install the Python package (optional)
15+
## Install the Python package `juliacall` (optional)
1616

1717
This step is only required if you wish to call Julia from Python.
1818

19-
Currently the Python package `juliaaa` is shipped with the source of the Julia package, and must be
19+
Currently `juliacall` is shipped with the source of the Julia package, and must be
2020
pip-installed manually. The following should work in most shells (including PowerShell):
2121

2222
```bash
23-
pip install --upgrade $(julia -e "using Python; print(dirname(dirname(pathof(Python))))")
23+
pip install $(julia -e "using PythonCall; print(PythonCall.juliacall_pipdir)")
2424
```
2525

26-
The package has no dependencies, so you can also just copy it to somewhere in your PYTHONPATH.
26+
Alternatively you can just copy the package (at `PythonCall.juliacall_dir`) to somewhere in your PYTHONPATH.
2727

28-
Note that this is a [very small](https://github.com/cjdoris/Python.jl/blob/master/juliaaa/__init__.py)
28+
Note that this is a [very small](https://github.com/cjdoris/PythonCall.jl/blob/master/juliacall/__init__.py)
2929
"bootstrap" package whose sole job is to locate and load Julia; the main functionality is in
30-
the main Julia package. Hence it is not necessary to upgrage `juliaaa` every time
31-
you upgrade `Python`.
30+
the main Julia package. Hence it is not necessary to upgrage `juliacall` every time
31+
you upgrade `PythonCall`.
3232

33-
Note also that regardless of installing `juliaaa`, a module called `juliaaa` will
34-
always be loaded into the interpreter by `Python`. This means that other Python
35-
packages can always `import juliaaa`.
33+
Note also that regardless of installing `juliacall`, a module called `juliacall` will
34+
always be loaded into the interpreter by `PythonCall`. This means that other Python
35+
packages can always `import juliacall`.
3636

3737
## Environment variables
3838

3939
If Julia and Python are in your PATH, then no further set-up is required.
4040
Otherwise, the following environment variables control how the package finds these.
41-
- `PYTHONJL_EXE`: Path to the Python executable. Or the special value `CONDA` which uses
41+
- `JULIA_PYTHONCALL_EXE`: Path to the Python executable. Or the special value `CONDA` which uses
4242
Python from the default conda environment, or `CONDA:{env}` to use the given environment.
43-
- `PYTHONJL_LIB`: Path to the Python library. Normally this is inferred from the Python
43+
In this case, if `conda` is not detected then `Conda.jl` will automatically install
44+
[`miniconda`](https://docs.conda.io/en/latest/miniconda.html) in your Julia depot.
45+
- `JULIA_PYTHONCALL_LIB`: Path to the Python library. Normally this is inferred from the Python
4446
executable, but can be over-ridden.
45-
- `JULIAPY_EXE`: Path to the Julia executable.
46-
- `JULIAPY_LIB`: Path to the Julia library. Normally this is inferred from the Julia
47+
- `PYTHON_JULIACALL_EXE`: Path to the Julia executable.
48+
- `PYTHON_JULIACALL_LIB`: Path to the Julia library. Normally this is inferred from the Julia
4749
executable, but can be over-ridden.

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Python.jl
1+
# PythonCall.jl
22

33
Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://julialang.org/) together in seamless harmony:
44
- Call Python code from Julia and Julia code from Python via a symmetric interface.
@@ -9,4 +9,4 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
99
- Beautiful stack-traces.
1010
- Works anywhere: tested on Windows, MacOS and Linux, 32- and 64-bit, Julia 1.0 upwards and Python 3.5 upwards.
1111

12-
This is actually two modules working in harmony: a Julia one called `Python` and a [tiny](https://github.com/cjdoris/Python.jl/blob/master/juliaaa/__init__.py) Python one called `juliaaa`.
12+
This is actually two modules working together: a Julia one called `PythonCall` and a [tiny](https://github.com/cjdoris/PythonCall.jl/blob/master/juliacall/__init__.py) Python one called `juliacall`.

0 commit comments

Comments
 (0)