Skip to content

Commit

Permalink
chore: use pyproject.toml and uv tool
Browse files Browse the repository at this point in the history
This commit removes the existing way of building and publishing the CLI.
We will now use pyproject.toml instead of setup.py and uv from astral.sh
for all tooling.

Fixes AB#18145
  • Loading branch information
pallabpain authored and ankitrgadiya committed Oct 18, 2024
1 parent f6bd3e8 commit e5ac892
Show file tree
Hide file tree
Showing 18 changed files with 1,424 additions and 1,742 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/code-quality.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
jobs:
verify:
name: Conventional Commits
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout code

- uses: rapyuta-robotics/action-conventional-commits@v1.1.1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:

jobs:
deploy:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Pipenv
run: pip3 install pipenv
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install Dependencies
run: pipenv install --dev
run: uv sync --dev

- name: Build Documentation
run: |
pipenv run python3 -m sphinx -M html docs/source docs/output
uv run python -m sphinx -M html docs/source docs/output
cp scripts/install.sh docs/output/html/install.sh
- name: Deploy gh-pages
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: ✅ Quality Checks
on: [ push ]

jobs:
code-quality-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Run checks
uses: astral-sh/ruff-action@v1
with:
args: "check"
27 changes: 11 additions & 16 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,18 @@ on:

jobs:
upload:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Twine
run: pip3 install twine
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Upload Wheel
- name: Publish to pypi
run: |
python setup.py bdist_wheel sdist
twine upload \
--repository ${{ secrets.TWINE_REPOSITORY }} \
--non-interactive \
--skip-existing \
--verbose \
dist/*
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY: ${{ secrets.TWINE_REPOSITORY }}
uv build
uv publish --trusted-publishing always
21 changes: 9 additions & 12 deletions .github/workflows/python-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11' ]
python-version: [ '3.8.10', '3.9', '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install the CLI
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Run the CLI
run: |
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
python setup.py install
- name: Check compatibility
run: |
rio --help
uv run rio
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}

Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/upload-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ on:

jobs:
upload-appimage:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Create AppImage
run: ./scripts/build-rio-appimage.sh
Expand Down Expand Up @@ -52,8 +50,7 @@ jobs:
RUN_ID: ${{ github.run_id }}
PR_NUMBER: ${{ github.event.number }}
continue-on-error: true



- name: Delete existing bot comments
if: steps.edit-comment.outcome == 'failure'
env:
Expand All @@ -67,7 +64,6 @@ jobs:
for COMMENT_ID in $COMMENTS; do
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X DELETE
done


- name: Artifact Comment on PR
# if: github.event_name == 'pull_request'
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

# Node artifact files
node_modules/
dist/
riocli/jsonschema/schemas/json/
# Compiled Java class files
*.class

# Compiled Python bytecode
venv/
.venv/
build/
*.egg-info/
*.py[cod]
Expand All @@ -24,7 +24,6 @@ build/

# Maven
target/
dist/

# JetBrains IDE
.idea/
Expand All @@ -51,7 +50,6 @@ Thumbs.db
*.mov
*.wmv


.eggs/
.history/
.vscode/
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
43 changes: 18 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
# Contribution Guidelines
## Setup your development environment

The project uses [pipenv](https://pipenv.pypa.io/en/latest/) for
development. It needs to be installed to setup the development environment.
The project uses [uv](https://docs.astral.sh/uv/) for development.
It needs to be installed to set up the development environment.

``` bash
pip install pipenv
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Once Pipenv is installed, a Python virtual environment can be quickly
Once `uv` is installed, a Python virtual environment can be quickly
bootstrapped by running the following commands in the root of the repository.

``` bash
pipenv install --dev
uv venv
source .venv/bin/activate
```

This will create a virtual environment in the pipenv's preconfigured location
(if one doesn't already exist). It will also install all the dependencies and
`riocli` package in the location.
This will create a virtual environment in `.venv` directory and activate it.

To run the CLI (or any command) under the context of Pipenv's virtual
environment, prepend the commands with `pipenv run`

Next, install all dependencies using the following command
```bash
pipenv run rio
uv sync
```

To run the RIO CLI from the source directly, you can use `riocli` module
directly.

``` bash
pipenv run python -m riocli
To run the CLI (or any command) under the context of the virtual
environment, prepend the commands with `uv run`
```bash
uv run rio --help
```

New dependencies can be installed directly using `pipenv`. This modifies the
`Pipfile` and `Pipfile.lock`.
New dependencies can be installed directly using `uv`. This modifies the
`pyproject.toml` and `uv.lock`.

``` bash
pipenv install {dependency}
```

But using the `pipenv` directly doesn't sync the dependencies in the
`setup.py` file. Please make sure you update the `setup.py` file with
the new dependencies in the `install_requires` section.
uv add <package-name>
```
43 changes: 0 additions & 43 deletions Pipfile

This file was deleted.

Loading

0 comments on commit e5ac892

Please sign in to comment.