Skip to content

Commit

Permalink
Overhaul the build system to be per modern conventions (#1175)
Browse files Browse the repository at this point in the history
* Remove setup.py and cfg, relying on pyproject.toml

* Update CONTRIBUTING.md, fixed readme path
  • Loading branch information
glados-verma authored Oct 24, 2024
1 parent 4706af6 commit 16b0c05
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 216 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@ jobs:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install build prerequisites
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.6/protoc-21.6-linux-x86_64.zip
unzip protoc-21.6-linux-x86_64.zip
sudo cp bin/protoc /usr/bin/protoc && sudo chmod 777 /usr/bin/protoc
sudo cp -r include/. /usr/include && sudo chmod -R +r /usr/include/google
protoc --version
python -m pip install --upgrade build pip
sudo apt-get install -y libusb-1.0-0-dev libprotobuf-dev swig libevent-dev
- name: Build protobufs
run: python setup.py build_proto
- name: Setup protoc
uses: arduino/setup-protoc@v3
- name: Create OpenHTF package
run: |
python -m build
- name: Test with tox
run: tox
run: |
python -m pip install tox tox-gh-actions
tox
- name: Publish to Coveralls with GitHub Action
uses: coverallsapp/github-action@v2.3.0
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: python-${{ matrix.python-version }}
Expand All @@ -60,8 +59,8 @@ jobs:
run:
working-directory: openhtf/output/web_gui
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm run build

Expand Down
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ virtualenv venv
# Activate the new virtualenv.
. venv/bin/activate

# Update setuptools.
pip install setuptools --upgrade
# Update build (run setuptools).
pip install build --upgrade

# Install openhtf into the virtualenv in dev mode.
python setup.py develop
pip install --editable .

# Install tox and run unit tests.
pip install tox
tox
```

### MacOS
Expand Down Expand Up @@ -268,7 +272,7 @@ virtualenv venv
. venv/bin/activate

# Install openhtf into the virtualenv in dev mode.
python setup.py develop
pip install --editable .
```

If you're having issues with the python setup, it's possible that the problem is due to El Capitan not including ssl headers. This [link](http://adarsh.io/bundler-failing-on-el-capitan/) may help you in that regard.
Expand Down Expand Up @@ -318,12 +322,8 @@ npm start
```

Now you've got the frontend building, but you still need to serve it. The
frontend server is started as a runnable module. In a terminal where your Python
virtual environment (set up above) is active, start the server with:

```bash
python -m openhtf.output.web_gui
```
frontend server is started as a runnable module. See the associated
[readme](openhtf/output/web_gui/README.md).

If you want the server to automatically restart when changes are detected, use
the `--dev` flag.
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include openhtf/output/proto/*.proto

52 changes: 51 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
[build-system]
requires = ["setuptools>=40.8.0", "wheel>=0.29.0"]
requires = ["setuptools", "setuptools-protobuf"]
build-backend = "setuptools.build_meta"

[project]
name = "openhtf"
version = "1.6.0"
authors = [
{ name="The OpenHTF Authors"},
]
description = "OpenHTF, the open hardware testing framework."
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"attrs>=19.3.0",
"colorama>=0.4.6",
"contextlib2>=21.6.0",
"inflection>=0.5.1",
"google-auth>=1.34.0",
"mutablerecords>=0.4.1",
"protobuf>=5.28.2",
"PyYAML>=6.0.2",
"pyOpenSSL>=17.1.0",
"requests>=2.27.1",
"sockjs_tornado>=1.0.7",
"tornado>=4.3,<5.0",
"typing_extensions>=4.12.2",
]
license = {file = "LICENSE"}

[project.optional-dependencies]
usb_plugs = [
"libusb1>=3.1.0",
"M2Crypto>=0.42.0",
]
update_units = ["xlrd>=1.0.0"]
serial_collection_plug = ["pyserial>=3.5"]
examples = ["pandas>=2.2.3"]

[project.urls]
Homepage = "https://github.com/google/openhtf"

[tool.setuptools.packages]
find = {}

[tool.setuptools-protobuf]
protobufs = [
"openhtf/output/proto/assembly_event.proto",
"openhtf/output/proto/guzzle.proto",
"openhtf/output/proto/mfg_event.proto",
"openhtf/output/proto/test_runs.proto",
]

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

184 changes: 0 additions & 184 deletions setup.py

This file was deleted.

2 changes: 0 additions & 2 deletions test_reqs.txt

This file was deleted.

1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ python =

[testenv]
deps =
-r{toxinidir}/test_reqs.txt
absl-py>=0.10.0
pandas>=0.22.0
numpy
Expand Down

0 comments on commit 16b0c05

Please sign in to comment.