How to use the julia.Main function in julia

To help you get started, we’ve selected a few julia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JuliaDiffEq / diffeqpy / diffeqpy / de.py View on Github external
import os
import sys

from julia import Main

script_dir = os.path.dirname(os.path.realpath(__file__))
Main.include(os.path.join(script_dir, "setup.jl"))

from julia import DifferentialEquations
sys.modules[__name__] = DifferentialEquations   # mutate myself
github oxfordcontrol / Bayesian-Optimization / methods / config.py View on Github external
from julia.api import Julia
jl = Julia(compiled_modules=False)
from julia import Main
cosmo_solver = Main.include("solver_explicit.jl")
github e2nIEE / pandapower / pandapower / opf / pm_conversion.py View on Github external
def _call_powermodels(buffer_file, julia_file):  # pragma: no cover
    # checks if julia works, otherwise raises an error
    try:
        import julia
        from julia import Main
    except ImportError:
        raise ImportError("Please install pyjulia to run pandapower with PowerModels.jl")
    try:
        j = julia.Julia()
    except:
        raise UserWarning(
            "Could not connect to julia, please check that Julia is installed and pyjulia is correctly configured")

    # import two julia scripts and runs powermodels julia_file
    Main.include(os.path.join(pp_dir, "opf", 'pp_2_pm.jl'))
    try:
        run_powermodels = Main.include(julia_file)
    except ImportError:
        raise UserWarning("File %s could not be imported" % julia_file)
    result_pm = run_powermodels(buffer_file)
    return result_pm
github e2nIEE / pandapower / pandapower / opf / pm_conversion.py View on Github external
# checks if julia works, otherwise raises an error
    try:
        import julia
        from julia import Main
    except ImportError:
        raise ImportError("Please install pyjulia to run pandapower with PowerModels.jl")
    try:
        j = julia.Julia()
    except:
        raise UserWarning(
            "Could not connect to julia, please check that Julia is installed and pyjulia is correctly configured")

    # import two julia scripts and runs powermodels julia_file
    Main.include(os.path.join(pp_dir, "opf", 'pp_2_pm.jl'))
    try:
        run_powermodels = Main.include(julia_file)
    except ImportError:
        raise UserWarning("File %s could not be imported" % julia_file)
    result_pm = run_powermodels(buffer_file)
    return result_pm
github JuliaPy / pyjulia / src / julia / core.py View on Github external
def __getattr__(self, name):
        from julia import Main

        warnings.warn(
            "Accessing `Julia().` to obtain Julia objects is"
            " deprecated.  Use `from julia import Main; Main.` or"
            " `jl = Julia(); jl.eval('')`.",
            FutureWarning,
        )
        try:
            return getattr(self.__julia, name)
        except AttributeError:
            return getattr(Main, name)