Skip to content

Commit

Permalink
Update pypanda README based on poking around with pypanda wheel (#1481)
Browse files Browse the repository at this point in the history
* Update pypanda README based on poking around with pypanda wheel

* Update to upload and download for pypi and upload debian and wheel together

* First step of updating publish_deb for no EOL actions

* Since renaming wont occur in action, setup.sh will attach version instead

* I do not think you need the create_release@v1 as the new one does this for you too

* setup.py uses requirements.txt already, no need to repeat myself

* Yeah I do not think you need the whole old create_release here either
  • Loading branch information
AndrewQuijano authored Mar 22, 2024
1 parent c42efb0 commit 86e4ed1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 52 deletions.
32 changes: 5 additions & 27 deletions .github/workflows/publish_deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@ on:
tags: v*

jobs:

create_release:
runs-on: panda-arc
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}

build_deb:
needs: create_release
runs-on: panda-arc
strategy:
matrix:
Expand All @@ -40,18 +24,12 @@ jobs:
working-directory: panda/debian
run: ./setup.sh Ubuntu ${{ matrix.ubuntu_version }}

- name: Upload packages to release
uses: actions/upload-release-asset@v1
- name: Upload wheel and debian packages to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: |
panda/debian/pandare_${{ matrix.ubuntu_version }}.deb
tag_name: ${{ github.ref }}
files: |
panda/debian/pandare-*.whl
asset_name: |
pandare.deb
pandare-$(echo "$(ls panda/debian/pandare-*.whl)" | sed 's/^.*pandare-//')
asset_content_type: |
application/vnd.debian.binary-package
application/octet-stream
panda/debian/pandare_*.deb
38 changes: 15 additions & 23 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ jobs:
with:
release_branch: dev
use_api: true
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.v-version }}
release_name: ${{ steps.version.outputs.v-version }}

build_release_assets:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
Expand All @@ -57,25 +49,23 @@ jobs:
working-directory: panda/debian
run: ./setup.sh Ubuntu ${{ matrix.ubuntu_version }}

- name: Upload deb to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: panda/debian/pandare.deb
asset_name: pandare_${{ matrix.ubuntu_version }}.deb
asset_content_type: application/vnd.debian.binary-package

- name: Upload wheel to release
- name: Upload wheel and debian packages to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.create_release.outputs.v-version }}
files: |
panda/debian/pandare-*.whl
panda/debian/pandare_*.deb
- name: Store the PyPanda distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: panda/debian/pandare-*.whl
if-no-files-found: error

- name: 'Login to Docker Registry'
if: ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
uses: docker/login-action@v3
Expand Down Expand Up @@ -150,7 +140,6 @@ jobs:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build_release_assets
runs-on: ubuntu-latest
Expand All @@ -161,12 +150,15 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# user: pandare
# password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: panda/debian/
verbose: true

build_stable:
Expand Down
1 change: 1 addition & 0 deletions panda/debian/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ docker build -t packager .

# Copy deb file out of container to host
docker run --rm -v $(pwd):/out packager bash -c "cp /pandare.deb /out"
mv pandare.deb pandare_${version}.deb

# Copy whl file out of container to host, this also preserves wheel name, which is important as pip install WILL fail if you arbitarily change the generated wheel file name
docker run --rm -v $(pwd):/out panda_installer bash -c "cp /panda/panda/python/core/dist/*.whl /out"
15 changes: 13 additions & 2 deletions panda/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Autogenerated pypanda documentation is available at [docs.panda.re](https://docs

2) Install pypanda dependencies with:
```
# apt-get install -y genisoimage wget libffi-dev
# pip3 install colorama 'protobuf>=4.25.1' 'cffi>=1.14.3'
apt-get install -y genisoimage wget libffi-dev
```
Note CFFI is a build dependency for pypanda and your protobuf version needs to match your system version.

Expand All @@ -29,5 +28,17 @@ $ python setup.py install
### Technical details
See detailed installation, usage and example programs [here](./docs/USAGE.md).

Also, given the major protobuf update, you may see this message.
```
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
```
Using `export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` so far was the easiest work around and the performance was still reasonable.

## Examples
Examples are provided in the [examples directory](./examples/).

0 comments on commit 86e4ed1

Please sign in to comment.