diff --git a/.github/actions/build-prql-python/action.yaml b/.github/actions/build-prql-python/action.yaml index a89e44b4f52c..731a2b24f1be 100644 --- a/.github/actions/build-prql-python/action.yaml +++ b/.github/actions/build-prql-python/action.yaml @@ -10,7 +10,7 @@ inputs: runs: using: composite steps: - # There's no point caching here, because the maturin action uses a container. + # There's benefit from caching here, because the maturin action uses a container. - uses: messense/maturin-action@v1 if: inputs.target == 'source' with: @@ -28,12 +28,16 @@ runs: with: command: build args: --release -o target/python -m prqlc/bindings/python/Cargo.toml + - name: Add targets for MacOS universal + if: runner.os == 'macOS' && inputs.target != 'source' + shell: bash + run: rustup target add aarch64-apple-darwin - uses: messense/maturin-action@v1 if: runner.os == 'macOS' && inputs.target != 'source' with: command: build args: - --release -o target/python --universal2 -m + --release -o target/python --target=universal2-apple-darwin -m prqlc/bindings/python/Cargo.toml - name: Upload wheels uses: actions/upload-artifact@v3 diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index b904a48898ec..4e35231f1fc8 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -31,7 +31,7 @@ jobs: path: target/python - uses: actions/setup-python@v5 with: - python-version: "3.7" + python-version: "3.8" - uses: actions/setup-python@v5 with: python-version: "3.11" @@ -42,9 +42,7 @@ jobs: uses: actions/cache@v3 with: path: .nox - key: - nox-${{ hashFiles('prql-python/noxfile.py') }}-${{ - hashFiles('prql-python/requirements.txt') }} + key: nox-${{ hashFiles('prqlc/bindings/python/pyproject.toml') }} - name: Run tests and typing shell: bash run: nox -s tests typing -f prqlc/bindings/python/noxfile.py diff --git a/prqlc/bindings/python/noxfile.py b/prqlc/bindings/python/noxfile.py index 7a1b350857b2..7940ee2eb880 100644 --- a/prqlc/bindings/python/noxfile.py +++ b/prqlc/bindings/python/noxfile.py @@ -7,7 +7,7 @@ from nox.sessions import Session VERSIONS: List[str] = [ - "3.7", + "3.8", "3.11", ] @@ -18,9 +18,12 @@ def _install_prql_python(session: Session) -> None: session.install( "-v", - "--no-index", + # We'd like to prevent `prql_python` from being installed from PyPI, but we do + # want to install its dependencies from there, and currently there's no way in + # plain pip of doing that (https://github.com/pypa/pip/issues/11440). + # "--no-index", f"--find-links={Path('..', '..', '..', 'target', 'python')}", - "prql_python", + "prql_python[test]", ) @@ -29,7 +32,6 @@ def tests(session: Session) -> None: """Run the test suite with pytest.""" print("CWD", os.getcwd()) _install_prql_python(session) - session.install("-v", "-r", "requirements.txt") session.run("pytest", str(Path("python", "tests"))) @@ -37,5 +39,4 @@ def tests(session: Session) -> None: def typing(session: Session) -> None: """Check types with mypy""" _install_prql_python(session) - session.install("mypy==1.4.0") session.run("mypy") diff --git a/prqlc/bindings/python/pyproject.toml b/prqlc/bindings/python/pyproject.toml index e90a3fae2621..942658bb89ab 100644 --- a/prqlc/bindings/python/pyproject.toml +++ b/prqlc/bindings/python/pyproject.toml @@ -1,6 +1,6 @@ [build-system] build-backend = "maturin" -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=1.0,<2.0"] [project] classifiers = [ @@ -9,7 +9,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] name = "prql-python" -requires-python = ">=3.7" +requires-python = ">=3.8" [tool.maturin] # This is required because of https://github.com/PyO3/pyo3/pull/2135. Instead of @@ -21,6 +21,12 @@ requires-python = ">=3.7" features = ["pyo3/extension-module"] +[project.optional-dependencies] +test = [ + "pytest >= 7", + "mypy == 1.8.0", +] + [tool.ruff] fix = true ignore = [ @@ -30,12 +36,6 @@ ignore = [ "E731", ] -[[tool.mypy.overrides]] -ignore_missing_imports = true -module = [ - "pytest.*", -] - [tool.mypy] files = "." show_error_codes = true @@ -44,4 +44,7 @@ warn_unused_ignores = true [[tool.mypy.overrides]] ignore_missing_imports = true -module = "nox.*" +module = [ + "pytest.*", + "nox.*", +] diff --git a/prqlc/bindings/python/requirements.txt b/prqlc/bindings/python/requirements.txt deleted file mode 100644 index a01035fe40dc..000000000000 --- a/prqlc/bindings/python/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest==7.4.4 -pytest-xdist==3.5.0 -pytest-clarity==1.0.1