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

auto-installation #5

Closed
stevengj opened this issue May 16, 2016 · 4 comments
Closed

auto-installation #5

stevengj opened this issue May 16, 2016 · 4 comments

Comments

@stevengj
Copy link

stevengj commented May 16, 2016

You should probably be doing something like pyimport_conda("sgp4", "sgp4") in your __init__ function to auto-install the SGP4 package via Conda if possible. (Requires PyCall 1.5.)

Though it looks like sgp4 is only available in a custom Conda channel. To make this possible, I'll add a third argument to pyimport_conda in PyCall 1.6 so that you can do pyimport_conda("sgp4", "sgp4", "poliastro") to use the poliastro channel.

@stevengj
Copy link
Author

Okay, PyCall 1.6 should be tagged shortly, and then you can automate installation via pyimport_conda("sgp4", "sgp4", "poliastro")

@crbinz
Copy link
Owner

crbinz commented Oct 23, 2016

Finally got around to this -- that was easy! Thanks.

@crbinz crbinz closed this as completed Oct 23, 2016
@stevengj
Copy link
Author

stevengj commented Nov 1, 2016

I would recommend something like what the PyCall README says:

const sgp4io = PyNULL()
const earth_gravity = PyNULL()
function __init__()
    copy!(sgp4io, pyimport_conda("sgp4.io", "sgp4", "poliastro"))
    copy!(earth_gravity, pyimport("sgp4.earth_gravity"))
end

and then you can do e.g. twoline2rv(args...) = sgp4io["twoline2rv"](args...) and GravityModel(ref::AbstractString) = earth_gravity["ref"].

This is more type-stable and should also be faster because you don't need to have pywrap convert every single object defined in the module.

Note also that pyimport_conda already gives a useful error message, so you don't need your own.

@crbinz
Copy link
Owner

crbinz commented Nov 2, 2016

Awesome, thanks for the tips.

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

No branches or pull requests

2 participants