-
Notifications
You must be signed in to change notification settings - Fork 158
Fix install from sdist and bdist_wheel #27
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
Conversation
setup_requires=['pyyaml'], | ||
install_requires=['pyyaml'], | ||
install_requires=[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz let me know if you feel strongly against this change since it'd potentially break if someone had UA_PARSER_YAML
set.
Personally, I'd rather catch the ImportError
, and message at that point.
40cebf2
to
de60ab9
Compare
I think this will fix #14 too. |
better bot detection
Fix install from sdist and bdist_wheel
Sorry for not merging this sooner - it sounds like you put in a lot of effort and it's green ;) |
@@ -38,11 +35,6 @@ def run(self): | |||
_sdist.run(self) | |||
|
|||
|
|||
class install(_install): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a late to the party, I know, but removing this essentially undoes #12, was there a particular reason for it being removed or can it be reinstated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is why I tried pinging you in #27 (comment)
So install
step shouldn't be doing this work. Install is what gets run over an sdist
bundle.
Stepping back, if we were to publish to pypi as we've been doing for years, we'd run setup.py sdist upload
, which will create the tar.gz
, and upload to pypi. Now, if we want to install, we can run pip install ./dist/whatever.tar.gz
to install directly from the tarball.
This effectively extracts the tarball, and runs setup.py install
. The problem is that we can't call install_regexes
at this point since it's not a source. install
already expects the artifacts to be bundled up from a previous run of sdist
.
I'm not convinced that we can actually support your use case without breaking the 90% use case of installing from pypi.
Unless we make install
fail gracefully. That way it would work if the artifacts exist, and noop, or run install_regexes
if they don't, for your case of trying to install directly from GitHub.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, this is only complicated because of these weird submodule dependency on uap-core
. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I saw your comment, I'm afraid I've only just picked it up, sorry about that.
I didn't realise that my PR broke the pypi packaging, so I can immediately understand why you removed it.
What you suggest does make sense :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll figure it out and send new PR to address the install
issue since I understand your use case now.
Though, frankly, I'd say that if you're installing from GitHub, should always use -e
IMO. ;)
But I'll see what I can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we're installing via a setup.py and dependency_links - I've not found a way of specifying the equivalent of -e
in that situation.
i.e.
<snip>
dependency_links=['git+https://github.com/crbunney/uap-python.git@fix_pip_install_from_source#egg=ua-parser-0.4.0'], # Run pip install with --process-dependency-links flag to use dependency_links
install_requires=['ua-parser==0.4.0'],
<snip>
because we wanted to use some code that wasn't yet on pypi.
Hence the unusual use case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, alright. I'll take that into account when I poke at this and see what I can come up with.
Thanks for the info.
Oh, if I should not have merged this it's my fault. @mattrobenolt Can you make a rollback PR or otherwise address @crbunney's comments? I'm really just an admin and not really opinionated about the development of uap-python at this point. If either of you wants to get more involved and review PR's, wrangle about overall design etc.. please let me know! |
@elsigh Comments addressed. As I mentioned, this does directly conflict, but IMO, #12 is more of a breaking change since it breaks any possibility of pushing a new release to pypi. I think there's a way we can solve both, which is addressed in #27 (comment) But I haven't explored since I didn't think of that use case when I put up this PR, nor did I see his attempt to fix. I just noticed that it was broken on HEAD. |
Embarrassingly, I didn't realise there was a problem with it until I read your comment above. EDIT: Turns out I didn't read the original description closely enough, because you explained it plainly there as well
In truth, now that @mattrobenolt has pointed it out, it's my pr (#12) that is the problem not this one. #27 has simply fixed what I inadvertently broke |
Ok, so this one fixes up lots of things. (not sure how this was working before tbh)
python setup.py install
didn't work on onsdist
artifact because it was attempting to runinstall_regexes
which don't exist. They're expected to already be in the bundled artifact. This would affect installingua-parser
from PyPI for example sinceinstall
gets run duringpip install
.sdist
run, we don't need theyaml
file anymore, since we have "compiled" into a json file. Meaning, we can leave theyaml
file behind, and only package up thejson
file. This also means that we can removepyyaml
as a runtime dependency, and only keep it as a setup dependency.bdist_wheel
.So here's the blobs of data that I tested with:
Output from compiling the sdist and wheel:
Our dist output has both the
tar.gz
andwhl
files.Listing contents of sdist shows the
regexes.json
packaged inside:And also exists inside the
whl
.Now, if we take the
dist/
folder, we can install the files individually withpip
without any issues. alapip install dist/ua-parser-0.5.0.tar.gz
orpip install dist/ua_parser-0.5.0-py2.py3-none-any.whl