diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index e7de374652..ad17382e77 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -53,20 +53,12 @@ jobs: with: path: ${{ env.pythonLocation }} key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01 - - name: Install Poetry - if: steps.cache.outputs.cache-hit != 'true' - run: | - python -m pip install --upgrade pip - python -m pip install "poetry" - python -m poetry self add poetry-version-plugin - - name: Configure poetry - run: python -m poetry config virtualenvs.create false - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: python -m poetry install + run: pip install -r requirements-docs.txt - name: Install Material for MkDocs Insiders if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true' - run: python -m poetry run pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git + run: pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git - uses: actions/cache@v3 with: key: mkdocs-cards-${{ github.ref }} diff --git a/.github/workflows/test-redistribute.yml b/.github/workflows/test-redistribute.yml new file mode 100644 index 0000000000..87dca539a4 --- /dev/null +++ b/.github/workflows/test-redistribute.yml @@ -0,0 +1,51 @@ +name: Test Redistribute + +on: + push: + branches: + - main + pull_request: + types: + - opened + - synchronize + +jobs: + test-redistribute: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + # Issue ref: https://github.com/actions/setup-python/issues/436 + # cache: "pip" + # cache-dependency-path: pyproject.toml + - name: Install build dependencies + run: pip install build + - name: Build source distribution + run: python -m build --sdist + - name: Decompress source distribution + run: | + cd dist + tar xvf sqlmodel*.tar.gz + - name: Install test dependencies + run: | + cd dist/sqlmodel-*/ + pip install -r requirements-tests.txt + - name: Run source distribution tests + run: | + cd dist/sqlmodel-*/ + bash scripts/test.sh + - name: Build wheel distribution + run: | + cd dist + pip wheel --no-deps sqlmodel-*.tar.gz + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89da640d15..1fc929594c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,17 +49,9 @@ jobs: with: path: ${{ env.pythonLocation }} key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2 - - name: Install poetry - if: steps.cache.outputs.cache-hit != 'true' - run: | - python -m pip install --upgrade pip - python -m pip install "poetry" - python -m poetry self add poetry-version-plugin - - name: Configure poetry - run: python -m poetry config virtualenvs.create false - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' - run: python -m poetry install + run: pip install -r requirements.txt - name: Install Pydantic v1 if: matrix.pydantic-version == 'pydantic-v1' run: pip install --upgrade "pydantic>=1.10.0,<2.0.0" @@ -69,10 +61,10 @@ jobs: - name: Lint # Do not run on Python 3.7 as mypy behaves differently if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2' - run: python -m poetry run bash scripts/lint.sh + run: bash scripts/lint.sh - run: mkdir coverage - name: Test - run: python -m poetry run bash scripts/test.sh + run: bash scripts/test.sh env: COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index 9da631b985..c24435e5b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,24 +36,6 @@ python = "^3.7" SQLAlchemy = ">=2.0.0,<2.1.0" pydantic = ">=1.10.13,<3.0.0" -[tool.poetry.group.dev.dependencies] -pytest = "^7.0.1" -mypy = "1.4.1" -# Needed by the code generator using templates -black = ">=22.10,<24.0" -mkdocs-material = "9.2.7" -pillow = "^9.3.0" -cairosvg = "^2.5.2" -mdx-include = "^1.4.1" -coverage = {extras = ["toml"], version = ">=6.2,<8.0"} -fastapi = "^0.103.2" -ruff = "0.2.0" -# For FastAPI tests -httpx = "0.24.1" -# TODO: upgrade when deprecating Python 3.7 -dirty-equals = "^0.6.0" -typer-cli = "^0.0.13" -mkdocs-markdownextradata-plugin = ">=0.1.7,<0.3.0" [build-system] requires = ["poetry-core"] diff --git a/requirements-docs.txt b/requirements-docs.txt new file mode 100644 index 0000000000..c47784ffe5 --- /dev/null +++ b/requirements-docs.txt @@ -0,0 +1,19 @@ +-e . + +mkdocs-material==9.4.7 +mdx-include >=1.4.1,<2.0.0 +mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0 +mkdocs-redirects>=1.2.1,<1.3.0 +pyyaml >=5.3.1,<7.0.0 +# For Material for MkDocs, Chinese search +jieba==0.42.1 +# For image processing by Material for MkDocs +pillow==10.1.0 +# For image processing by Material for MkDocs +cairosvg==2.7.0 +mkdocstrings[python]==0.23.0 +griffe-typingdoc==0.2.2 +# For griffe, it formats with black +black==23.3.0 +typer-cli =>0.0.13 +mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0 diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000000..9580b1cd7d --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,16 @@ +-e . + +pytest >=4.4.0,<8.0.0 +pytest-cov >=2.10.0,<5.0.0 +coverage[toml] >=6.2,<8.0 +pytest-xdist >=1.32.0,<4.0.0 +pytest-sugar >=0.9.4,<0.10.0 +mypy ==1.4.1 +ruff ==0.2.0 +black >=22.10,<24.0 +# Needed by the code generator using templates +fastapi =>0.103.2 +# For FastAPI tests +httpx ==0.24.1 +# TODO: upgrade when deprecating Python 3.7 +dirty-equals ==0.6.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..1e21c5d2f3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +-e . + +-r requirements-tests.txt +-r requirements-docs.txt + +pre-commit >=2.17.0,<4.0.0