-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate pyslang into this repository (#1210)
- Loading branch information
1 parent
98c2035
commit c1fbf13
Showing
14 changed files
with
770 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "Python Build" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Build with Pip | ||
runs-on: ${{ matrix.platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [windows-latest, macos-latest, ubuntu-latest] | ||
python-version: ["3.11", "pypy-3.9"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
if: matrix.platform == 'macos-latest' | ||
with: | ||
xcode-version: 'latest' | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
- name: Build and install | ||
run: pip install --verbose . | ||
- name: Test | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: "Python Dist" | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_sdist: | ||
name: Build SDist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Build SDist | ||
run: pipx run build --sdist | ||
- name: Check metadata | ||
run: pipx run twine check dist/* | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist/*.tar.gz | ||
name: artifact-sdist | ||
|
||
build_wheels: | ||
name: Wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
if: matrix.os == 'macos-latest' | ||
with: | ||
xcode-version: 'latest' | ||
- uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_MACOS: auto universal2 | ||
MACOSX_DEPLOYMENT_TARGET: "10.15" | ||
- name: Verify clean directory | ||
run: git diff --exit-code | ||
shell: bash | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: wheelhouse/*.whl | ||
name: artifact-${{ matrix.os }} | ||
|
||
upload_test: | ||
name: Upload test | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags') | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: artifact-* | ||
path: dist | ||
merge-multiple: true | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
skip_existing: true | ||
|
||
upload_official: | ||
name: Upload official | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: (github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch' | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: artifact-* | ||
path: dist | ||
merge-multiple: true | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"python.testing.pytestArgs": [], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[project] | ||
name = "pyslang" | ||
version = "7.0.1" | ||
description = "Python bindings for slang, a library for compiling SystemVerilog" | ||
readme = {file = "pyslang/README.md", content-type = "text/markdown"} | ||
authors = [{name = "Mike Popoloski"}] | ||
keywords = ["slang", "verilog", "systemverilog", "parsing", "compiler", "eda"] | ||
license = {file = "LICENSE"} | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: Unix", | ||
"Programming Language :: C++", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", | ||
"Topic :: Software Development :: Compilers", | ||
"Topic :: Software Development :: Libraries :: Python Modules" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://sv-lang.com/" | ||
Documentation = "https://sv-lang.com/" | ||
Repository = "https://github.com/MikePopoloski/slang" | ||
Issues = "https://github.com/MikePopoloski/slang/issues" | ||
Changelog = "https://github.com/MikePopoloski/slang/blob/master/CHANGELOG.md" | ||
|
||
[project.optional-dependencies] | ||
test = ["pytest"] | ||
|
||
[build-system] | ||
requires = [ | ||
"pybind11", | ||
"scikit-build-core", | ||
] | ||
build-backend = "scikit_build_core.build" | ||
|
||
[tool.scikit-build] | ||
build-dir = "build/{wheel_tag}" | ||
cmake.source-dir = "." | ||
install.components = ["pylib"] | ||
sdist.exclude = [ | ||
".github", | ||
"./build", | ||
"./install", | ||
"./tests", | ||
"./tools", | ||
] | ||
wheel.packages = ["pyslang/pyslang"] | ||
|
||
[tool.scikit-build.cmake.define] | ||
SLANG_INCLUDE_TESTS = "OFF" | ||
SLANG_INCLUDE_TOOLS = "OFF" | ||
SLANG_INCLUDE_PYLIB = "ON" | ||
|
||
[tool.cibuildwheel] | ||
archs = ["auto64"] | ||
manylinux-x86_64-image = "manylinux_2_28" | ||
skip = ["pp*", "cp36-*", "*musllinux*"] | ||
build-verbosity = 1 | ||
test-command = "pytest {project}/tests" | ||
test-extras = ["test"] | ||
test-skip = ["*universal2:arm64"] | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["pyslang/tests"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Contributing to `pyslang` | ||
|
||
Pyslang, the Python bindings for the [slang project](https://github.com/MikePopoloski/slang), are built, tested, and packaged with code in this repository. | ||
|
||
The bulk of functional code is in the [`slang` repository](https://github.com/MikePopoloski/slang). Please refer to its [CONTRIBUTING.md](https://github.com/MikePopoloski/slang/blob/master/CONTRIBUTING.md) guide for more information on contributing to the core project. | ||
|
||
## Python Bindings | ||
|
||
Python bindings are built using [pybind11](https://github.com/pybind/pybind11). | ||
|
||
## Documentation | ||
|
||
All documentation is contained in the `docs` directory of the `slang` repository. | ||
|
||
## Building and Testing | ||
|
||
1. Clone the `pyslang` repository (https://github.com/MikePopoloski/pyslang) | ||
2. Clone the `slang` submodule: | ||
|
||
```bash | ||
git submodule update --init --recursive | ||
``` | ||
|
||
3. Optionally, create a virtual environment and activate it. | ||
|
||
```bash | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
4. Install `pyslang` as a Python package (including building the C++ `slang` library with bindings, from the submodule): | ||
|
||
```bash | ||
pip install . | ||
``` |
Oops, something went wrong.