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

Pyosys Wheels #4534

Merged
merged 8 commits into from
Oct 8, 2024
Merged

Pyosys Wheels #4534

merged 8 commits into from
Oct 8, 2024

Conversation

donn
Copy link
Contributor

@donn donn commented Aug 12, 2024

Updates for 2024-10-04 and 2024-10-07:

After many discussions, we've arrived at the following:

  • Only CPython on GNU/Linux x86-64 and macOS (x86-64/arm64) will be supported initially
    • musl greatly increases build times and the rest cannot be built at the moment
  • CI will be workflow_dispatch-only.
  • pyosys wheel versions will be equal to the current one in the Makefile with the + replaced with . to comply with the pypa version spec (and allow for patch versions)

The initial set of wheels are up on the Test PyPI here https://test.pypi.org/project/pyosys/ and can be installed as follows: pip install -i https://test.pypi.org/simple/ pyosys


What are the reasons/motivation for this change?

We'd like to replace our aging Tcl-based synthesis scripts with fresh new ones written for Pyosys.

Unfortunately, the only way to get Pyosys right now that I'm aware of is to compile it from source. This would take too much time in say, a Google Colaboratory.

Along with yowasp-yosys, this gives users two options to use Yosys via PIP: either natively via the Python API, or the full app using WebAssembly.

Explain how this is achieved.

If applicable, please suggest to reviewers how they can test the change.

You can build and test a wheel locally for your setup as follows: (You will still need all of Yosys' dependencies)

cd yosys
python3 -m venv venv
./venv/bin/python3 -m pip install setuptools wheel
./venv/bin/python3 -m pip install .
./venv/bin/python3 -c "from pyosys import libyosys as ys;d=ys.Design();ys.run_pass('help', d)"

I'm primarily inviting comment at this point, I would like to know the maintainers' thoughts on:

  • This in general
  • No wheels for Windows just yet-- I'm not sure if the CIBW_BEFORE_BUILD script will work on Windows at all
  • pypy is not supported: The Makefile and build scripts currently presume the existence of python3-config which pypy does not have
  • Builds for Linux/aarch64 are emulated and time out

@donn donn requested a review from mmicko as a code owner August 12, 2024 11:41
@donn donn marked this pull request as draft August 12, 2024 12:27
@povik povik self-assigned this Sep 9, 2024
@donn donn force-pushed the test_wheels branch 15 times, most recently from f15c785 to be85b3c Compare September 29, 2024 13:26
@donn donn force-pushed the test_wheels branch 5 times, most recently from 2148ccd to aec42ca Compare October 4, 2024 19:37
@donn donn marked this pull request as ready for review October 5, 2024 16:14
* Created `setup.py`: Python package manifest to build `pyosys` wheels with a custom extension to build and include `libyosys.so` using Make
* `.gitignore`: Added byproducts of the Python wheel build process
* `Makefile`: Added `-undefined dynamic_lookup` to `libyosys.so` so missing symbols can be resolved by importing into a Python interpreter
* `kernel/yosys.cc`: Gated `PyImport_AppendInittab` with `!Py_IsInitialized`; as of Python 3.12, the interpreter is already initialized and `PyImport_AppendInittab` would cause an exception to be raised
* Created `wheels.yml`: CI workflow for building wheels for CPython on:
  * Linux (glibc, musl) and Darwin
  * x86-64 and arm64
* Update manylinux images
* FFI now built as a per-platform static library
* Explicitly set minimum macOS deployment target, use clang on macOS
* Try enabling Windows (as an experiment)
* Disable aarch64-linux, aarch64-windows
* wheel versions now replace `+` with `.post` to match spec at https://packaging.python.org/en/latest/specifications/version-specifiers/
* CI updates:
  * Bump action versions
  * Disabled Windows for now and documented why
  * Added a new job to upload all wheels
  * Added new variable, `PYPI_INDEX`: fallback 'https://pypi.org/' if unset
  * Added new secret, `PYPI_TOKEN`
* .editorconfig now uses 2 spaces for YML (it kept setting mine to tabs
  and GitHub Actions doesn't like that)
@donn donn marked this pull request as draft October 7, 2024 16:45
@donn donn marked this pull request as ready for review October 8, 2024 07:16
@mmicko mmicko merged commit 535b330 into YosysHQ:main Oct 8, 2024
22 checks passed
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.

3 participants