Skip to content

Commit

Permalink
test: add marimo tests back
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Oct 29, 2024
1 parent abe511c commit a54bfda
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/downstream_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ jobs:
python-version: ["3.12"]
os: [ubuntu-latest]
# temporarily commented out due to flaky tests
# dependencies: ["core", "core,optional"]
dependencies: ["core"]
dependencies: ["core", "core,optional"]

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -85,7 +84,8 @@ jobs:
- name: install-narwhals-dev
run: |
uv pip uninstall narwhals --system
uv pip install -e . --system
uv pip install narwhals==1.10.0 -y # temporary
# uv pip install -e . --system
- name: show-deps
run: uv pip freeze
- name: Create assets directory, copy over index.html
Expand All @@ -98,6 +98,9 @@ jobs:
if: ${{ matrix.dependencies == 'core,optional' }}
run: |
cd marimo
uv pip install toml --system
python ../utils/add_venv_path_to_hatch_env.py
cat pyproject.toml
hatch run +py=${{ matrix.python-version }} test-optional:test-narwhals
timeout-minutes: 15
- name: Run typechecks
Expand Down
42 changes: 42 additions & 0 deletions utils/add_venv_path_to_hatch_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ruff: noqa
from __future__ import annotations

import toml


def add_venv_path_to_hatch_env(
pyproject_file="pyproject.toml", env_name="default", venv_path="./.venv"
):
try:
# Load the pyproject.toml file
with open(pyproject_file) as file:
data = toml.load(file)

# Navigate to the Hatch environment section
hatch_envs = (
data.setdefault("tool", {}).setdefault("hatch", {}).setdefault("envs", {})
)

# Access the specific environment (default or specified by env_name)
env = hatch_envs.setdefault(env_name, {})

# Check if 'path' is already set, add if missing
if "path" not in env:
env["path"] = venv_path
print(f"Added 'path = \"{venv_path}\"' to [tool.hatch.envs.{env_name}]")
else:
print(f"'path' is already set in [tool.hatch.envs.{env_name}]")

# Write the modified data back to the pyproject.toml file
with open(pyproject_file, "w") as file:
toml.dump(data, file)
print(f"Updated {pyproject_file} successfully.")

except FileNotFoundError:
print(f"Error: {pyproject_file} not found.")
except Exception as e:
print(f"An error occurred: {e}")


# Run the function to modify pyproject.toml
add_venv_path_to_hatch_env()

0 comments on commit a54bfda

Please sign in to comment.