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

Remove certain CLI args from setup.py #3345

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Mar 11, 2025

Changes

Instead of passing --enable-X or --disable-Y or --without-Z to setup.py, it makes more sense to just directly use the CMake variables. The following are now set as env variables in build_wheels.bash (with exactly the same defaults as before when building a wheel) that are then passed to setup.py:

  • NRN_ENABLE_PYTHON_DYNAMIC and NRN_ENABLE_MODULE_INSTALL (latter only if we build via CMake)
  • NRN_RX3D_OPT_LEVEL
  • NRN_ENABLE_RX3D
  • NRN_ENABLE_INTERVIEWS
  • NRN_ENABLE_MPI
  • NRN_ENABLE_MUSIC
  • NRN_ENABLE_CORENEURON
  • CMAKE_PREFIX_PATH

This eliminates the need for the following CLI args to setup.py:

  • without-nrnpython
  • rx3d-opt-level
  • disable-rx3d
  • disable-iv
  • disable-mpi
  • enable-music
  • enable-coreneuron
  • cmake-prefix

The docs have been updated to reflect the above.

It also refactors build_wheels.bash to make it more modular and using the "don't repeat yourself" (DRY) principle.

Context

This is useful since we want to replace calls to python setup.py [args] with pip install, i.e. towards conformance with PEP 517 (see also: #2696 and the issues linked in that discussion), for which we shouldn't have any args on the command-line.

User-facing changes

  • the possible values of the first argument to build_wheels.bash were changed from linux to Linux, and osx to Darwin to conform to the output to uname -s. The special value CI remains valid.
  • instead of --disable-mpi and so on, one should specify NRN_ENABLE_MPI=ON and others as env variables when running python setup.py. The remaining valid CLI args are --cmake-build-dir and --cmake-defs, which are scheduled for later removal

JCGoran added 6 commits March 11, 2025 08:47
Instead of passing `--enable-X` or `--disable-Y` or `--without-Z` to
`setup.py`, it makes more sense to just directly use the CMake
variables. The following are now set as env variables in
`build_wheels.bash`:

- NRN_ENABLE_PYTHON_DYNAMIC
- NRN_RX3D_OPT_LEVEL
- NRN_ENABLE_RX3D
- NRN_ENABLE_INTERVIEWS
- NRN_ENABLE_MPI
- NRN_ENABLE_MUSIC
- NRN_ENABLE_CORENEURON

This eliminates the need for the following args:

- without-nrnpython
- rx3d-opt-level
- disable-rx3d
- disable-iv
- disable-mpi
- enable-music
- enable-coreneuron

This is useful since we want to replace calls of `python setup.py
[args]` with `pip install`, i.e. towards conformance with PEP 517 (see
also: #2696).

It also refactors `build_wheels.bash` to make it more modular and
using the "don't repeat yourself" (DRY) principle.

The user-facing changes are as follows:

- `build_wheels.bash` can now be ran without _any_ parameters because
  the platform is automatically detected (using `uname -s`)
- the possible values of the first argument to `build_wheels.bash` were
  changed from `linux` to `Linux`, and `osx` to `Darwin` to conform to
  the output to `uname -s`. The special value `CI` remains valid.
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.31%. Comparing base (9c36354) to head (e3dc73f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3345   +/-   ##
=======================================
  Coverage   68.31%   68.31%           
=======================================
  Files         681      681           
  Lines      116420   116420           
=======================================
  Hits        79527    79527           
  Misses      36893    36893           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

✔️ a965a63 -> Azure artifacts URL

Copy link

✔️ 28170d8 -> Azure artifacts URL

Copy link

✔️ 7c0eb0a -> Azure artifacts URL

Comment on lines +440 to +441
NRN_ENABLE_PYTHON_DYNAMIC : ${{ matrix.config.python_dynamic || 'OFF' }}
NRN_ENABLE_MUSIC: ${{ matrix.config.music || 'OFF' }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because otherwise setup.py's strtobool throws an error (as any GitHub Action config option not explicitly specified defaults to the empty string, '').

Comment on lines +26 to +27
PLATFORM_LINUX="Linux"
PLATFORM_MACOS="Darwin"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default identifiers that uname -s returns (on any "normal" Linux, and all MacOS versions).

pip check
configure_macos() {
echo " - Installing build requirements for MacOS"
pip install -U 'delocate<=0.13.0,>=0.13.0'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recent version of delocate fixed this bug: matthew-brett/delocate#153

@JCGoran JCGoran marked this pull request as ready for review March 12, 2025 10:21
@JCGoran JCGoran changed the title Remove certain CLI args to setup.py Remove certain CLI args from setup.py Mar 12, 2025
Copy link

✔️ 5bc2ce4 -> Azure artifacts URL

Copy link

✔️ e3dc73f -> Azure artifacts URL

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

Successfully merging this pull request may close these issues.

1 participant