Skip to content

Commit a2556a5

Browse files
authored
Merge pull request #31 from siliconcompiler/package
package lib for pypi
2 parents 18b3fb0 + 369fa8d commit a2556a5

File tree

174 files changed

+220
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+220
-20
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 100
3+
extend-exclude = build
4+
extend-ignore =

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
on:
3+
# Runs on all pushes to branches
4+
push:
5+
# Runs on all PRs
6+
pull_request:
7+
# Manual Dispatch
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint_python:
12+
name: Lint Python Code
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out Git repository
16+
uses: actions/checkout@v4
17+
- name: Lint with Flake8
18+
run: |
19+
pip install --upgrade pip
20+
pip install .[dev]
21+
flake8 --statistics .
22+
23+
check_paths:
24+
name: Run CI
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Check out Git repository
28+
uses: actions/checkout@v4
29+
- name: Run tests
30+
run: |
31+
pip install --upgrade pip
32+
pip install -e .[dev]
33+
pytest

.github/workflows/wheels.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Wheels
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build_wheels:
11+
name: Wheels lambdalib
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: true
18+
- uses: hynek/build-and-inspect-python-package@v1
19+
20+
publish:
21+
needs: [build_wheels]
22+
runs-on: ubuntu-latest
23+
permissions:
24+
id-token: write
25+
if: github.event_name == 'release' && github.event.action == 'published'
26+
27+
steps:
28+
- uses: actions/download-artifact@v3
29+
with:
30+
name: Packages
31+
path: dist
32+
33+
- name: Publish
34+
uses: pypa/gh-action-pypi-publish@v1.8.11
35+
36+
save:
37+
needs: [publish]
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/download-artifact@v3
42+
with:
43+
name: Packages
44+
path: dist
45+
46+
- name: Add wheels to GitHub release artifacts
47+
uses: softprops/action-gh-release@v1
48+
with:
49+
files: dist/*.whl

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ a.out
99

1010
# Byte-compiled / optimized / DLL files
1111
__pycache__/
12+
lambdalib.egg-info/
13+
build/
14+
dist/

README.md

Lines changed: 6 additions & 6 deletions

lambdalib/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
import pkg_resources
3+
try:
4+
__version__ = pkg_resources.get_distribution('lambdalib').version
5+
except: # noqa E722
6+
__version__ = None
7+
8+
9+
def register_data_source(chip):
10+
# check if local
11+
root_path = os.path.dirname(os.path.dirname(__file__))
12+
test_path = os.path.join(root_path, 'lambdalib', 'iolib', 'rtl', 'la_ioanalog.v')
13+
if os.path.exists(test_path):
14+
path = root_path
15+
ref = None
16+
else:
17+
path = 'git+https://github.com/siliconcompiler/lambdalib.git'
18+
ref = f'v{__version__}'
19+
20+
chip.register_package_source(name='lambdalib',
21+
path=path,
22+
ref=ref)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)