Skip to content

Commit 12ffb31

Browse files
authored
chore: add auth to monorepo (#1212)
1 parent d4395a2 commit 12ffb31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+16669
-146
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
python-version: ${{ matrix.python-version }}
4141

4242
- name: Run Tests
43-
run: make ci
43+
run: make ci -j
4444

4545
- name: Upload coverage to Coveralls
4646
uses: coverallsapp/github-action@v2

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"src/supabase": "2.18.1",
33
"src/realtime": "2.7.0",
44
"src/functions": "0.10.1",
5-
"src/storage": "0.12.1"
5+
"src/storage": "0.12.1",
6+
"src/auth": "2.12.3"
67
}

Makefile

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,54 @@
1-
.PHONY: ci, default, pre-commit
2-
3-
default:
4-
@echo "Available targets are: ci, pre-commit, publish"
5-
6-
ci: pre-commit
7-
make -C src/functions tests
8-
make -C src/realtime tests
9-
make -C src/storage tests
10-
make -C src/supabase tests
11-
12-
publish:
13-
uv build --package realtime
14-
uv build --package storage3
15-
uv build --package supabase_functions
16-
uv build --package supabase
17-
uv publish
1+
.PHONY: ci, default, pre-commit, clean, start-infra, stop-infra
2+
3+
PACKAGES := functions realtime storage auth supabase
4+
FORALL_PKGS = $(foreach pkg, $(PACKAGES), $(pkg).$(1))
5+
6+
help::
7+
@echo "Available commands"
8+
@echo " help -- (default) print this message"
9+
10+
ci: pre-commit $(call FORALL_PKGS,tests)
11+
help::
12+
@echo " ci -- Run tests for all packages, the same way as CI does"
1813

1914
pre-commit:
2015
uv run pre-commit run --all-files
16+
help::
17+
@echo " pre-commit -- Run pre-commit on all files"
18+
19+
clean: $(call FORALL_PKGS,clean)
20+
help::
21+
@echo " clean -- Delete cache files and coverage reports from tests"
22+
23+
publish: $(call FORALL_PKGS,build)
24+
uv publish
25+
26+
# not all packages have infra, so just manually instantiate the ones that do for now
27+
start-infra: realtime.start-infra storage.start-infra auth.start-infra
28+
help::
29+
@echo " start-infra -- Start all containers necessary for tests. NOTE: it is not necessary to this before running CI tests, they start the infra by themselves"
30+
stop-infra: realtime.stop-infra storage.stop-infra auth.stop-infra
31+
help::
32+
@echo " stop-infra -- Stop all infra used by tests. NOTE: tests do leave their infra running, so run this to ensure all containers are stopped"
33+
34+
35+
realtime.%:
36+
@$(MAKE) -C src/realtime $*
37+
38+
functions.%:
39+
@$(MAKE) -C src/functions $*
40+
41+
storage.%:
42+
@$(MAKE) -C src/storage $*
43+
44+
auth.%:
45+
@$(MAKE) -C src/auth $*
46+
47+
supabase.%:
48+
@$(MAKE) -C src/supabase $*
49+
50+
help::
51+
@echo
52+
@echo "Package specific commands can be ran by prefixing the command with the package name. Examples:"
53+
@echo " realtime.mypy -- runs relatime's mypy target"
54+
@echo " supabase.build -- runs supabase's build target"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Python monorepo for all [Supabase](https://supabase.com) libraries. This is a wo
66
- [realtime](src/realtime/README.md)
77
- [supabase_functions](src/functions/README.md)
88
- [storage3](src/storage/README.md)
9+
- [supabase_auth](src/auth/README.md)
910

1011
Relevant links:
1112

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ members = [
33
"src/realtime",
44
"src/functions",
55
"src/supabase",
6-
"src/storage"
6+
"src/storage",
7+
"src/auth"
78
]
89

910
[tool.uv.sources]
1011
realtime = { workspace = true }
1112
supabase_functions = { workspace = true }
13+
supabase_auth = { workspace = true }
1214
storage3 = { workspace = true }
1315
supabase = { workspace = true }
1416

release-please-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"changelog-path": "src/realtime/CHANGELOG.md",
66
"release-type": "python"
77
},
8+
"src/auth": {
9+
"changelog-path": "src/auth/CHANGELOG.md",
10+
"release-type": "python"
11+
},
812
"src/functions": {
913
"changelog-path": "src/functions/CHANGELOG.md",
1014
"release-type": "python"

src/auth/.devcontainer/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4+
ARG VARIANT="3.10-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12+
# COPY requirements.txt /tmp/pip-tmp/
13+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
14+
# && rm -rf /tmp/pip-tmp
15+
16+
# [Optional] Uncomment this section to install additional OS packages.
17+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
18+
# && apt-get -y install --no-install-recommends <your-package-list-here>
19+
20+
# [Optional] Uncomment this line to install global node packages.
21+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/python-3
3+
{
4+
"name": "Python 3",
5+
"runArgs": [
6+
"--init"
7+
],
8+
"build": {
9+
"dockerfile": "Dockerfile",
10+
"context": "..",
11+
"args": {
12+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
13+
// Append -bullseye or -buster to pin to an OS version.
14+
// Use -bullseye variants on local on arm64/Apple Silicon.
15+
"VARIANT": "3.10-bullseye",
16+
// Options
17+
"NODE_VERSION": "lts/*"
18+
}
19+
},
20+
// Set *default* container specific settings.json values on container create.
21+
"settings": {
22+
"python.pythonPath": "/usr/local/bin/python",
23+
"python.languageServer": "Pylance",
24+
"python.linting.enabled": true,
25+
"python.linting.flake8Enabled": true,
26+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
27+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
28+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
29+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
30+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
31+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
32+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
33+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
34+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
35+
"python.analysis.diagnosticMode": "workspace",
36+
"files.exclude": {
37+
"**/.ipynb_checkpoints": true,
38+
"**/.pytest_cache": true,
39+
"**/*pycache*": true
40+
},
41+
"python.formatting.provider": "black",
42+
"python.linting.flake8Args": [
43+
"--max-line-length=88",
44+
"--extend-ignore=E203"
45+
],
46+
"editor.formatOnSave": true,
47+
"editor.codeActionsOnSave": {
48+
"source.organizeImports": true
49+
},
50+
"python.sortImports.args": [
51+
"--multi-line=3",
52+
"--trailing-comma",
53+
"--force-grid-wrap=0",
54+
"--use-parentheses",
55+
"--line-width=88",
56+
],
57+
"markdownlint.config": {
58+
"MD022": false,
59+
"MD024": false,
60+
"MD032": false,
61+
"MD033": false
62+
}
63+
},
64+
// Add the IDs of extensions you want installed when the container is created.
65+
"extensions": [
66+
"ms-python.python",
67+
"ms-python.vscode-pylance",
68+
"ms-azuretools.vscode-docker",
69+
"donjayamanne.githistory",
70+
"felipecaputo.git-project-manager",
71+
"github.copilot-nightly",
72+
"eamodio.gitlens",
73+
"davidanson.vscode-markdownlint"
74+
],
75+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
76+
// "forwardPorts": [],
77+
// Use 'postCreateCommand' to run commands after the container is created.
78+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
79+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
80+
"remoteUser": "vscode",
81+
"features": {
82+
"docker-in-docker": "latest",
83+
"git": "latest",
84+
"git-lfs": "latest",
85+
"github-cli": "latest"
86+
}
87+
}

0 commit comments

Comments
 (0)