Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using distro in setup.py #132

Closed
AbdealiLoKo opened this issue Jun 8, 2016 · 10 comments
Closed

Using distro in setup.py #132

AbdealiLoKo opened this issue Jun 8, 2016 · 10 comments

Comments

@AbdealiLoKo
Copy link

AbdealiLoKo commented Jun 8, 2016

Hi, I want to use distro to choose what to do in setup.py. I was wondering if there's some recommended way of doing this ?

The ideas we've thought of:

  • Using setup_requires, We're not sure this is a good method of doing it - There have been quite a few bugs with it (On windows, old versions of pip, etc.)
  • There was a suggestion of directly downloading https://github.com/nir0s/distro/blob/master/distro.py and importing that using urllib.

I wanted to ensure that I use the recommended way so that the app doesn't break later.

@AbdealiLoKo
Copy link
Author

Bump, would love some input on this ?

@nir0s
Copy link
Collaborator

nir0s commented Jun 25, 2016

So, I haven't heard of someone using distro in setup.py yet so it's hard for me to tell you what's the "recommended" way of doing that. setup_requires sounds like a good idea though I'm not familiar with its windows breakages.

If you know you have pip in your environment, you can call subprocess to install distro via pip (I wouldn't use pip directly from Python as its API is not official - thus the subprocess method) and then import it. somewhat hacky, but will work cross platform and should never break.

@AbdealiLoKo
Copy link
Author

Nod, I found https://bitbucket.org/dholth/setup-requires which was mentioned in pypa/pip#1820 which describes that rather than using setup_requires a subprocess invoking pip may be the best bet for reliability.

@nir0s
Copy link
Collaborator

nir0s commented Jun 28, 2016

I would appreciate a PR for the docs stating that as a use case and how you solved it eventually.

@AbdealiLoKo
Copy link
Author

@nir0s Agree, I'll do that after I have sufficiently tested the method I'm using right now.
I also noticed that there's an issue in pip and pip may soon depend on distro ... pypa/pip#3823

So, in that case maybe we wouldn't even need that extra documentation as distro would be available due to pip itself ?

@andy-maier
Copy link
Collaborator

If pip is ready to integrate distro (as indicated in pypa/pip#3823), then I think we should release distro 1.0.0, to make it clear that the API is stable from now on (at least within 1.x.x).

@nir0s
Copy link
Collaborator

nir0s commented Jul 23, 2016

Sounds reasonable to me.

@nir0s
Copy link
Collaborator

nir0s commented Aug 15, 2016

@andy-maier , pip already merged 0.6.0. I guess we should still release 1.0.0 after we add the CLI. Does that make sense?

@nir0s
Copy link
Collaborator

nir0s commented Sep 27, 2016

@AbdealiJK, any updates on this? Interested in submitting that PR or can I close this?

@AbdealiLoKo
Copy link
Author

I'm a bit busy right now, so no PR at the moment.

To give a brief idea for others who have the same issue, I had to call pip install using subprocess to install the package to the current directory - https://github.com/pywikibot-catfiles/file-metadata/blob/master/setupdeps.py#L49
This seems to work fine (although pip install is called twice)

There seems to be no elegant solution at this time that I was able to use without problems.

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

No branches or pull requests

3 participants