diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..b0d2cb5b --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,65 @@ +name: Run tests + +env: + # enable colored output + # https://github.com/pytest-dev/pytest/issues/7443 + PY_COLORS: 1 + +on: + push: + branches: ["main"] + paths: + - .github/workflows/run-tests.yml + - src/** + - tests/** + - pyproject.toml + - setup.py + + pull_request: + paths: + - .github/workflows/run-tests.yml + - src** + - tests/** + - pyproject.toml + - setup.py + + workflow_dispatch: + +permissions: + contents: read + +jobs: + run_tests: + name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + timeout-minutes: 15 + strategy: + matrix: + # run no_llm tests across all python versions and oses + # os: [ubuntu-latest, macos-latest, windows-latest] + # python-version: ['3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest] + python-version: ['3.9'] + + + runs-on: ${{ matrix.os }} + + env: + CONTROLFLOW_OPENAI_API_KEY: ${{ secrets.CONTROLFLOW_OPENAI_API_KEY }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: download uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Install ControlFlow + run: uv pip install --system ".[tests]" + + - name: Run tests + run: pytest -n auto -vv + if: ${{ !(github.event.pull_request.head.repo.fork) }} \ No newline at end of file diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..18f6d773 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,31 @@ +name: Run static analysis + +env: + # enable colored output + # https://github.com/pytest-dev/pytest/issues/7443 + PY_COLORS: 1 + +on: + push: + branches: ["main"] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + + static_analysis: + timeout-minutes: 1 + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/pyproject.toml b/pyproject.toml index c49e5f13..b9892c38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,9 @@ authors = [ { name = "Jeremiah Lowin", email = "153965+jlowin@users.noreply.github.com" } ] dependencies = [ - "marvin>=2.3.1", + "marvin @ git+https://github.com/prefecthq/marvin@main", "prefect @ git+https://github.com/prefecthq/prefect@main", + # can remove when prefect fully migrates to pydantic 2 "pydantic>=2", ] readme = "README.md" @@ -17,19 +18,30 @@ keywords = ["ai", "chatbot", "llm", "NLP", "natural language processing", "prefe [project.urls] Code = "https://github.com/jlowin/ControlFlow" +[project.optional-dependencies] +tests = [ + "pytest-asyncio>=0.18.2,!=0.22.0,<0.23.0", + "pytest-env>=0.8,<2.0", + "pytest-rerunfailures>=10,<14", + "pytest-sugar>=0.9,<2.0", + "pytest>=8.1.1", + "pytest-timeout", + "pytest-xdist", + "pre-commit>=3.7.0", +] +dev = [ + "control_flow[tests]", + "ipython>=8.22.2", + "pdbpp>=0.10.3", + "ruff>=0.3.4", +] + [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [tool.rye] -managed = true -dev-dependencies = [ - "ipython>=8.22.2", - "pdbpp>=0.10.3", - "pre-commit>=3.7.0", - "ruff>=0.3.4", - "pytest>=8.1.1", -] +managed = true [tool.hatch.metadata] allow-direct-references = true