Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use monorepo #195

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions .github/workflows/ci.yml → .github/workflows/inngest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Python CI"
name: "inngest"

on:
push:
Expand All @@ -8,31 +8,15 @@ on:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "examples/**"
- "inngest/**"
- "pyproject.toml"
- "tests/**"
- "pytest.ini"
- "ruff.toml"

jobs:
format-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Format check"
run: "make format-check"

itest:
runs-on: "ubuntu-latest"
strategy:
Expand All @@ -49,6 +33,7 @@ jobs:
run: "make install"
- name: "Integration test"
run: "make itest"
working-directory: "./pkg/inngest"

lint:
runs-on: "ubuntu-latest"
Expand All @@ -65,19 +50,19 @@ jobs:
run: "make install"
- name: "Lint"
run: "make lint"
working-directory: "./pkg/inngest"

publish-pypi:
runs-on: "ubuntu-latest"
needs:
- "format-check"
- "itest"
- "lint"
- "type-check"
- "utest"

# Only publish tagged versions.
# TODO: Add a check to ensure that the git tag matches the version.
if: "startsWith(github.ref, 'refs/tags/')"
if: "startsWith(github.ref, 'refs/tags/inngest@')"
permissions:
id-token: write
strategy:
Expand All @@ -91,8 +76,9 @@ jobs:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Install"
- name: "Build"
run: "make build"
working-directory: "./pkg/inngest"
- name: "Upload package to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"

Expand All @@ -111,6 +97,7 @@ jobs:
run: "make install"
- name: "Type check"
run: "make type-check"
working-directory: "./pkg/inngest"

utest:
runs-on: "ubuntu-latest"
Expand All @@ -127,3 +114,4 @@ jobs:
run: "make install"
- name: "Unit test"
run: "make utest"
working-directory: "./pkg/inngest"
117 changes: 117 additions & 0 deletions .github/workflows/inngest_encryption.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: "inngest_encryption"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "pyproject.toml"
- "pytest.ini"
- "ruff.toml"

jobs:
itest:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
timeout-minutes: 2
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Integration test"
run: "make itest"
working-directory: "./pkg/inngest_encryption"

lint:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Lint"
run: "make lint"
working-directory: "./pkg/inngest_encryption"

publish-pypi:
runs-on: "ubuntu-latest"
needs:
- "itest"
- "lint"
- "type-check"
- "utest"

# Only publish tagged versions.
# TODO: Add a check to ensure that the git tag matches the version.
if: "startsWith(github.ref, 'refs/tags/inngest_encryption@')"
permissions:
id-token: write
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Build"
run: "make build"
working-directory: "./pkg/inngest_encryption"
- name: "Upload package to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"

type-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Type check"
run: "make type-check"
working-directory: "./pkg/inngest_encryption"

utest:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Unit test"
run: "make utest"
working-directory: "./pkg/inngest_encryption"
66 changes: 66 additions & 0 deletions .github/workflows/other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "other"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "pyproject.toml"
- "pytest.ini"
- "ruff.toml"

jobs:
format-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Format check"
run: "make format-check"

lint:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Lint"
run: "make lint"

type-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Type check"
run: "make type-check"
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"editor.formatOnSave": true,
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.preferDaemon": true,
"python.analysis.extraPaths": [
"pkg/inngest",
"pkg/inngest_encryption",
"pkg/test_core"
],
"python.analysis.typeCheckingMode": "basic",
"python.languageServer": "Pylance",
"ruff.fixAll": true
Expand Down
29 changes: 13 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.PHONY: build
build:
@if [ -d "dist" ]; then rm -rf dist; fi
@python -m build

check-venv:
@if [ -z "$${CI}" ] && [ -z "$${VIRTUAL_ENV}" ]; then \
echo "virtual environment is not activated"; \
Expand All @@ -16,24 +11,26 @@ format-check: check-venv
@ruff format .

install: check-venv
@pip install -e '.[extra]' -c constraints.txt
@pip install -e '.[extra]' -e ./pkg/inngest -e ./pkg/test_core -c constraints.txt

itest: check-venv
@pytest -n 4 -v tests
@cd pkg/inngest && make itest
@cd pkg/inngest_encryption && make itest

pre-commit: format-check lint type-check utest

release:
@grep "version = \"$${VERSION}\"" pyproject.toml && git tag $${VERSION} && git push origin $${VERSION} || echo "pyproject.toml version does not match"

lint: check-venv
@ruff check .
@cd examples && make lint
@cd pkg/inngest && make lint
@cd pkg/inngest_encryption && make lint
@cd pkg/test_core && make lint

type-check: check-venv
@mypy inngest tests
@mypy examples/fast_api
@mypy examples/flask
@mypy examples/tornado
@cd examples && make type-check
@cd pkg/inngest && make type-check
@cd pkg/inngest_encryption && make type-check
@cd pkg/test_core && make type-check

utest: check-venv
@pytest -v inngest
@cd pkg/inngest && make utest
@cd pkg/inngest_encryption && make utest
19 changes: 19 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export MYPYPATH=../pkg/inngest:../pkg/inngest_encryption:../pkg/test_core

.PHONY: check-venv
check-venv:
@if [ -z "$${CI}" ] && [ -z "$${VIRTUAL_ENV}" ]; then \
echo "virtual environment is not activated"; \
exit 1; \
fi

.PHONY: lint
lint: check-venv
@ruff check .

.PHONY: type-check
type-check: check-venv
@mypy --config-file=../mypy.ini ./digital_ocean
@mypy --config-file=../mypy.ini ./fast_api
@mypy --config-file=../mypy.ini ./flask
@mypy --config-file=../mypy.ini ./tornado
5 changes: 2 additions & 3 deletions examples/digital_ocean/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from src.inngest.client import inngest_client
from src.inngest.functions import hello

import inngest.digital_ocean
from inngest.experimental.digital_ocean_simulator import DigitalOceanSimulator
from src.inngest.client import inngest_client
from src.inngest.functions import hello

main = inngest.digital_ocean.serve(
inngest_client,
Expand Down
3 changes: 1 addition & 2 deletions examples/django/inngest_django/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import inngest.django
from django.contrib import admin
from django.urls import path

import inngest.django

from .functions import hello
from .inngest_client import inngest_client

Expand Down
3 changes: 1 addition & 2 deletions examples/fast_api/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import fastapi
import inngest.fast_api
from src.inngest.client import inngest_client
from src.inngest.functions import hello

import inngest.fast_api

app = fastapi.FastAPI()


Expand Down
Loading