https://github.com/barkure/juliabridge

一个用于与 Julia 进行通信的 Python 包。A Python package for communicating with Julia.

https://github.com/barkure/juliabridge

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords

julia python
Last synced: 6 months ago · JSON representation

Repository

一个用于与 Julia 进行通信的 Python 包。A Python package for communicating with Julia.

Basic Info
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
julia python
Created about 1 year ago · Last pushed 10 months ago
Metadata Files
Readme License

README.md

简体中文 English

JuliaBridge

A Python package for communication with Julia.

To enhance your two-step operation for using the JuliaBridge package, we can add more details and best practices to ensure a smooth experience. Here's an improved version of your instructions:

Installation

  1. Install the package: bash pip install juliabridge

  2. Install Julia (if not already installed):

    • Download and install Julia from https://julialang.org/downloads/.
    • Ensure Julia is added to your system's PATH so it can be accessed from the command line.
    • Add the JSON package to the global environment in Julia.

    bash julia -e using Pkg; Pkg.add("JSON")

  3. Install required Julia packages (optional): If your Julia code relies on specific packages, you can install them using the Julia package manager: bash julia -e 'using Pkg; Pkg.add("PackageName")'


Example Usage

  1. Basic usage: ```python from juliabridge import JuliaBridge

# Initialize the JuliaBridge instance jb = JuliaBridge()

# Evaluate a simple Julia command jb.eval('println("Hello from Julia")') ```

  1. Include Julia Scripts and Call Functions:

Save your Julia code in a file (e.g., script.jl) and run it from Python: ```python jb.include('script.jl')

# Suppose the script.jl file contains a function sayhello jb.sayhello("Julia")' # Call the say_hello function ```

  1. Passing data between Python and Julia:

Create a test.jl with the following code: julia function plus(a::Int, b::Int)::Int return a + b end

Use it in Python as follows: ```python julia.include("test.jl")

result = julia.plus(1, 1) print(result) # 2 ```

  1. More xamples:

Please check tests/.

Best Practices

  • Keep Julia sessions alive: If you plan to execute multiple commands, reuse the same JuliaBridge instance to avoid the overhead of starting a new Julia session each time.
  • Use jb.include for large scripts: For larger Julia scripts, save them in a .jl file and use jb.include to execute them.
  • Optimize Data Transfer: When large amounts of data need to be transferred to Julia, it is more efficient to save the data in formats such as JSON or binary files and then pass the file path to Julia for processing. This approach helps avoid the performance overhead of directly transferring data between Python and Julia.

Troubleshooting

  1. Julia not found:

    • Ensure Julia is installed and added to your system's PATH.
    • Verify by running julia in your terminal.
  2. Package installation issues:

    • If pip install juliabridge fails, ensure you have the latest version of pip:

    bash pip install --upgrade pip

  3. Performance issues:

    • For computationally intensive tasks, consider running them directly in Julia instead of passing data back and forth.

By following these steps and best practices, you can effectively use JuliaBridge to integrate Julia's capabilities into your Python workflow. Let me know if you need further assistance!

Owner

  • Name: barkure
  • Login: barkure
  • Kind: user
  • Location: China

GitHub Events

Total
  • Watch event: 5
  • Push event: 22
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 4
Last Year
  • Watch event: 5
  • Push event: 22
  • Pull request review event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 4

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 23
  • Total Committers: 2
  • Avg Commits per committer: 11.5
  • Development Distribution Score (DDS): 0.043
Past Year
  • Commits: 23
  • Committers: 2
  • Avg Commits per committer: 11.5
  • Development Distribution Score (DDS): 0.043
Top Committers
Name Email Commits
barkure 4****e 22
Pu Yang 1****1 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • Vcholerae1 (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 67 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
  • Total maintainers: 1
pypi.org: juliabridge

A Python package for communicating with Julia.

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 67 Last month
Rankings
Dependent packages count: 9.6%
Average: 31.8%
Dependent repos count: 53.9%
Maintainers (1)
Last synced: 7 months ago

Dependencies

pyproject.toml pypi
  • matplotlib >=3.10.0
  • numpy >=2.2.3
  • scipy >=1.15.2
uv.lock pypi
  • contourpy 1.3.1
  • cycler 0.12.1
  • fonttools 4.56.0
  • juliabridge 0.1.0
  • kiwisolver 1.4.8
  • matplotlib 3.10.0
  • numpy 2.2.3
  • packaging 24.2
  • pillow 11.1.0
  • pyparsing 3.2.1
  • python-dateutil 2.9.0.post0
  • scipy 1.15.2
  • six 1.17.0