ODM2 / ODM2PythonAPI

A set of Python functions that provides data read/write access to an ODM2 database by leveraging SQLAlchemy.
http://odm2.github.io/ODM2PythonAPI/
BSD 3-Clause "New" or "Revised" License
4 stars 13 forks source link

Fix requirement file #20

Closed ocefpaf closed 8 years ago

ocefpaf commented 8 years ago

This PR will allow people to install the requirements with pip install -r requirements.txt as well as installing the source dist with pip.

I tried this and all seems to work:

mkvirtualenv TMP --python=/usr/bin/python2
python setup.py sdist
cd dist

pip install --process-dependency-links odm2api-0.1.tar.gz

Note that --process-dependency-links seems to be deprecated:

Dependency Links processing has been deprecated with an accelerated time schedule and
will be removed in pip 1.6.

Not sure how to solve that. I read a few threads that suggests this it won't be removed...

PS: Note that I am using the forked v0.7.3 tag for geoalchemy on both the requirements file and on setup.py. We can changed that to accept any future version, but I thought that this is "safer" for now.

emiliom commented 8 years ago

Thanks!! I'll test this.

emiliom commented 8 years ago

Referencing the previous PR where we've discussed this issue, issue #18.

ocefpaf commented 8 years ago

@emiliom Let me know if that works for you.

emiliom commented 8 years ago

Took me lots of iterations, but I finally understood your instructions well enough to run several types of tests.

The good news: I have a working configuration that I'm happy with! It involved one small tweak to your pull request, preceded by some reading on my part to understand the roles of requirements.txt vs setup.py (I'm a newbie at this). FYI, these two documents helped clear things up for me:

Armed with that understanding, a better understanding of what's going on with install_requires in setup.py, and a lot of previous tests, I tweaked requirements.txt to specify geoalchemy as the plain package name, not as a url to the tar.gz. Doing this enables what I really wanted to accomplish: the simplest possible pip install statement, ideally a single line, pointed at the github repo rather than having to download a dist first. That works now as:

pip install --process-dependency-links git+https://github.com/ODM2/ODM2PythonAPI.git

Note that all my testing has involved some "cheating", b/c I actually first create a conda env with all the dependencies that are available on conda channels (I created a conda requirements yaml file to make that even easier). Then I run the pip install statement. But in principle anyone should be able to run that pip install statement as is, w/o conda.

psycopg2 note: I'm leaving psycopg2 commented out in requirements.txt (and therefore not seen by setup.py either), per your comments. I can't say I've ever tried to install psycopg2 via pip install, and what I see on pypi suggests that it's pip installable only on windows. I'll let others deal with this later ;)

PS:

PS: Note that I am using the forked v0.7.3 tag for geoalchemy on both the requirements file and on setup.py. We can change that to accept any future version, but I thought that this is "safer" for now.

It's not a problem to stick with the v0.7.3 tag, b/c we have no intent of developing geoalchemy further (unless we discover important bugs ...).

Thank you @ocefpaf!!

ocefpaf commented 8 years ago

I tweaked requirements.txt to specify geoalchemy as the plain package name

That is OK, and it is close to what we had in my first PR where I specified the version number, but keep in mind that people trying to create envs with pip install -r requirements.txt won't get the right package!

emiliom commented 8 years ago

but keep in mind that people tried to create envs with pip install -r requirements.txt won't get the right package!

Noted, thanks.