https://github.com/barkure/juliabridge
一个用于与 Julia 进行通信的 Python 包。A Python package for communicating with Julia.
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
Repository
一个用于与 Julia 进行通信的 Python 包。A Python package for communicating with Julia.
Basic Info
- Host: GitHub
- Owner: barkure
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://pypi.org/project/juliabridge
- Size: 1.83 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
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
Install the package:
bash pip install juliabridgeInstall 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")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
- Basic usage: ```python from juliabridge import JuliaBridge
# Initialize the JuliaBridge instance jb = JuliaBridge()
# Evaluate a simple Julia command jb.eval('println("Hello from Julia")') ```
- 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 ```
- 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 ```
- More xamples:
Please check tests/.
Best Practices
- Keep Julia sessions alive: If you plan to execute multiple commands, reuse the same
JuliaBridgeinstance to avoid the overhead of starting a new Julia session each time. - Use
jb.includefor large scripts: For larger Julia scripts, save them in a.jlfile and usejb.includeto 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
Julia not found:
- Ensure Julia is installed and added to your system's PATH.
- Verify by running
juliain your terminal.
Package installation issues:
- If
pip install juliabridgefails, ensure you have the latest version ofpip:
bash pip install --upgrade pip- If
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
- Website: https://barku.re
- Repositories: 1
- Profile: https://github.com/barkure
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
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.
- Homepage: https://github.com/barkure/JuliaBridge
- Documentation: https://juliabridge.readthedocs.io/
- License: MIT License
-
Latest release: 0.2.1
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- matplotlib >=3.10.0
- numpy >=2.2.3
- scipy >=1.15.2
- 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