-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feat: tox implementation #1989
base: master
Are you sure you want to change the base?
Feat: tox implementation #1989
Conversation
PyDPF uses a custom wheel building step in CI. The first commit implements a way of integrating that step with tox. |
Hi @moe-ad, thanks for this work. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1989 +/- ##
==========================================
- Coverage 88.44% 87.25% -1.20%
==========================================
Files 89 89
Lines 10251 10251
==========================================
- Hits 9066 8944 -122
- Misses 1185 1307 +122 |
@PProfizi
The long term advantages would be:
Those are the ones I can think of at the moment. I remember @jorgepiloto also shared many advantages. He will be back by tomorrow and he can also provide his inputs. |
@PProfizi
With automated test target organization and server process(es) shutdown before and after all tests have run. Per test (irrespective of the running mode), a fresh environment with individual Next steps:
|
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.
Thanks for working on this, @moe-ad. I know it is still in draft mode, but wanted to raise a point about auto-detecting the platform.
[testenv:build_external] | ||
description = Environment for custom build of package wheels, solves PyDPF custom wheel building requirement | ||
|
||
allowlist_externals = | ||
bash | ||
|
||
package_glob = {toxinidir}{/}dist{/}ansys_dpf_core* | ||
|
||
commands = | ||
# Build the wheel | ||
bash -c '\ | ||
if [ {on_platform} == "linux" ]; then \ | ||
export platform="manylinux_2_17"; \ | ||
elif [ {on_platform} == "win32" ]; then \ | ||
export platform="win"; \ | ||
else \ | ||
echo "Unknown OS"; \ | ||
fi; \ | ||
echo $platform; \ | ||
python .ci/build_wheel.py -p $platform -w' |
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.
Tox is able to detect the platform it is running. Just use the following:
platform =
linux: linux
windows: win32
From then one, you can execute commands based on this platform by using this form:
commands =
linux: ls
windows: dir
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.
@jorgepiloto I have been thinking about this for a while. I have had another go at it after reading your comments without success.
It won't work via the above suggestions, at least based on what I have tested. tox expects any factor being used for conditional settings to be present in the environment name itself, otherwise the commands linked to the linux/windows factors will never be executed when tox encounters them. At the same time, the naming specification of an external wheel building environment must have the format <package_env>_external, meaning we can't rename the wheel building environment to [<package_env>-{linux,windows}_external]
or something similar, and because of that the commands are not executed when tox encounters them. Maybe there is something I am missing?
All of these complications can be significantly reduced if there is a way to specify the wheel building logic directly within pyproject.toml. Being able to do this will also simplify some other things. @PProfizi was asking if this is possible yesterday, any ideas?
This PR is related to #296.
This is not a catch all PR, the idea is to first migrate some CI workflows to tox and gradually extend to other CI workflows via other PRs.