Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a DSL to generate regular expressions #1403

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:
- name: Set up test environment
run: |
python -m pip install --upgrade pip
pip install -e .[test]
pip install uv
uv venv
uv pip install -e .[test]
- name: Create matrix id
id: matrix-id
env:
Expand All @@ -44,7 +46,7 @@ jobs:
echo "::set-output name=id::$MATRIX_ID"
- name: Run tests
run: |
pytest -x --cov=outlines
uv run pytest -x --cov=outlines
env:
COVERAGE_FILE: .coverage.${{ steps.matrix-id.outputs.id }}
- name: Upload coverage data
Expand Down
44 changes: 29 additions & 15 deletions docs/community/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Note that the [issue tracker][issues] is only intended for actionable items. In

First, [fork the repository on GitHub](https://github.com/dottxt-ai/outlines/fork) and clone the fork locally:

```bash
```shell
git clone [email protected]/YourUserName/outlines.git
cd outlines
```
Expand All @@ -27,35 +27,49 @@ Create a new virtual environment:

*If you are using `uv`*:

```bash
```shell
uv venv
source .venv/bin/activate
alias pip="uv pip" # ... or just remember to prepend any pip command with uv in the rest of this guide
```

*If you are using `venv`*:

```bash
```shell
python -m venv .venv
source .venv/bin/activate
```

*If you are using `conda`*:

```bash
```shell
conda env create -f environment.yml
```

Then install the dependencies in editable mode, and install the `pre-commit` hooks:

```bash
```shell
python -m venv .venv
source .venv/bin/activate
```

Then install the dependencies in editable mode, and install the pre-commit hooks:

```shell
pip install -e ".[test]"
pre-commit install
```
If you own a GPU and want to run the vLLM tests you will have to run:

```shell
pip install -e ".[test-gpu]"
```

instead.

Outlines provides optional dependencies for different supported backends, which you can install with

```bash
```shell
pip install ".[vllm]"
```

Expand Down Expand Up @@ -85,13 +99,13 @@ You will not have access to a GPU, but you'll be able to make basic contribution

Run the tests:

```bash
```shell
pytest
```

And run the code style checks:

```bash
```shell
pre-commit run --all-files
```

Expand All @@ -101,7 +115,7 @@ Outlines uses [asv](https://asv.readthedocs.io) for automated benchmark testing.

You can run the benchmark test suite locally with the following command:

```bash
```shell
asv run --config benchmarks/asv.conf.json
```

Expand All @@ -112,19 +126,19 @@ Caveats:

#### Run a specific test:

```bash
```shell
asv run --config benchmarks/asv.conf.json -b bench_json_schema.JsonSchemaBenchmark.time_json_schema_to_fsm
```

#### Profile a specific test:

```bash
```shell
asv run --config benchmarks/asv.conf.json --profile -b bench_json_schema.JsonSchemaBenchmark.time_json_schema_to_fsm
```

#### Compare to `origin/main`

```bash
```shell
get fetch origin
asv continuous origin/main HEAD --config benchmarks/asv.conf.json
```
Expand All @@ -140,13 +154,13 @@ asv continuous origin/main HEAD --config benchmarks/asv.conf.json

To work on the *documentation* you will need to install the related dependencies:

```bash
```shell
pip install -r requirements-doc.txt
```

To build the documentation and serve it locally, run the following command in the repository's root folder:

```bash
```shell
mkdocs serve
```

Expand All @@ -157,7 +171,7 @@ It will be updated every time you make a change.

Create a new branch on your fork, commit and push the changes:

```bash
```shell
git checkout -b new-branch
git add .
git commit -m "Changes I made"
Expand Down
1 change: 0 additions & 1 deletion docs/reference/functions.md

This file was deleted.

Loading
Loading