Skip to content

Latest commit

 

History

History
97 lines (65 loc) · 1.97 KB

development.md

File metadata and controls

97 lines (65 loc) · 1.97 KB

riverqueue-python development

Install dependencies

The project uses Rye for its development toolchain and to run development targets. Install it with:

$ curl -sSf https://rye.astral.sh/get | bash

Or via Homebrew:

$ brew install rye

Then use it to set up a virtual environment:

$ rye sync

Run tests

Create a test database and migrate with River's CLI:

$ go install github.com/riverqueue/river/cmd/river
$ createdb river_test
$ river migrate-up --database-url "postgres://localhost/river_test"

Run all tests:

$ rye test

Run a specific test (or without -k option for all tests in a single file):

rye test -- tests/driver/sqlalchemy/sqlalchemy_driver_test.py -k test_insert_with_unique_opts_by_queue

Run lint

$ rye lint

Run type check (Mypy)

$ make type-check

Format code

$ rye fmt

Rye uses Ruff under the hood for code formatting.

Generate sqlc code

$ make generate

Publish package

  1. Pull existing master and tags, choose a version, and create a branch:

    git checkout master && git pull --rebase
    export VERSION=v0.x.0
    git checkout -b $USER-$VERSION
  2. Update CHANGELOG.md and pyproject.toml to the new version number, and open a pull request. Get it reviewed and merged.

  3. Pull down the merged pull request, build the project (goes to dist/), publish it to PyPI, cut a tag for the new version, and push it to GitHub:

    git pull origin master
    
    rye build
    rye publish
    
    git tag $VERSION
    git push --tags
    
    # or else PyPI will keep uploading old versions forever
    rm dist/*
  4. Cut a new GitHub release by visiting new release, selecting the new tag, and copying in the version's CHANGELOG.md content as the release body.