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

Support building from PyPI #117

Merged
merged 4 commits into from
Sep 2, 2023
Merged

Support building from PyPI #117

merged 4 commits into from
Sep 2, 2023

Conversation

karosc
Copy link
Member

@karosc karosc commented Sep 2, 2023

For the longest time, building this project from source required cloning from git, pulling the submodule, and running the setup.py script.

Currently, if a user tries to pip install swmm-toolkit, and a wheel for their given version of python or system is not available on PyPI, pip tries to build from the source dist uploaded to PyPI and fails because the build tools are not installed. This PR attempts to resolve that problem by adding a pyproject.toml file that specifies the build backend and build tools.

In addition to the pyproject.toml, I had to add a small hack to the setup.py script to trick setuptools. I had to add this because scikit-build and setuptools don't play nice with pip install . or python -m build. When running code that generates the sdist or dist_info data, setuptools checks that packages are available. Since our package is only built when running cmake (from a different dir too), those package directories or not found because cmake is not run for sdist or dist_info, and the validation fails. Changing the setuptools package_dir parameter depending on if cmake is running gets around the issue, and I was able to run pip install . and python -m build . successfully in blank virtual envs.

Eventually it'd be nice to transition our build backend to scikit-build-core, but I have not found a good way to make it work yet for multi-platform builds.

@karosc karosc merged commit abbe407 into dev Sep 2, 2023
24 checks passed
@karosc karosc deleted the dev_pyproject.toml branch September 2, 2023 21:58
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.

2 participants