-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
103 changed files
with
3,710 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Keep GitHub Actions up to date with GitHub's Dependabot... | ||
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" # Group all Actions updates into a single larger pull request | ||
schedule: | ||
interval: monthly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,13 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- uses: actions/setup-node@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
|
@@ -29,47 +29,88 @@ jobs: | |
|
||
- run: npm install | ||
|
||
- uses: pre-commit/[email protected].0 | ||
- uses: pre-commit/[email protected].1 | ||
with: | ||
extra_args: --all-files | ||
env: | ||
SKIP: no-commit-to-branch | ||
|
||
docs-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
# note: PPPR_TOKEN is not available on PRs sourced from forks, but the necessary | ||
# dependencies are also listed in docs.txt :) | ||
- name: install | ||
run: | | ||
pip install --upgrade pip | ||
pip install --extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ mkdocs-material mkdocstrings-python | ||
pip install -r requirements/docs.txt | ||
# note -- we can use these in the future when mkdocstrings-typescript and griffe-typedoc beocome publicly available | ||
# pip install --extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ mkdocs-material mkdocstrings-python griffe-typedoc mkdocstrings-typescript | ||
# npm install | ||
# npm install -g typedoc | ||
env: | ||
PPPR_TOKEN: ${{ secrets.PPPR_TOKEN }} | ||
|
||
- name: build site | ||
run: mkdocs build --strict | ||
|
||
test: | ||
name: test ${{ matrix.python-version }} on ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu, macos] | ||
os: [ubuntu-latest, macos-13, macos-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
runs-on: ${{ matrix.os }}-latest | ||
exclude: | ||
# Python 3.8 and 3.9 are not available on macOS 14 | ||
- os: macos-13 | ||
python-version: '3.10' | ||
- os: macos-13 | ||
python-version: '3.11' | ||
- os: macos-13 | ||
python-version: '3.12' | ||
- os: macos-latest | ||
python-version: '3.8' | ||
- os: macos-latest | ||
python-version: '3.9' | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
PYTHON: ${{ matrix.python-version }} | ||
OS: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- run: pip install -r src/python-fastui/requirements/test.txt | ||
- run: pip install -r src/python-fastui/requirements/pyproject.txt | ||
- run: pip install src/python-fastui | ||
- run: pip install -e src/python-fastui | ||
|
||
- run: coverage run -m pytest src | ||
# display coverage and fail if it's below 80%, which shouldn't happen | ||
- run: coverage report --fail-under=80 | ||
|
||
# test demo on 3.11 and 3.12, these tests are intentionally omitted from coverage | ||
- if: matrix.python-version == '3.11' || matrix.python-version == '3.12' | ||
run: pytest demo/tests.py | ||
|
||
- run: coverage xml | ||
|
||
- uses: codecov/codecov-action@v3 | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
file: ./coverage.xml | ||
env_vars: PYTHON,OS | ||
|
@@ -78,9 +119,9 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
|
@@ -110,9 +151,9 @@ jobs: | |
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
python3 -V | ||
|
||
python3 -m pip install --extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ mkdocs-material mkdocstrings-python | ||
python3 -m pip install -r ./requirements/docs.txt | ||
# note -- we can use these in the future when mkdocstrings-typescript and griffe-typedoc beocome publicly available | ||
# python3 -m pip install --extra-index-url https://pydantic:[email protected]/simple/ mkdocs-material mkdocstrings-python griffe-typedoc mkdocstrings-typescript | ||
# npm install | ||
# npm install -g typedoc | ||
|
||
python3 -m mkdocs build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
from __future__ import annotations | ||
|
||
import json | ||
import re | ||
from pathlib import Path | ||
|
||
|
||
def replace_package_json(package_json: Path, new_version: str, deps: bool = False) -> tuple[Path, str]: | ||
content = package_json.read_text() | ||
content, r_count = re.subn(r'"version": *".*?"', f'"version": "{new_version}"', content, count=1) | ||
assert r_count == 1 , f'Failed to update version in {package_json}, expect replacement count 1, got {r_count}' | ||
if deps: | ||
content, r_count = re.subn(r'"(@pydantic/.+?)": *".*?"', fr'"\1": "{new_version}"', content) | ||
assert r_count == 1, f'Failed to update version in {package_json}, expect replacement count 1, got {r_count}' | ||
|
||
return package_json, content | ||
|
||
|
||
def main(): | ||
this_dir = Path(__file__).parent | ||
fastui_package_json = this_dir / 'src/npm-fastui/package.json' | ||
with fastui_package_json.open() as f: | ||
old_version = json.load(f)['version'] | ||
|
||
rest, patch_version = old_version.rsplit('.', 1) | ||
new_version = f'{rest}.{int(patch_version) + 1}' | ||
bootstrap_package_json = this_dir / 'src/npm-fastui-bootstrap/package.json' | ||
prebuilt_package_json = this_dir / 'src/npm-fastui-prebuilt/package.json' | ||
to_update: list[tuple[Path, str]] = [ | ||
replace_package_json(fastui_package_json, new_version), | ||
replace_package_json(bootstrap_package_json, new_version, deps=True), | ||
replace_package_json(prebuilt_package_json, new_version), | ||
] | ||
|
||
python_init = this_dir / 'src/python-fastui/fastui/__init__.py' | ||
python_content = python_init.read_text() | ||
python_content, r_count = re.subn(r"(_PREBUILT_VERSION = )'.+'", fr"\1'{new_version}'", python_content) | ||
assert r_count == 1, f'Failed to update version in {python_init}, expect replacement count 1, got {r_count}' | ||
to_update.append((python_init, python_content)) | ||
|
||
# logic is finished, no update all files | ||
print(f'Updating files:') | ||
for package_json, content in to_update: | ||
print(f' {package_json.relative_to(this_dir)}') | ||
package_json.write_text(content) | ||
|
||
print(f""" | ||
Bumped from `{old_version}` to `{new_version}` in {len(to_update)} files. | ||
To publish the new version, run: | ||
> npm --workspaces publish | ||
""") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.