Skip to content

Commit

Permalink
configure the release to PyPI
Browse files Browse the repository at this point in the history
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
  • Loading branch information
achille-roussel committed Feb 13, 2024
1 parent 3d962dc commit 5725bc4
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 19 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PyPI

on:
pull_request:
push:
branches:
- main
tags:
- 'v*'

jobs:
test:
if: {{ github.ref_name != 'main' }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dispatch-functions
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

release:
if: {{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dispatch-functions
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__
.proto
.coverage
.coverage-html
dist/
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage
.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage build check push push-test

PYTHON := python

Expand Down Expand Up @@ -50,8 +50,18 @@ generate: .proto/dispatch-sdk
$(MAKE) fmt

clean:
rm -rf .proto
rm -rf .coverage
rm -rf .coverage-html
$(RM) -rf dist .proto .coverage .coverage-html
find . -type f -name '*.pyc' -exec rm {} \;
find . -type d -name '__pycache__' -exec rm -r {} \;

build:
$(PYTHON) -m build

check:
twine check dist/*

push:
twine upload dist/*

push-test:
twine upload -r testpypi dist/*
31 changes: 16 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "dispatch-sdk"
name = "dispatch-functions"
description = "Python SDK for Dispatch Stateful Functions"
readme = "README.md"
dynamic = ["version"]
requires-python = ">= 3.11"
# TODO: relax dependency versions
dependencies = [
"grpcio==1.60.0",
"protobuf==4.24.0",
"types-protobuf==4.24.0.20240129",
"grpc-stubs",
"http_message_signatures==0.4.4"
"grpcio >= 1.60.0",
"protobuf >= 4.24.0",
"types-protobuf >= 4.24.0.20240129",
"grpc-stubs >= 1.53.0.5",
"http-message-signatures >= 0.4.4"
]

[project.optional-dependencies]
dev = [
"black==24.1.0",
"isort==5.13.2",
"mypy==1.8.0",
"fastapi==0.109.0",
"httpx==0.26.0",
"coverage==7.4.1",
"requests==2.31.0",
"types-requests==2.31.0.20240125"
"black >= 24.1.0",
"isort >= 5.13.2",
"mypy >= 1.8.0",
"fastapi >= 0.109.0",
"httpx >= 0.26.0",
"coverage >= 7.4.1",
"requests >= 2.31.0",
"types-requests >= 2.31.0.20240125"
]

[tool.setuptools.dynamic]
Expand Down

0 comments on commit 5725bc4

Please sign in to comment.