Latte, a package manager for StaSh
Want to make your own third-party StaSh commands? Look to Latte to help! It's a package manager and repository system for all things StaSh. If you want to make a new command that automatically cleans your Pythonista sandbox, make a package, send a pull request to https://github.com/Seanld/Latte, and your program/command will be available to all the StaSh users who also have Latte installed on their StaSh. Great, right? Now there is an
apt-getfor the StaSh shell!
To download the newest version of Latte, you just have to run this line of code in your Pythonista line-interpreter (the popover on the right), and you will see download progress text begin to appear, and it will tell you when it's finished. You don't need to reboot Pythonista or StaSh, the changes are dynamic.
import requests as r; exec(r.get("https://raw.githubusercontent.com/Seanld/Latte/master/installer.py").text);
To install the test package
abc123from the default repository, for example, you simply run
latte install abc123. Boom, now you can run
abc123 helloworldin StaSh, and your new package has just echoed back "helloworld" to you! Not very useful, but I'm sure you can come up with your own commands that would help a lot more.
@AtomBombed , sorry i dont really know what you mean. But I am interested to find out. So in my mind a package is a number of pip install cmds and placing it in your dir of choice. Maybe there are some other things like update etc....Really, I am not sure I am just guessing. Is this suppose to work like env for your 3rd party Libs. So in your code you would have to make sure your imports are pointed correctly into your dir.
Sorry for the questions, i am just trying to get my head around it
These things never seem to really catch on, in large part because not many people are developing specifically for pythonista, and in part because of the tricky bit of the need for either a convienent central repository (who will keep up maintenance) or some sort of distributed list (discovery might be tricky).
ywangd's pythonista tools installer makes use of the existing script index, which is nice and lightweight.
@Phuket2 @JonB my plan is just to make it a package manager. You can connect it to various "supported" repository models. The package design is going to be different (for example, packages will have a manifest-type file for metadata, along with other stuff), but you can change Latte to point to those other supported repositories. Right now, the only one that is going to support it is my repo on GItHub, inside of
public-packages. But once people catch on, maybe the packages and repositories will too, and then there will be multiple sources people can use in the future.
Much like how you can add repositories other than the multiverse to
apt-get. It's basically a version of things like
My sense is that going into StaSH and running
pipconnects to the right multiverse of Python packages. There are now more than 100,000 packages in PyPI and I doubt that another multiverse will be better in the near term. I think that something that would help would be a repo that lists the known good packages for Pythonista. That way folks can stop trying to install packages that are known not to work.
Given that pip in StaSH supports most of the useful commands of pip, perhaps it would help if you could write how each latte command would differ from the similar StaSH pip command and also what new commands latte would have that are not in pip... I love the
brew home ___and
brew edit ___commands.
@ccc yes. I agree. My aim isn't to remake
pip. It is a repository for StaSh commands, essentially. If you want to make your own third-party StaSh command that doesn't come pre-installed with StaSh (such as
echo), then you can make one as a package, send a pull request to my repository, it will then be reviewed, and then added (if it makes it past reviews). This is just a simple StaSh program manager.
Most people, when they create a useful stash command, issue a pull request against stash dev and it becomes part of stash. I guess I could see some use cases for standalone stash commands.
Though you are better off maintaining a list of repos/urls, rather than trying to
serve up .tar.gz directly (updates should come directly from a users github, and not rely on a pull request into yours)
Is there any significance behind the name? If this is indended to work like apt-get, or brew, etc, call it that or at least something descriptive (pkg-get?) and try to match the semantics, rather than something ambiguous and new. Imagine if instead of
ls, in stash it was called
santa, it would be confusing.
@JonB that's true. I'm trying to match the semantics, I just wanted a special name for it. It's kind of like a
brewfor StaSh. That's the reason for the name. I didn't want to do something like
pkg-getmainly because it's too general. Idk. Maybe I should do it, but I feel like it means more if it has a cooler name. Plus, for example, if I made it compatible with all other repositories of Pythonista programs, they wouldn't be able to be run as a StaSh command.
Imagine I ran
latte install abc123(the test package on the repository right now). Then it would be put into the
stash_extensions/binfolder. But it can only be run as a command if it's specifically formatted for it. Well, it could be run, but it wouldn't utilize the command line argument/option system if it wasn't specifically written for it. For example, if I connected Latte to install programs from Pythonista-Tools, the programs would only be static programs. They wouldn't change based on argument input. That's the whole point. So it's kind of hard to make it compatible with other pre-established programs.