-
-
Notifications
You must be signed in to change notification settings - Fork 141
Fix CI for Windows #242
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
Fix CI for Windows #242
Conversation
I was going to merge this since green. Fix looks fine, although the source'ing is annoying. but maybe necessary. Could you instead call I didn't merge because looks like you accidentally got some pyi changes in that aren't needed. |
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
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 this key correct, the CI says it is venv-Linux--
?
This caches the (large) venv but I think it does not cache poetry.lock.
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 picked this up from https://github.com/snok/install-poetry#running-on-windows
There are comments there that say that caching doesn't work on Windows.
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.
does the file poetry.lock exist on the CI? The previous caching used pyproject.toml as the key to cache poety.lock
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.
Don't know. After spending hours on this last night, I was just happy to get it working.
@@ -1,6 +1,7 @@ | |||
[tool.poetry] | |||
name = "pandas-stubs" | |||
version = "1.4.3.220829" | |||
# Use the big version number so in CI, it will use the built wheel | |||
version = "1.4.3.999999" |
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.
Why is that needed? To invalidate the cache?
This should already pick the newest wheel:
pandas-stubs/scripts/test/run.py
Line 49 in 5b70b46
path = sorted(Path("dist/").glob("pandas_stubs-*.whl"))[-1] |
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 problem here is that if I build and install the wheel from the run script, it gets installed into the wrong python environment. So now with test.yaml
doing a direct build of the wheel and installation, I have to force it to install the newly built wheel, which requires a higher version number than what is available on pypi.
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.
which requires a higher version number than what is available on pypi.
So pip is preferring the pypi.org wheel over the local wheel? There must be an option to ignore the remote wheel.
Could also simply bump the version number after each release so that the CI works but as soon as we forget it pip will install the wrong pandas-stubs - seems a bit fragile.
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.
Issue here is that we need this to work for PR's, which means that contributors have to change the version number.
In the test.yaml
, I am now doing this:
python -m pip install --find-links=./dist --force-reinstall pandas-stubs
The --find-links=./dist
makes it so that pip will look in the dist
directory. On Windows, you can't do pip install dist/*
, so this is the workaround for that.
|
||
- if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' | ||
uses: pre-commit/[email protected] | ||
|
||
- name: Install pandas-stubs and run tests on the installed stubs | ||
run: poetry run poe test_dist | ||
run: | | ||
source $VENV |
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 above steps we can use poe ...
, why can't we use it here?
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.
As mentioned above, if I use the run script, it installs the wheel into the "system" environment, not poetry's virtual environment.
So the issue is that we have at least two python executables and for some reason, poetry/windows CI uses both of them in an inconsistent manner? Is it possible to remove one of them from the PATH (or delete it) so that poetry/CI is not confused by it? |
That was intentional, as |
I don't know. Prior to a few days ago, we always had 2 environments on Windows and things worked. With the I'm now thinking that it is the |
See https://github.com/snok/install-poetry#running-on-windows as to why we have to do the sourcing. |
@bashtage @twoertwein I am unsure what to do about this whole issue. @bashtage pushed a commit last night and the current CI worked just fine. So the error we are getting is a bit random. Ideally, we'd have a failed run and a successful CI run on Windows, where the only difference was small code changes. Then we could compare the logs and see what is happening. If you look at the successful run at https://github.com/pandas-dev/pandas-stubs/runs/8132062193?check_suite_focus=true in the past few hours, you see this:
This says poetry is installing everything into a virtual environment. But then when
So it seems to say it will run from the python that is installed by the But in a failure from here: https://github.com/pandas-dev/pandas-stubs/runs/8132162205?check_suite_focus=true, you get the same beginning, although poetry is using the cache in that case. Then when
Note that it tried to use the system installed version. Maybe there is a cache file sitting around that works, and another one that doesn't, and @bashtage was lucky in one run to pick up the cache, and unlucky in another run where it didn't pick up the cache. I don't understand how this caching works. Maybe @twoertwein has an idea. Given the randomness we are seeing, I don't know if we should merge this PR. |
closing in favor of #249 |
Summary
One downside (at least for me). The setting
makes a local test with poetry not work inside of a conda environment.
But at least the CI is working.