Pkg 0.7.0 replacement for Pkg.status()


#1

Is there a map from the old Pkg.* functions to the new Pkg manager in 0.7.0? For example, how do I find out which Missings package I have installed?

advice appreciated.

/iaw


#2

]st


#4

ok, for the rest of us: on the REPL, “]” goes into the pkg browser, and “st” is short for “status.”

but how does my program check programmatically what, if any, version of, say, Missings is installed?


#5

What “being installed” means is not completely straightforward to answer. If you want to conditionally execute code based on the presence of a package, look at Revise.

But there will be some programmatic interface to status it just hasn’t been a top priority yet.


#6

thanks, k. this is painful.


#7

What is your usecase? Why does the package want to know if Missings is included?


#8

use case: make sure that my code–which was extensively tested with some package that someone else wrote–has not suffered a regression because of an update somewhere else. and/or be alerted to watch out for potential incompatibilities due to a package change when it happens.


#9

If you rely on something, shouldn’t you just specify it explicitly in the project file?


#10

That doesn’t answer why you have to test if Missings is installed at runtime.


#11

@kristoffer.carlsson:

I currently have code like this

if !isdir(Pkg.dir("Redpitaya"))
  println("Installing Redpitaya...")
  Pkg.clone("https://github.com/tknopp/Redpitaya.jl.git")
end

in order to install packages that are not in METADATA. For instance private packages do not work. The term !isdir(Pkg.dir("Redpitaya")) basically means what the OP asked for. Will I need this trick on 0.7, or can I directly specify dependencies in the new Manifest files (which are not(!) in a registry)

One other thing: The [ is a pretty bad choice for mac users. Here is my keyboard layout:
https://www.google.com/search?q=german+keyboard+mac&client=safari&rls=en&tbm=isch&source=iu&ictx=1&fir=9qRekpY1vPGD8M%3A%2CZnXjfJ5DODsicM%2C_&usg=__NPzM-E2PohzaLNL6_XoaiwLLwP8%3D&sa=X&ved=0ahUKEwjll_SimtrbAhUDCZoKHcQMCesQ9QEINTAE#imgrc=3MLg0QnteeVNGM:

We have ; for shell mode, ? for help mode, both can be invoked using shift. Would be great if also the package mode could be invoked by shift. For instance : could work.


#12

You won’t need it, as you can add unregistered packages.

First, it is ], not [. This is important since you don’t begin a line with ] in the REPL for valid expression.

Second, : may not be a good choice, since many valid expressions start with it.

Finally, the layouts you link seem to be the (more or less) standard German layout, which is not Apple-specific AFAIK. If you are using a layout other than something like QWERTY on a standard-size keyboard, you inevitable trade some symbols used in programming for the extra letters, it is hard to get around this.


#13

There are many points of pain when programming with an international keyboard but the single key press to enter a REPL mode is barely noticeable compared to the finger gymnastics of writing indexing-heavy code or complicated types. I’m not at all concerned about having to type Alt Gr + 9 to enter Pkg mode on my Swedish keyboard.


#14

I mean, you have to use ] all the time when doing normal programming so I don’t see how it can be that bad.


#15

Yes and this a constant headache when switching between a Mac and a “regular” keyboard. The point is that they are different on german Mac and a regular german keyboard. On a Mac its Alt Gr + 6.

When I look at the american layout it gets clear why you have chosen so.


#16

FWIW, the choice was made by someone (probably) with an American keyboard (aka not me). I have a swedish mac (åäö) so ] is Right Alt + 9 for me.


#17

Then your keyboard layout seems to not differ between mac and pc (at least for ()[]{} ) which of course makes it hard to see the issue. ) for package mode might be an alternative, which at least anybody has on its keyboard.


#18

what project file? I don’t write projects. I write code. I even do my unit tests at the end of each of my code.jl file.

maybe I will switch to projects in the future, but I don’t do it now. how to projects determine numbered dependencies? I mean both “==” and “>=”?

and Missings was just an example. it’s more general. Packages change, and it is not always the case that packages changes are not externally visible.


#19

Reading the documentation (which is WIP, but very informative already) may help at this point.

Julia has a lot of facilities for organizing your code, tests (with CI), and dependencies (Pkg). These are so easy to set up (after you do the first one) that they are worth using even for small and/or internal projects. Of course you are welcome not to take advantage of them, but then you are missing a lot of benefits. Also, doing the same thing in some ad-hoc manner may be just more difficult, as I am sure you have noticed in this topic.