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

Provide tool to build and distribute deno-compiled binary on PyPi #181

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

candleindark
Copy link

@candleindark candleindark commented Mar 12, 2025

This PR closes #148. Please see commit messages for details.

Note:

  1. The --allow-run option is used to compiled the BIDS validator from local source. Without this option, the compilation result would require the user to grant permission to run subprocesses. This option was not used/needed when compiling from the published jsr package from some reason.

TODOs:

  • add TODOs here on what is left to be done

The tool, including the accompanying GH Action workflow
would wrap the deno-compiled binary of the BIDS validator
in wheels for different platforms and publish them on
PyPi.
@candleindark candleindark force-pushed the deno-binary branch 9 times, most recently from 2470c52 to 6dcbe08 Compare March 12, 2025 05:49
if git describe | grep -e -; then
echo not releasing;
else
twine upload --verbose --repository testpypi dist/*.whl
Copy link
Contributor

Choose a reason for hiding this comment

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

potentially auth could be replaced by using "trusted repositories" setup on pypi.

push:
branches:
- main
- deno-binary
Copy link
Contributor

Choose a reason for hiding this comment

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

eventually remove

Suggested change
- deno-binary

Comment on lines +3 to +7
on:
push:
branches:
- main
- deno-binary
Copy link
Contributor

Choose a reason for hiding this comment

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

overall here aim for the same setup of on as in https://github.com/bids-standard/bids-validator/blob/main/.github/workflows/deno_tests.yml

Suggested change
on:
push:
branches:
- main
- deno-binary
on:
push:
branches: [main, dev]
tags: ['*']
pull_request:
branches: [main, dev]

and then add corresponding if below for twine call:

name: wheel-${{ matrix.os }}
path: tools/pypi-whl/dist/*.whl
- name: Publish wheels if corresponds to a tag
# TODO: might be suboptimal since we might skip a tag if not the latest commit
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# TODO: might be suboptimal since we might skip a tag if not the latest commit
if: github.ref_type == 'tag'

Comment on lines +88 to +92
# if a clean tag, no - in it
if git describe | grep -e -; then
echo not releasing;
else
twine upload --verbose --repository testpypi dist/*.whl
Copy link
Contributor

Choose a reason for hiding this comment

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

with above if we likely do not need this

Suggested change
# if a clean tag, no - in it
if git describe | grep -e -; then
echo not releasing;
else
twine upload --verbose --repository testpypi dist/*.whl
twine upload --verbose --repository testpypi dist/*.whl

@effigies
Copy link
Contributor

image

The cp3* is going to cause problems, as the package will only be installable with Python 3.9. Installing from test.pypi.org works because it finds bids_validator_deno-2.0.7-py3-none-manylinux_2_17_x86_64.whl.

You need to get back to the py3-none-*. I'm not sure how to do that in pdm. I could work it out in setuptools if I knew how to package a pre-built binary.

@yarikoptic
Copy link
Contributor

right, somehow that got lost I guess -- may be pdm is not executed within the folder where that pdb_build.py is?

Please add testing that whl files have -py3-none- in their names!

@effigies
Copy link
Contributor

Oh, I see. It reports using cp39-cp39, but then post-processing renames to py3-none.

@candleindark
Copy link
Author

I tried to use the pdm frontend to invoke the build locally. It didn't work for me. Just use python -m build if want to try it locally, but the current setup is really for CI to do the building.

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.

Upload cross-platform builds of deno bids-validator as .whl's to pypi
3 participants