Skip to content

Commit 0923d02

Browse files
committed
setuptools -> poetry
1 parent 6f3b9ec commit 0923d02

File tree

10 files changed

+473
-55
lines changed

10 files changed

+473
-55
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ on:
1010
jobs:
1111
lint_python:
1212
name: Lint Python Code
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- name: Check out Git repository
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: Install Linters
1818
run: make venv
1919
- name: Lint
2020
run: make lint
2121
push_to_pypi:
2222
name: Build (and publish, if applicable)
23-
runs-on: ubuntu-20.04
23+
runs-on: ubuntu-22.04
2424
needs: lint_python
2525
steps:
2626
- name: Check out Git repository
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0
3030
- name: Export Repo URL
3131
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> $GITHUB_ENV
3232
- name: Export Branch Name
3333
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
34-
- name: Set Up Python 3.6
34+
- name: Set Up Python 3.8
3535
uses: actions/setup-python@v1
3636
with:
37-
python-version: 3.6
37+
python-version: 3.8
3838
- name: Build Distribution
3939
run: |
4040
make dist

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ parser.out
1010
parsetab.py
1111
*.rpt
1212
*.log
13-
/*.v
13+
/*.v
14+
requirements_tmp.txt

Makefile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
FILE=./requirements_dev.txt
2-
31
all: dist
4-
52
.PHONY: dist
6-
dist: venv/created
7-
./venv/bin/python3 setup.py sdist bdist_wheel
3+
dist: venv/manifest.txt
4+
./venv/bin/poetry build
85

96
.PHONY: lint
10-
lint: venv/created
11-
./venv/bin/black --check .
12-
./venv/bin/flake8 .
7+
lint:
8+
black --check .
9+
flake8 .
10+
mypy --check-untyped-defs .
1311

14-
venv: venv/created
15-
venv/created: $(FILE)
12+
venv: venv/manifest.txt
13+
venv/manifest.txt: ./pyproject.toml
1614
rm -rf venv
1715
python3 -m venv ./venv
18-
./venv/bin/python3 -m pip install wheel
19-
./venv/bin/python3 -m pip install -r $(FILE)
20-
touch venv/created
16+
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade pip
17+
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade wheel poetry poetry-plugin-export
18+
PYTHONPATH= ./venv/bin/poetry export --with dev --without-hashes --format=requirements.txt --output=requirements_tmp.txt
19+
PYTHONPATH= ./venv/bin/python3 -m pip install --upgrade -r requirements_tmp.txt
20+
PYTHONPATH= ./venv/bin/python3 -m pip freeze > $@
21+
@echo ">> Venv prepared."
2122

2223
.PHONY: veryclean
2324
veryclean: clean
@@ -29,4 +30,4 @@ clean:
2930
rm -rf build/
3031
rm -rf logs/
3132
rm -rf dist/
32-
rm -rf *.egg-info
33+
rm -rf *.egg-info

nldiff/__version__.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2023 Efabless Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import os
15+
import importlib.metadata
16+
import sys
17+
18+
19+
def __get_version():
20+
try:
21+
return importlib.metadata.version(__package__ or __name__)
22+
except importlib.metadata.PackageNotFoundError:
23+
import re
24+
25+
rx = re.compile(r"version\s*=\s*\"([^\"]+)\"")
26+
openlane_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
27+
pyproject_path = os.path.join(openlane_directory, "pyproject.toml")
28+
try:
29+
match = rx.search(open(pyproject_path, encoding="utf8").read())
30+
assert match is not None, "pyproject.toml found, but without a version"
31+
return match[1]
32+
except FileNotFoundError:
33+
print("Warning: Failed to extract nl2diff version.", file=sys.stderr)
34+
return "UNKNOWN"
35+
36+
37+
__version__ = __get_version()
38+
39+
40+
if __name__ == "__main__":
41+
print(__version__, end="")

poetry.lock

Lines changed: 377 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[tool.poetry]
2+
name = "nldiff"
3+
version = "0.1.0" # Replace with your actual version
4+
description = "Netlist Diff Tool"
5+
authors = ["Mohamed Gaber <donn@efabless.com>"]
6+
license = "MIT" # Replace with your license if different. Common ones: MIT, Apache-2.0, GPL-3.0
7+
readme = "Readme.md"
8+
packages = [{ include = "nldiff" }] # This is how Poetry handles packages
9+
classifiers = [
10+
"Programming Language:: Python:: 3",
11+
"Intended Audience:: Developers",
12+
"Operating System:: POSIX:: Linux",
13+
"Operating System:: MacOS:: MacOS X",
14+
]
15+
16+
[tool.poetry.dependencies]
17+
python = "^3.8" # Redundant, but good practice to keep here too
18+
click = ">=8.0.0,<9"
19+
pyverilog = "*"
20+
21+
22+
[tool.poetry.group.dev.dependencies]
23+
wheel = "*"
24+
black = ">=24.4.0,<25"
25+
flake8 = ">=4"
26+
27+
[tool.poetry.scripts]
28+
nldiff = "nldiff.__main__:diff_cmd"
29+
30+
[build-system]
31+
requires = ["poetry-core>=1.0.0"]
32+
build-backend = "poetry.core.masonry.api"

requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements_dev.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements_lint.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)