UltrosBot / Ultros

Connecting communities, one squid at a time! Ultros is a multi-protocol chat bot written in Python, designed with both the user and developer in mind
http://ultros.io
Artistic License 2.0
23 stars 7 forks source link

Setup script #12

Closed NotAFile closed 10 years ago

NotAFile commented 11 years ago

Old title: Bring along all the needed modules (or at least a list)

This is just a personal thing, but it's kind of annoying to download something and having to pip install a bunch of non stock modules, especially If the packages don't have the name they are imported by.

NotAFile commented 11 years ago

tools/setup.py

gdude2002 commented 11 years ago

The setup.py is old and needs updating. We're going to be writing a better one, because not everyone needs EG the Mumble protocol (which requires Google's protobuf), or SSL for IRC (Which requires PyOpenSSL).

We'll start working on that once the base app is working. If you feel like writing a start yourself, feel free to fork us and submit a pull request.

NotAFile commented 11 years ago

I've been thinking of helping out a bit anyway, I could work on it. What are you thinking of? Gui, cli? both? I feel like I need a bit more info before I can start with it :P

gdude2002 commented 11 years ago

Well, the main target right now would be Linux servers, however rakiru and I both develop on Windows, so it's pretty cross-platform. I'd think that a CLI setup script would be more suitable in that case, though I realize that there'll always be people running this thing from their home PCs as well. So, I dunno, really, but whatever we have will need to have some kind of CLI.

NotAFile commented 11 years ago

Ill get to work on it if Im sick of my other projects :) easy_install or pip? or something from within python?

gdude2002 commented 11 years ago

It'd have to be something from within Python, since people would be making choices on what modules they want to use, I think.

And, awesome. I look forward to seeing how you do.

gdude2002 commented 11 years ago

Any progress on this, good sir?

NotAFile commented 11 years ago

I rewrote the script entirely the other day, but I discussed with @rakiru, and he agreed that we would need a different approach. I talked about using pip, if available, or eggs. At the current state I don't know enough of your expectations for the script so I have stopped work on it

rakiru commented 11 years ago

I didn't realise you'd actually rewritten it already. Yeah, in my opinion, it'd be preferable to use pip, but using something else wouldn't be a major issue.

Something else I'll mention here is that some packages require extra setup, like the OpenSSL one, which on Windows requires making sure openssl.exe is available.

gdude2002 commented 11 years ago

If you take a look at the requirements page on the wiki, you can see that pip is actually not included with Python for Windows, so it might not actually be such a good idea.

NotAFile commented 11 years ago

a simple try: import pip should be good enough for pip. I would suppose catching errors is a secure way to check for openssl, but checking the folder could be better if the Exception does not send a proper error message

gdude2002 commented 11 years ago

Sure, we could catch that, but at the same time, it would still be nice to have an automated way to install pip on Windows. I quite wonder how setuptools manages that..

rakiru commented 11 years ago

Annoyingly, writing something to install pip automatically would require a fresh install. I might try it later in a VM so I can revert to a clean snapshot every time.

gdude2002 commented 11 years ago

Well if this only applies to windows, we can grab the msi and run it..

EDIT: The msi of setuptools, that is. And then easy_install pip.

NotAFile commented 11 years ago

yeah, that would work well

gdude2002 commented 11 years ago

Any progress on this, or are there questions that need answering?

NotAFile commented 11 years ago

No progress, I've been having a lot of stuff going on.

gdude2002 commented 11 years ago

That's okay.

I just realised we can use pip within code.. Since pip is installed by default on Linux/OSX and we recommend the installation of it for Windows, it seems reasonable to presume we can rely on that for the setup script, right? What do you think?

Info here: http://stackoverflow.com/questions/12332975/installing-python-module-within-code

NotAFile commented 11 years ago

yeah, thats what rakiru and me came up with, for linux at least. Ironically, pip is a nuisance to install on windows though, and having a installer for the installer does seem a bit OTT. I have a bit of experience with packaging, but I'm not sure .msi does what would be appropriate for this situation. tl;dr: I have no clue how it should be user-friendly on windows

gdude2002 commented 11 years ago

Well, we recommended that people install pip via setuptools: https://github.com/McBlockitHelpbot/Ultros/wiki/Requirements

rakiru commented 11 years ago

Edit: tl;dr, just add pip to the requirements.

In my opinion, everyone should have pip installed anyway. There's a bunch of other packages that need installed to use Ultros in the first place, so requiring the user to install pip so that we can simplify installing the rest, rather than requiring they install a bunch of other stuff manually. Plus, most people running the bot on windows are likely people writing plugins/modules for it, and every python dev should have pip installed anyway.

gdude2002 commented 11 years ago
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ [sudo] python get-pip.py

cough

rakiru commented 11 years ago

pip uses itself to install itself.

I think we have a winner.

rakiru commented 11 years ago

Hit the wrong button...

NotAFile commented 11 years ago

If we really wanted to make it simple we could try: import pip except ImportError: subprocess.call(command above)

gdude2002 commented 11 years ago

No, we can't do a subprocess call because it needs to be cross-platform. However Python has functions to run the contents of a file, and we can just download it with urllib.urlretrieve or something.

rakiru commented 10 years ago

Something I said in IRC at some point: If the package manager gains the ability to ensure currently installed packages have their dependencies met, then all the setup script would have to do is ensure the base packages and installed (twisted and, eh, anything else...?). Edit: And I suggest this added functionality for the package manager as it would greatly help when moving a bot between machines, such as moving to a new server.

gdude2002 commented 10 years ago

It already knows if stuff is installed already, man.

gdude2002 commented 10 years ago

Well the package manager is able to install pip now, so having it install the requirements.txt is definitely doable. I think this can probably be closed once that's done.