eagleflo / mpyq

Python library for reading MPQ archives.
BSD 2-Clause "Simplified" License
99 stars 23 forks source link

Add __init__.py to make it a valid package #24

Closed ezcGman closed 10 years ago

ezcGman commented 11 years ago

I want to use mpyq as a (git) submodule in my project, but for this, it needs the init.py. Installing it via the setup.py is not my desired way, because for production use, it needs to be installed on all machines and if you release a new version, the update process is more complicated. If I add it as a submodule, I can easily pull your changes and push them live to the production servers. Would be nice if you could add this, so it's recognized as a python package.

GraylinKim commented 11 years ago

Why is setup.py installation insufficient?

If you add mpyq to your requirements.txt file you should be able to update production with:

$ cat requirements.txt
mpyq==0.2.2

$ pip install -r requirements.txt
...
eagleflo commented 11 years ago

mpyq.py is a valid module in itself. I do not think it should become a package, that is, a collection of modules.

The standard way to manage dependencies in Python is virtualenv, and installing mpyq within virtualenv is easy. Even if you were not using virtualenv, using a requirements file like @GraylinKim suggested is very much recommended. I'd look into fabric to automate updating your dependencies based on that file. If you're not willing to do that, adding pip install -r requirements.txt to git post receive hook should be enough to set you up for life. :)

Going through the git submodule route is something I wouldn't recommend. I could add a dummy init file into the repository and exclude it from the Python egg, but I wanted to suggest these other alternatives first.

GraylinKim commented 10 years ago

Closing this as a won't fix. See the above discussion for alternate installation strategies.

If you must install from source, I recommend cloning mypq separately and running setup.py from there:

$ git clone https://github.com/eagleflo/mpyq.git
$ cd mpyq
$ python setup.py develop

This will install mpyq into site packages as a pointer back to the source repository. Subsequent pulls on the repository will automatically update your installation.