Skip to content

Make installable with pip - #9

Closed
macro1 wants to merge 3 commits into
jeffkaufman:masterfrom
macro1:package
Closed

Make installable with pip#9
macro1 wants to merge 3 commits into
jeffkaufman:masterfrom
macro1:package

Conversation

@macro1

@macro1 macro1 commented Dec 8, 2014

Copy link
Copy Markdown

This will at least make the project installable with pip. Maybe it will facilitate getting it hosted on PyPI.

Once merged you could install directly from github with:

pip install git+git://github.com/jeffkaufman/icdiff.git@master

Since the changes are already hosted on github, you could try it out by installing from my branch like this:

pip install git+git://github.com/macro1/icdiff.git@package

If you've installed it, and want to try installing again, you can pip uninstall icdiff before rerunning the install command.

@jeffkaufman

Copy link
Copy Markdown
Owner

Thanks! This is great!

Testing it, one question is how to deal with __version__. I'd still like to support installing with:

curl -s https://raw.githubusercontent.com/jeffkaufman/icdiff/master/icdiff \
  | sudo tee /usr/local/bin/icdiff > /dev/null \
  && sudo chmod ugo+rx /usr/local/bin/icdiff

And with this change that will still work but it will report the version as "(local)". Is it possible to store the current version in icdiff and have setup.py extract it? If not we could just duplicate the version number, though with having it twice it could get out of sync.

@fearphage

Copy link
Copy Markdown

Separate VERSION file?

echo '1.1.0' > VERSION

setup.py:

version=open('VERSION').read().strip()

That gets you one place to edit it for sure. I'm not sure if that's the best solution. I'm just throwing that out there.

It's possible for python to read the version from the icdiff file, but that could be a little ugly.

@svetlyak40wt

Copy link
Copy Markdown

How about keeping version number and all history in a ChangeLog?

On 08 äåê. 2014 ã., at 21:12, Phred notifications@github.com wrote:

Separate VERSION file?

echo '1.1.0' > VERSION
setup.py:

version=open('VERSION').read().strip()
That gets you one place to edit it for sure. I'm not sure if that's the best solution. I'm just throwing that out there.

It's possible for python to read the version from the icdiff file, but that could be a little ugly.


Reply to this email directly or view it on GitHub.

@jeffkaufman

Copy link
Copy Markdown
Owner

@fearphage A separate VERSION file doesn't combine well with offering a "download this one file and put it on your path" installation option.

@svetlyak40wt Lots of people will use icdiff without having a git checkout, and I'd like people to be able to see what version they're running. (To debug problems, among other things.)

@svetlyak40wt

Copy link
Copy Markdown

Then the only option is to put __version__ = '0.1.0' somewhere in the icdiff and make setup.py use it.

@svetlyak40wt

Copy link
Copy Markdown

But anyway, making a changelog is a good idea. That way people will be able to track what happening with the project.

@jeffkaufman

Copy link
Copy Markdown
Owner

Yes, I think __version__ going in icdiff and setup.py reading it out would be best. What's the best way to do that in setup.py?

Separately, making a ChangeLog file sounds good. I'll do that.

@jeffkaufman

Copy link
Copy Markdown
Owner

Added changelog.

@svetlyak40wt

Copy link
Copy Markdown

As icdiff isn't importable, I think the best way would be something like:

vars = {}
execfile('icdiff', vars, vars)
setup(name='icdiff',
          version=vars['__version__']
          ...)

@macro1

macro1 commented Dec 8, 2014

Copy link
Copy Markdown
Author

I looked at setuptools and they seemed to have a solution that looked like it would work. I moved the version into icdiff and added code to setup.py to retrieve the value.

@svetlyak40wt

Copy link
Copy Markdown

@macro1 I dont see where setuptools helps you to extract version from the file. And whouldn't it be simple to use execfile instead of with…open…read…exec?

@macro1

macro1 commented Dec 8, 2014

Copy link
Copy Markdown
Author

@svetlyak40wt, sorry, it didn't provide anything. I read their source and borrowed:
https://bitbucket.org/pypa/setuptools/src/4986103d77c7c21dce5a3f9bcf64fba3b9433c28/setup.py?at=default#cl-23

The idea is you want to make sure setup.py reads from the local file. Even if icdiff was importable, you wouldn't want to import it directly.

@jeffkaufman

Copy link
Copy Markdown
Owner

Merged as 5af6255

@jeffkaufman jeffkaufman closed this Dec 9, 2014
@macro1

macro1 commented Dec 9, 2014

Copy link
Copy Markdown
Author

As pointed out by @virtuald, that commit actually removes the contents of icdiff.

@jeffkaufman I can squash and rebase this branch if needed.

@jeffkaufman

Copy link
Copy Markdown
Owner

#$%@ it. Fixed with 365dfef.

Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants