Skip to content

Commit

Permalink
chore: rename package to supabase_auth (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks authored Mar 25, 2024
2 parents cacb4b6 + 54a5bc1 commit 3b63cd6
Show file tree
Hide file tree
Showing 34 changed files with 538 additions and 462 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ jobs:
needs: test
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/main' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.repository_owner == 'supabase-community' }}
runs-on: ubuntu-latest
name: "Bump version, create changelog and publish"
name: "supabase_auth: Bump version, create changelog and publish"
environment:
name: pypi
url: https://pypi.org/p/gotrue
url: https://pypi.org/p/supabase_auth
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for dependabot to write to repo
outputs:
is-released: ${{ steps.release.outputs.released }}
steps:
- name: Clone Repository
uses: actions/checkout@v4
Expand All @@ -75,3 +77,49 @@ jobs:
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_legacy:
needs: publish
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/main' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.repository_owner == 'supabase-community' }}
runs-on: ubuntu-latest
name: "gotrue: Bump version and publish"
environment:
name: pypi
url: https://pypi.org/p/gotrue
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for github actions bot to write to repo
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
token: ${{ secrets.SILENTWORKS_PAT }}

- name: Rename Project
id: rename_project
run: make rename_project

- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install

- name: Build package distribution directory
id: build_dist
run: make build_package

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: needs.publish.outputs.is-released == 'true'
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ sync_infra:
run_tests: run_infra sleep tests

build_sync:
poetry run unasync gotrue tests
poetry run unasync supabase_auth tests

build_run_tests: build_sync run_tests
echo "Done"

sleep:
sleep 20

rename_project: rename_package_dir rename_package

rename_package_dir:
mv supabase_auth gotrue

rename_package:
sed -i 's/supabase_auth/gotrue/g' pyproject.toml tests/_async/clients.py tests/_sync/clients.py tests/_async/test_gotrue_admin_api.py tests/_sync/test_gotrue_admin_api.py tests/_async/test_utils.py tests/_sync/test_utils.py tests/_async/utils.py tests/_sync/utils.py README.md

build_package:
poetry build
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ This is a Python port of the [supabase js gotrue client](https://github.com/supa

## Installation

We are still working on making the `gotrue` python library more user-friendly. For now here are some sparse notes on how to install the module.
We are still working on making the `supabase_auth` python library more user-friendly. For now here are some sparse notes on how to install the module.

### Poetry

```bash
poetry add gotrue
poetry add supabase_auth
```

### Pip

```bash
pip install gotrue
pip install supabase_auth
```

## Differences to the JS client
Expand All @@ -46,7 +46,7 @@ const { data, error } = client.sign_up(...)

The other key difference is we do not use pascalCase to encode variable and method names. Instead we use the snake_case convention adopted in the Python language.

Also, the `gotrue` library for Python parses the date-time string into `datetime` Python objects. The [JS client](https://github.com/supabase/gotrue-js) keeps the date-time as strings.
Also, the `supabase_auth` library for Python parses the date-time string into `datetime` Python objects. The [JS client](https://github.com/supabase/gotrue-js) keeps the date-time as strings.

## Usage (outdated)

Expand All @@ -55,7 +55,7 @@ Also, the `gotrue` library for Python parses the date-time string into `datetime
To instantiate the client, you'll need the URL and any request headers at a minimum.

```python
from gotrue import SyncGoTrueClient
from supabase_auth import SyncGoTrueClient

headers = {
"apiKey": "my-mega-awesome-api-key",
Expand Down
Loading

0 comments on commit 3b63cd6

Please sign in to comment.