-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
python3Packages.gradio: init at 3.20.1 #241558
Conversation
@ofborg build python3Packages.gradio |
@mweinelt the ci fails on aarch64-linux, the logs don't seem to say much. This could be due to a timeout. Is this of any concern to you ? |
@pbsds this looks good to me, do you intend to do any more work on this ? |
@pbsds I'm waiting for this to package FastChat, let me know if I can do anything to help. |
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.
The test phase of gradio looks annyoing to maintain.
@pbsds hey, it looks like you are a little busy, would you mind If I took over ? |
This looks good to me. |
# Add pytest hook skipping tests that access network, marking them as "Expected fail" (xfail) | ||
# We additionally xfail FileNotFoundError, as gradio often fail to upload test files to pypi. | ||
preCheck = let | ||
conftestSkipNetworkErrors = writeText "conftest-network-xfail.py" '' | ||
from _pytest.runner import pytest_runtest_makereport as orig_pytest_runtest_makereport | ||
import urllib, urllib3, httpx, requests, websockets | ||
|
||
class NixNetworkAccessDeniedError(BaseException): pass | ||
def deny_network_access(*a, **kw): | ||
raise NixNetworkAccessDeniedError | ||
|
||
def iterate_exc_chain(exc: Exception): | ||
yield exc | ||
if getattr(exc, "__context__", None) is not None: | ||
yield from iterate_exc_chain(exc.__context__) | ||
if getattr(exc, "__cause__", None) is not None: | ||
yield from iterate_exc_chain(exc.__cause__) | ||
|
||
httpx.Request = \ | ||
httpx.AsyncClient.get = \ | ||
httpx.AsyncClient.head = \ | ||
requests.head = \ | ||
requests.get = \ | ||
requests.post = \ | ||
urllib.request.urlopen = \ | ||
urllib.request.Request = \ | ||
urllib3.connection.HTTPSConnection._new_conn = \ | ||
websockets.connect = \ | ||
deny_network_access | ||
|
||
def pytest_runtest_makereport(item, call): | ||
tr = orig_pytest_runtest_makereport(item, call) | ||
if call.excinfo is not None: | ||
for exc in iterate_exc_chain(call.excinfo.value): | ||
if isinstance(exc, NixNetworkAccessDeniedError): | ||
tr.outcome, tr.wasxfail = 'skipped', "reason: Requires network access." | ||
if isinstance(exc, FileNotFoundError): | ||
tr.outcome, tr.wasxfail = 'skipped', "reason: Pypi dist bad." | ||
return tr | ||
''; | ||
in '' | ||
export HOME=$TMPDIR | ||
cat ${conftestSkipNetworkErrors} >> test/conftest.py | ||
''; |
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.
Is some of that upstreamable? Like a network
marker? As I mentioned, this looks annoying to maintain.
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.
IMO this is too related to nix to matter upstream.
How about we keep this as is, and if for some reason this doesn't work anymore, we just disable the tests until someone has time to look into this.
Since there are quite a lot of packages depending on gradio, would you rather
- disable the tests until we confirm with upstream if they are interested in this or not.
- leave this as is for now and disable the tests if there is a failure related to this.
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.
IMO this is too related to nix to matter upstream.
Having an extra marker to skip network tests is something not nix specific, many distros build their packages without networking. It can also be a great way to skip tests if no network is available or only very slow and flaky.
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.
In the prior pr I discussed generalizing this into a pytestCheckHook-esqe hook. The sentiment then was first pushing through this pr
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.
If the usecase comes up, we can always move the implementation into a hook but I am not fully convinced that this is necessary here.
What's the problem with upstreaming this and adding a marker to skip network tests? We just have a build environment without internet access but we would still like to run as many tests as possible.
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 don't trust the gradio devs, who tend to move fast and loose, to support this use case. My reason is that i did this pr, to fix the missing test files on pypi. They they promptly broke it again within a few weeks.
I have bumped the version of the prior gradio pr about 3 times over the past year, and each time the list of tests to disable needed change. This proved quite time consuming to maintain (hence that debug helper comment). Network and non-network tests are not grouped in any meaningful sense, so disabledTestPaths
proved too aggressive while disabledTests
proved too surgical and unmaintainable.
The conftest network xfail approach came upon me in a dream as an easily generalizable drop-in way to run as many tests as possible, without maintaining a disabledTests
list, nor relying on upstream devs to support us poor distro maintainers. It is my brain child and I will defend it with passion :P.
To argue in favor of generalizing this xfail approach and a future check hook, here is a very coarse estimate of the number of packages which disable network tests, and likely a lot more, with disableTestPaths
:
$ rg disabledTestPaths pkgs/development/python-modules/ -l | xargs rg network | wc -l
137
The conftest network xfail approach will for these likely improve testing coverage by a lot, and I believe such a hook will even remove a lot of doChecks = false;
found in throughout our python package set.
@mweinelt ready for another round of review. |
# makes pytest freeze 50% of the time | ||
"test/test_interfaces.py" | ||
]; | ||
#pytestFlagsArray = [ "-x" "-W" "ignore" ]; # uncomment for debugging help |
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.
Can't we enable this by default to better debug hydra builds immediately? Would that be to spammy?
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.
if we start getting failures on the package, I would say let's enable it. For now it's best to leave it disabled I think.
# Add pytest hook skipping tests that access network, marking them as "Expected fail" (xfail) | ||
# We additionally xfail FileNotFoundError, as gradio often fail to upload test files to pypi. | ||
preCheck = let | ||
conftestSkipNetworkErrors = writeText "conftest-network-xfail.py" '' | ||
from _pytest.runner import pytest_runtest_makereport as orig_pytest_runtest_makereport | ||
import urllib, urllib3, httpx, requests, websockets | ||
|
||
class NixNetworkAccessDeniedError(BaseException): pass | ||
def deny_network_access(*a, **kw): | ||
raise NixNetworkAccessDeniedError | ||
|
||
def iterate_exc_chain(exc: Exception): | ||
yield exc | ||
if getattr(exc, "__context__", None) is not None: | ||
yield from iterate_exc_chain(exc.__context__) | ||
if getattr(exc, "__cause__", None) is not None: | ||
yield from iterate_exc_chain(exc.__cause__) | ||
|
||
httpx.Request = \ | ||
httpx.AsyncClient.get = \ | ||
httpx.AsyncClient.head = \ | ||
requests.head = \ | ||
requests.get = \ | ||
requests.post = \ | ||
urllib.request.urlopen = \ | ||
urllib.request.Request = \ | ||
urllib3.connection.HTTPSConnection._new_conn = \ | ||
websockets.connect = \ | ||
deny_network_access | ||
|
||
def pytest_runtest_makereport(item, call): | ||
tr = orig_pytest_runtest_makereport(item, call) | ||
if call.excinfo is not None: | ||
for exc in iterate_exc_chain(call.excinfo.value): | ||
if isinstance(exc, NixNetworkAccessDeniedError): | ||
tr.outcome, tr.wasxfail = 'skipped', "reason: Requires network access." | ||
if isinstance(exc, FileNotFoundError): | ||
tr.outcome, tr.wasxfail = 'skipped', "reason: Pypi dist bad." | ||
return tr | ||
''; | ||
in '' | ||
export HOME=$TMPDIR | ||
cat ${conftestSkipNetworkErrors} >> test/conftest.py | ||
''; |
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.
IMO this is too related to nix to matter upstream.
Having an extra marker to skip network tests is something not nix specific, many distros build their packages without networking. It can also be a great way to skip tests if no network is available or only very slow and flaky.
@SuperSandro2000 I think I've addressed all of your comments, but let me know if there is something that you think should be addressed differently. I've also just tested to make sure this actually works. |
Are you sure the package even works if there are so many test failures? |
First step is merging i think. Trying to rebuild all staging everytime to test us just not very efficient. First we make sure nothing breaks, then we should be able toake changes that impact much less things. I have locally packaged fast chat, ill open a PR as soon as this hits master. |
You can just do |
12013e8
to
65a095c
Compare
I use this one-liner, which assumes this pr is checked out in the worktree
I'm surprised how nixpkgs-review does not have a cherry-pick or rebase strategy for staging PRs. (Mic92/nixpkgs-review#287) |
@Janik-Haag have your concerns been addressed ? Regarding my test failure, ive had other test failures on staging that couldbt be reproduced. I have had one on thrift, that was tested on another machine and couldnt be reproduced. So the one i had could be just a fluke. |
I currently am in a train so I have whonky internet, I'll try to check the package in the next ~8 hours once I have a stable connection again. But I really don't want to merge anything broken. |
At this point, i dont think this paclage is broken, i think there could be flakiness in the tests or some potential problems with downstream dependents, but am not sure how we much more we could test. Happy to wait one more day if you think we can potentially get more information. |
Co-authored-by: Yt <[email protected]>
linkify-it-py is on version 2.0.0, while markdown-it-py[linkify] depends on linkify-it-py~=1.0
I rebased onto the recent merge base between master and staging, and now it builds. So far I've waited one hour for the ofborg eval to be done. I'll marking the PR ready again once the eval is done, just for safety. |
@ofborg build python3Packages.gradio |
Ive built this on my machine and it worked like a charm this time. |
It now builds fine but when I try to run the binary it throws this error:
|
Co-authored-by: Yt <[email protected]>
Great catch! I fixed it, and also added a I hosted a gradio service last year, so it didn't strike me to check the shell entrypoint as I kept bumping the version of the prior PR. |
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.
LGTM now, sorry for all the trouble but I want to avoid merging broken stuff.
@Janik-Haag on the contrary, thank you for your thoroughness. @pbsds thanks for sticking with this PR for so long! |
Unfortunately, It doesn't look like I can build this on
My flake looks like this
|
I'm sorry to say that I'm unable to test on mac. The failure is expected
The error printout you provided cuts of too early, but hydra did get the same error. It fails to read this attribute, which makes no sense. It may be a circular import problem where Consider overriding the package with |
Description of changes
This PR adds gradio by @gradio-app, a web server framework for making AI (anything really) demos.
Original PR is #187032, which was closed due to a mass-ping resulting from a poorly thought out rebase onto staging.
Close #235184
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Pinging reviewers from prior pr:
@happysalada @Janik-Haag @VergeDX @SuperSandro2000