# Migration from setup.py to pyproject.toml for ITK modules

**URL:** https://discourse.itk.org/t/migration-from-setup-py-to-pyproject-toml-for-itk-modules/6678
**Category:** Uncategorized
**Created:** [June 6, 2024, 8:35am UTC](https://discourse.itk.org/t/migration-from-setup-py-to-pyproject-toml-for-itk-modules/6678 "2024-06-06T08:35:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [June 6, 2024, 8:35am UTC](https://discourse.itk.org/t/migration-from-setup-py-to-pyproject-toml-for-itk-modules/6678/1 "2024-06-06T08:35:27Z")

</div>

I have been quite busy preparing RTK wheels compatible with ITK v5.4.0. For Python 3.12 compatibility, I have migrated the setup.py to pyproject.toml see [BUG: Fix Python wheel name of Cuda versions by SimonRit · Pull Request #601 · RTKConsortium/RTK · GitHub](https://github.com/RTKConsortium/RTK/pull/601/files). I am able to generate the wheels and it seems to work 🙂. However, the way I generate them is a bit hacky as I’m pre-processing the `pyproject.toml` file to dynamically configure the package name and dependencies according to the Cuda version, [here](https://github.com/RTKConsortium/RTK/pull/601/files#diff-b605ee46fbd21ee607667ab55c9a27d46cc6981d9468c2db4bed457d80aa9ac3R71-R72) for Linux and [here](https://github.com/RTKConsortium/RTK/pull/601/files#diff-b605ee46fbd21ee607667ab55c9a27d46cc6981d9468c2db4bed457d80aa9ac3R158-R159) for Windows. It might not be fully ITK-related but I think some people (@matt.mccormick?) reading this discourse are experts in both scikit-build-core and ITK and I was wondering if there is a better way to dynamically configure the package name and the package dependencies?

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [June 6, 2024, 4:30pm UTC](https://discourse.itk.org/t/migration-from-setup-py-to-pyproject-toml-for-itk-modules/6678/2 "2024-06-06T16:30:04Z")

</div>

@simon.rit awesome work on the `rtk` Python packages and thank you for the contributions! 💖 🌟 🙏

Yes, our collaborator on scikit-build-core developed a Python packaging standard feature called [dynamic-metadata plugins](https://discuss.python.org/t/proposal-for-dynamic-metadata-plugins/25237) that could provide the functionality you would like. There is [already support](https://scikit-build-core.readthedocs.io/en/latest/configuration.html#dynamic-metadata) in scikit-build-core for operations like setting the version or patching up the package description for PyPI. We have scikit-build-core community meetings on the third Friday of the month at 12 PM ET, it could be worthwhile to pop in, explain your goals, and get some feedback. Folks from NVIDIA also regularly attend and are using it for their CUDA packages. We use this [Google Meet link](https://meet.google.com/dvx-jkai-xhq).

CC: @jcfr

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [June 6, 2024, 8:54pm UTC](https://discourse.itk.org/t/migration-from-setup-py-to-pyproject-toml-for-itk-modules/6678/3 "2024-06-06T20:54:17Z")

</div>

Thanks for the links. The meetings sound like a great opportunity to present this case. I’ll try to connect, it might not be the 21st of June but I should be available the following one.
