Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install SymbolicRegression directly from GitHub repo #107

Merged
merged 9 commits into from
Feb 13, 2022

Conversation

MilesCranmer
Copy link
Owner

This would finally eliminate #27, as PySR would install the backend directly from GitHub, rather than through the Julia registry. No need to wait for the registry to update.

@mkitti does this look like what you had in mind?

(note that I use the temp dir for other files, so create it manually, rather than using the temp argument to Pkg.)

url="https://github.com/MilesCranmer/SymbolicRegression.jl",
rev="v0.7.8",
)
Main.eval(f"Pkg.add(spec, {io_arg})")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This confuses me. What is this second io_arg argument?
https://pkgdocs.julialang.org/v1/api/#Pkg.add

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

@MilesCranmer MilesCranmer Feb 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add: the reason I have to do the Main.eval here is because the PyObject wrapper for IOStreams doesn't seem to pass correctly from Python. It's a bit ugly but works for now. The reason I pass the full io_arg instead of something like io={io} is because the IO redirection was only implemented in Julia 1.5+, so I set io_arg="" for earlier versions.

@mkitti
Copy link
Contributor

mkitti commented Feb 13, 2022

Next question: Why does this environment need to be temporary?

You could create one in the environments directory of the Julia depot. The short hand for this starts with an @. For example, @pysr.

Support for @ from the command line came with 1.7, but I think support within Pkg has been around for longer.

@MilesCranmer
Copy link
Owner Author

I did not know you could do that, thanks! I will switch to using that instead.

Any idea how to pass this to Pkg.activate as a variable? I see two different outputs currently.

with ]

(@v1.8) pkg> activate @pysr
  Activating new project at `~/.julia/environments/pysr`

and manual call:

julia> Pkg.activate("@pysr")
  Activating new project at `~/Documents/PySR/@pysr`

@MilesCranmer
Copy link
Owner Author

This seems like it shouldn't be the expected behavior so opened an issue on Pkg.jl: JuliaLang/Pkg.jl#2983

@MilesCranmer
Copy link
Owner Author

Nevermind, it's literally just Pkg.activate("pysr", shared = true)!

@MilesCranmer
Copy link
Owner Author

MilesCranmer commented Feb 13, 2022

Okay, the environment is now given by .julia/environments/pysr-{__version__}, rather than created as a temp directory. This is much cleaner in my opinion. Thanks for the idea @mkitti!

@mkitti
Copy link
Contributor

mkitti commented Feb 13, 2022

With the conda-forge version, .julia should be a folder located within the $CONDA_PREFIX.

@MilesCranmer
Copy link
Owner Author

Great!

I think the shared = true will automatically find that depot in conda. Let me check.

@mkitti
Copy link
Contributor

mkitti commented Feb 13, 2022

Yes, it should. We set it up for that purpose.

@MilesCranmer MilesCranmer merged commit 9aa85e5 into master Feb 13, 2022
@MilesCranmer MilesCranmer deleted the github-as-a-registry branch February 13, 2022 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants