Skip to content

Commit b9c9ac3

Browse files
Auto push to PyPi on edit
1 parent 3c4ff37 commit b9c9ac3

4 files changed

Lines changed: 72 additions & 11 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Upload Python Package to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
pypi-publish:
13+
name: Publish package to PyPI
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/hwcomponents-adc
18+
permissions:
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch all history and tags for setuptools-scm
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.12"
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install build
32+
- name: Build package
33+
run: |
34+
python -m build
35+
- name: Publish package distributions to PyPI
36+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
HWComponents-ADC models the area and energy of Analog-Digital Converters (ADCs) for use
33
in analog & mixed-signal accelerator designs.
44

5+
These models are for use with the HWComponents package, found at
6+
https://accelergy-project.github.io/hwcomponents/.
7+
58
Models are based on statistical analysis of published ADC performance data in Boris
69
Murmann's ADC Performance Survey [1]. The energy model is based on the observation that
710
the maximum efficiency of an ADC is bounded by the sampling rate and the resolution [1],
811
and the area model is based on regression analysis. Estimations are optimistic; they
912
answer the question "what is the best possible ADC design for the given parameters?".
1013

1114
## Installation
12-
Clone the repository and install with pip:
15+
16+
Install from PyPI:
1317

1418
```bash
15-
git clone https://github.com/Accelergy-Project/hwcomponents-adc.git
16-
cd hwcomponents-adc
17-
pip install .
19+
pip install hwcomponents-adc
1820

1921
# Check that the installation is successful
2022
hwc --list | grep ADC
@@ -82,12 +84,12 @@ If you use this model in your work, please cite the following:
8284

8385
```bibtex
8486
@misc{andrulis2024modelinganalogdigitalconverterenergyarea,
85-
title={Modeling Analog-Digital-Converter Energy and Area for Compute-In-Memory Accelerator Design},
87+
title={Modeling Analog-Digital-Converter Energy and Area for Compute-In-Memory Accelerator Design},
8688
author={Tanner Andrulis and Ruicong Chen and Hae-Seung Lee and Joel S. Emer and Vivienne Sze},
8789
year={2024},
8890
eprint={2404.06553},
8991
archivePrefix={arXiv},
9092
primaryClass={cs.AR},
91-
url={https://arxiv.org/abs/2404.06553},
93+
url={https://arxiv.org/abs/2404.06553},
9294
}
9395
```

pyproject.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
2+
requires = ["setuptools>=61.0", "wheel", "setuptools-scm>=6.2"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "hwcomponents-adc"
7-
version = "0.1"
7+
dynamic = ["version"]
88
description = "A package for estimating the energy and area of Analog-Digital Converters"
99
readme = "README.md"
1010
requires-python = ">=3.12"
11-
license = {text = "MIT"}
11+
license = "MIT"
1212
authors = [
1313
{name = "Tanner Andrulis", email = "Andrulis@mit.edu"}
1414
]
1515
keywords = ["accelerator", "hardware", "energy", "estimation", "analog", "adc"]
1616
classifiers = [
1717
"Development Status :: 3 - Alpha",
18-
"License :: OSI Approved :: MIT License",
1918
"Programming Language :: Python :: 3",
2019
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
2120
]
2221
dependencies = [
22+
"hwcomponents",
2323
"PyYAML",
2424
"numpy",
2525
"pandas",
@@ -28,9 +28,14 @@ dependencies = [
2828
[tool.setuptools]
2929
packages = {find = {}}
3030
include-package-data = true
31-
py-modules = ["hwcomponents_adc"]
3231

3332
[tool.setuptools.package-data]
3433
hwcomponents_adc = [
3534
"adc_data/model.yaml",
3635
]
36+
37+
[tool.setuptools_scm]
38+
write_to = "hwcomponents_adc/_version.py"
39+
fallback_version = "1.0.0"
40+
version_scheme = "setup_scm_version:post_version"
41+
local_scheme = "setup_scm_version:no_local"

setup_scm_version.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Version scheme for setuptools-scm - creates post-release versions."""
2+
from setuptools_scm.version import guess_next_version
3+
4+
5+
def post_version(version):
6+
"""Create post-release versions instead of dev versions."""
7+
if version.exact:
8+
return version.format_with("{tag}").lstrip('v')
9+
10+
base = str(version.tag).lstrip('v') if version.tag else (guess_next_version(version) or "1.0.0")
11+
distance = version.distance or 0
12+
13+
return f"{base}.post{distance}" if distance > 0 else base
14+
15+
16+
def no_local(version):
17+
"""No local version identifier."""
18+
return ""

0 commit comments

Comments
 (0)