Advanced shell - shellista
@transistor1 Nice additions to shellista. I went with a more modular approach to shellista to make it easier to add new features. I'll need to take a look at your git functionality. I added ssh to mine so I could git from my work computer. Would You mind if I added your git as a module to ShellistaExt?
@Rothrock42 - Pasting is probably the quickest way to get started. I have a "shellista" subfolder & I am keeping everything in there.
If you are using <a href='https://github.com/transistor1/shellista'>this version</a>, you can stay synced with this repo using
This assumes you're storing shellista in a subfolder of your home folder called "shellista".
- Launch your existing shellista version
mkdir update(you can call this folder anything you want)
git clone https://github.com/transistor1/shellista.git
mv update shellista
- Close Pythonista and reload
- Open shellista and run it. It will re-download all the dependencies.
Time willing, I'd like to add a
git pullcommand to pull the latest updates.
@transistor1 I edited my above post just as you posted. Would you mind if I used your code for a git plugin?
@briarfox - please be my guest ... all of this code is under the MIT license so it's all fair game! The modular approach sounds like a great idea! I was trying to maintain the original single-file approach to make it easy to paste into Pythonista-- but I thought about making it more modular too, because it's getting big.
My mods to shellista download the Git/pipista dependencies automatically using @mark_tully's wget... I thought that a modular approach might work well if it automatically downloaded its plugins too. Does your version do that? That would be awesome.
@briarfox - I like your version a lot! If I had seen this a couple of days earlier I would have written my add-ins for your version. If the core module had a way of downloading the plugins, that would be ideal for new users -- they could just paste the core file into Pythonista and then it would bootstrap the plugins.
@transistor1 Thanks! I just broke up the cmd into separate files that automatically load into shellista, it uses a very simple template. Most of ShellistaExt is the original code just broken apart. To get by the issue of the initial load into pythonista, just create a single script that grabs the zip from the github and loads it. Take a look at the setup of shellistaExt and let me know what you think. If you'd like to move to a plugin approach I'd be more then happy to contribute. I was finding that I was adding a lot of personal projects into shellista to make it easier to access and being able to just drop in a plugin or even a whole projects like pipista was handy.
Currently the plugins do not auto update but thats a great idea. I'm still working on sftp and ssh auth keys instead of just password. I'm really curious how you got the git working. I tried for a bit and gave up and just wrote the ssh client to access another computer that syncs to dropbox.
I think the modular approach is the way to go -- I would be grateful for contributions... after seeing what you've done, I think you should really have the 'official' github repo of Shellista. If that doesn't work out, I've added you as a collaborator to my repo, so have at it!
My only desire would be to add that script that grabs the zip directly into the ShellExt.py file... I know it probably uglifies things a bit, but it would be important for a nice user experience for people new to Shellista/Pythonista. I just got Pythonista a few days ago, and I think I might have been scratching my head a bit wondering how to get all those files in there without Git built in... the original Shellista was a simple copy-paste job (you are right-- it's a simple script, but I'm a little absent minded-- that probably wouldn't have been my first thought! :) )
I found a pure Python implementation of Git called <a href='http://www.samba.org/~jelmer/dulwich/docs/'>Dulwich</a>. There is also a wrapper to that called <a href='https://pypi.python.org/pypi/gittle/0.3.0'>Gittle</a>... I used both of them. Everything except the
git pushwas very simple. With that, I was having all sorts of issues with the authentication. I believe this is because of versioning of Gittle/Dulwich... they seem to be out of sync. I was not able to pair the correct versions, so I ended up writing a monkeypatch for Gittle's push_to() method, which worked in the end. Not ideal at all, but it practically speaking, it works for now.
@transistor1 I got a plugin working for your git, really nice job! I also really like your download setup to import the modules. Very nice. I'd suggest that the downloaded modules be placed into the site-packages folder. I'm new to this whole git thing so I'd rather just contribute what i can to yours. I'm also very noobish when it comes to python.
How do you feel about the modular method I used? If you think another path would be better go with that. Let me know how I can help out. In the mean time I'll keep working on the ssh plugin.
@briarfox - thanks! I think your modular method is brilliant, and your code and directory structure is very clean. It is implemented just like a "real" shell, in that commands are individual programs - that's how it should be IMHO. I really feel like the way you implemented it is the smart way to go. If you really want to contribute to my repo, create a branch, and make it more like that :).
What I envisioned was somehow taking advantage of the already existing functionality in setuptools to download the plugins and modules -- not sure if this is possible or not. I was going to fork your repo and play around with that when I had a chance. Python isn't my primary language (we are all Microsoft at work), so I'm sure I don't do things the most "Pythonic" way. Suggestions are most definitely welcome.
Regarding installation in site-packages: what do you think the policy should be if the user has that package already in their site-packages? I'm a little worried about overwriting a user's own modules. I keep shellista in a separate subfolder of
~, so that all the dependencies download there; almost like a hackish virtualenv.
@transistor yes I'm (now) using the one from your Git. It is brilliant. Thank you so much. I will give your instructions a go.
BTW here is something stupid I did. I was running shellista -- moving, copying, etc. Then I used pythonista's built in "delete this folder" for a directory that was my current directory in shellista. When I came back to shellista it freaked out (I know, very technical term there) and I basically had to restart pythonista
I don't know if there is a way to fix that/gracefully recover or if it would even be worth it -- probably not a highly likely error and those who do something so silly probably "deserve it." But just thought I'd bring it up.
Transistor.. Your python shell works running files, but you just can't run scenes. Scenes don't execute until after the main script stops running. clock.py is a scene module.
A quick test shows that you can apparently run modules with ui, which opens up lots of possibilities!
@Rothrock42 - You are welcome! I'm really glad it's helpful.
When I tried your scenario, I got a "no such file or directory" error. Is that what you got?
Opened a ticket <a href='https://github.com/transistor1/shellista/issues/9'>here</a>. Will try to take a look at this later tonight (Eastern Standard time)... Right now I am slacking on other things I'm supposed to be doing!
@JonB - that is good to know, thanks!
@transistor1 My thought with using the site-packages for the pypi packages was to allow the user to setup Shellista wherever they like and still have access to the pypi packages in all thier apps. If the module/package already exists we'll try using the one that already there? As for any downloaded code, Id say stick with your download into the shellista folder. I'm working on an easy way to include downloads into the plugins. And have the main shellista use your downloading method on plugin load.
I added you as a collaborator to ShellistaExt. I'll follow your lead on whichever github you want to use as the official Shellista. We could modularize yours and use it or build yours into ShellistaExt. Let me know what you would prefer.
I think Shellista is a must have for pythonista and a easy to empliment plugin system would greatly help on expansion of it.
I added tab completion to transistors repo.
The approach I used was to check for tab at end of line. (Actually, 4 spaces, as tab button produces 4spaces in console, not tabs!). You'd start typing, press tab, then press enter. Ui pops up if needed, you select option, but then since we can't update the console input text, I just print the completion, and you continue entering the line.
Press enter again to execute, or tab-tab-enter to delete the last argument from the working line.
I tried using shellista to clone the latest shellista with the command:
git clone https://github.com/transistor1/shellista.git
I get "No module named config". Is this a known bug or is there more to getting this from the repository?
Try restarting pythonista ... I seem to remember that previously, it would happen during first download, or perhaps if dulwich did not get installed, but it thought it was installed.
Try deleting your dulwich and gittle folders, especially if you had an older version of shellista.
Then, just do copy paste of shellista from github (go to raw) into a new script, maybe in a separate folder, and run it.
Hey there. A new idea for shellista.
You could add a folder ~/bin, where executable programs will be stored (actually python files), so users can add their own commands/programms there.
See the dev-modular branch which has a plugin system.
@pudquick51 This is annoying me extremely as I haven't found an example etc of this. could you please send an example on how to operate this file with a correct directory etc as when I try to use it, it can never find files which exist.
To list a directory, use