Skip to content
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
18 changes: 9 additions & 9 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Cache Hugging Face
id: cache-hf
uses: actions/cache@v4
Expand All @@ -47,25 +42,30 @@ jobs:
run: |
sudo apt install pandoc

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.8"

- name: Install dependencies
run: |
pip install .[docs]
uv sync --group docs

- name: Run tests
if: github.event_name != 'workflow_dispatch'
run: |
echo "Testing documentation build..."
python -m sphinx build -b doctest docs/source docs/build/html
make test-docs

- name: Build documentation
if: ${{ github.ref == 'refs/heads/dev' }} && github.event_name != 'workflow_dispatch'
run: |
python -m sphinx build -b html docs/source docs/build/html
make docs

- name: build multiversion documentation
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
run: |
sphinx-multiversion docs/source docs/build/html
make multi-version-docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/check-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.10'
version: "0.8.8"

- name: Install dependencies
run: |
pip install .
uv sync

- name: Generate JSON Schema
run: |
python -m scripts.generate_json_schema_config
uv run python -m scripts.generate_json_schema_config

- name: Check for changes in JSON Schema
id: check_changes
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/reusable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ jobs:
path: ~/.cache/huggingface
key: ${{ runner.os }}-hf

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
version: "0.8.8"

- name: Install dependencies
- name: Install dependencies for Python ${{ matrix.python-version }}
run: |
pip install .[test]
uv python pin ${{ matrix.python-version }}
uv sync --group test

- name: Run tests
run: |
${{ inputs.test_command }}
uv run ${{ inputs.test_command }}
11 changes: 8 additions & 3 deletions .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.8"

- name: Install dependencies
run: |
pip install .[typing]
uv lock
uv sync --group typing

- name: Run mypy
run: mypy autointent
run: uv run mypy src/autointent
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ data/RuBanking77
data/RuClinc150
data/RuSnips
eurlex.json
poetry.lock
uv.lock

indexes_dirnames.json
tests_logs
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Minimum Configuration

We use `poetry` as our dependency manager and packager.
We use `uv` as our dependency manager and packager.

1. Install `poetry`. We recommend referring to the official documentation section [Installation with the official installer](https://python-poetry.org/docs/#installing-with-the-official-installer). In short, you just need to run:
1. Install `uv`. We recommend referring to the documentations on [installing uv](https://docs.astral.sh/uv/#installation). In short, you just need to run:
```bash
curl -sSL https://install.python-poetry.org | python3 -
curl -LsSf https://astral.sh/uv/install.sh | sh
```

2. Clone the project and navigate to the root directory
Expand Down Expand Up @@ -45,7 +45,7 @@ make test
```
Or run a specific test (using `test_bert.py` as an example):
```bash
poetry run pytest tests/modules/scoring/test_bert.py
uv run pytest tests/modules/scoring/test_bert.py
```
- Check code style (it also applies formatter)
```bash
Expand All @@ -57,7 +57,7 @@ make typing
```
Note: If mypy shows different errors locally compared to github actions, you should update your local dependencies:
```bash
make update
make install
```
But it still doesn't guarantee that the local type checker will give the same errors as CI. This is because CI is configured to check on Python 3.10 and your local python version is probably the latest one.

Expand Down
36 changes: 17 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
.PHONY: all
all: lint

.DEFAULT_GOAL := all
Comment thread
Samoed marked this conversation as resolved.
poetry = poetry run

sh = uv run --no-sync --frozen

.PHONY: install
install:
poetry install --extras "dev test typing docs"
rm -rf uv.lock
uv sync --all-groups

.PHONY: test
test:
$(poetry) pytest tests --cov
$(sh) pytest tests --cov

.PHONY: test-html
test-html:
$(poetry) pytest --cov --cov-report html
$(sh) pytest --cov --cov-report html

.PHONY: typing
typing:
$(poetry) mypy autointent
$(sh) mypy src/autointent

.PHONY: lint
lint:
$(poetry) ruff format
$(poetry) ruff check --fix

.PHONY: update
update:
rm -f poetry.lock
poetry install --extras "dev test typing docs"
$(sh) ruff format
$(sh) ruff check --fix

.PHONY: docs
docs:
$(poetry) python -m sphinx build -b html docs/source docs/build/html
$(sh) python -m sphinx build -b html docs/source docs/build/html

.PHONY: test-docs
test-docs:
$(poetry) python -m sphinx build -b doctest docs/source docs/build/html
$(sh) python -m sphinx build -b doctest docs/source docs/build/html

.PHONY: serve-docs
serve-docs:
$(poetry) python -m http.server -d docs/build/html 8333
$(sh) python -m http.server -d docs/build/html 8333

.PHONY: multi-version-docs
multi-version-docs:
$(poetry) sphinx-multiversion docs/source docs/build/html
$(sh) sphinx-multiversion docs/source docs/build/html

.PHONY: clean-docs
clean-docs:
Expand All @@ -51,7 +51,5 @@ clean-docs:

.PHONY: schema
schema:
$(poetry) python -m scripts.generate_json_schema_config
$(sh) python -m scripts.generate_json_schema_config

.PHONY: all
all: lint
Comment thread
Samoed marked this conversation as resolved.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

autoapi_keep_files = True
autoapi_dirs = [Path.cwd().parent.parent / "autointent"]
autoapi_dirs = [Path.cwd().parent.parent / "src/autointent"]
autoapi_options = [
"members",
"undoc-members",
Expand Down
87 changes: 48 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers=[
'Framework :: Sphinx',
'Typing :: Typed',
]
requires-python = ">=3.10,<4.0"
requires-python = ">=3.10,<3.13"
dependencies = [
"sentence-transformers (>=3,<4)",
"scikit-learn (>=1.5,<2.0)",
Expand All @@ -52,11 +52,46 @@ dependencies = [
]

[project.optional-dependencies]
dev = [
"tach (>=0.11.3,<1.0.0)",
dspy = [
"dspy (>=2.6.5,<3.0.0)",
]
wandb = [
"wandb (>=0.19.10,<1.0.0)",
]
codecarbon = [
"codecarbon (==3.0.0)",
"pynvml (>=8.0.4, <12.0.0)", # to avoid "attribute nvmlDeviceGetTotalEnergyConsumption not found" error
]
fastapi = [
"fastapi (>=0.115, <1.0)",
"uvicorn (>=0.24, <1.0)",
"pydantic-settings (>=2.0, <3.0)"
]
fastmcp = [
"pydantic-settings (>=2.0, <3.0)",
"fastmcp (>=2.11.3, <3.0)"
]
opensearch = [
"opensearch-py (>=3.0.0, <4.0.0)",
]

[tool.uv]
conflicts = [
[
{ extra = "codecarbon" },
{ extra = "fastmcp" },
]
]

[dependency-groups]
nb = [
"ipykernel (>=6.29.5,<7.0.0)",
"ipywidgets (>=8.1.5,<9.0.0)",
]
lint = [
"ruff (==0.8.4)",
]
sentencepiece = [
"sentencepiece (>=0.2.0,<0.3.0)",
]
test = [
Expand Down Expand Up @@ -90,28 +125,6 @@ docs = [
"sphinx-toolbox (>=4.0.0,<5.0.0)",
"sphinx-llms-txt (>=0.3.0,<0.4.0)"
]
dspy = [
"dspy (>=2.6.5,<3.0.0)",
]
wandb = [
"wandb (>=0.19.10,<1.0.0)",
]
# codecarbon = [
# "codecarbon (>=3.0.2, <3.1.0)",
# "pynvml (>=8.0.4, <12.0.0)", # to avoid "attribute nvmlDeviceGetTotalEnergyConsumption not found" error
# ]
fastapi = [
"fastapi (>=0.115, <1.0)",
"uvicorn (>=0.24, <1.0)",
"pydantic-settings (>=2.0, <3.0)"
]
fastmcp = [
"pydantic-settings (>=2.0, <3.0)",
"fastmcp (>=2.11.3, <3.0)"
]
opensearch = [
"opensearch-py (>=3.0.0, <4.0.0)",
]

[project.urls]
Homepage = "https://deeppavlov.github.io/AutoIntent/"
Expand All @@ -121,8 +134,10 @@ Documentation = "https://deeppavlov.github.io/AutoIntent/"
[project.scripts]
"basic-aug" = "autointent.generation.utterances.basic.cli:main"
"evolution-aug" = "autointent.generation.utterances.evolution.cli:main"
"autointent-mcp" = "autointent.server.mcp:main"
"autointent-http" = "autointent.server.http:main"

[build-system]
requires = ["uv_build>=0.8.7,<0.9.0"]
build-backend = "uv_build"

[tool.ruff]
line-length = 120
Expand All @@ -145,11 +160,11 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "D104"]
"autointent/__init__.py" = ["I001"]
"autointent/_wrappers/__init__.py" = ["I001"]
"src/autointent/__init__.py" = ["I001"]
"src/autointent/_wrappers/__init__.py" = ["I001"]
"tests/*.py" = ["S", "PLR2004", "ERA", "D", "ANN", "SLF"]
"tests/context/datahandler/test_data_handler.py" = ["PT011"]
"autointent/modules/*" = ["ARG002", "ARG003"] # unused argument
"src/autointent/modules/*" = ["ARG002", "ARG003"] # unused argument
"docs/*" = ["INP001", "A001", "D"]
"*/utils.py" = ["D104", "D100"]
"*user_guides/*" = ["B018", "E501", "INP001", "T", "D", "E402", "I001", "W292", "ANN202", "ANN001", "ANN201", "PLR2004"]
Expand All @@ -160,17 +175,12 @@ max-args = 10
[tool.ruff.lint.pydocstyle]
convention = "google"


[build-system]
requires = ["poetry-core>=2.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
minversion = "8.0"
testpaths = [
"tests",
]
pythonpath = "autointent"
pythonpath = "src/autointent"
# `--cov` option breaks pycharm's test debugger
addopts = """
-m "not transformers"
Expand Down Expand Up @@ -210,7 +220,7 @@ omit = [

[tool.coverage.paths]
source = [
"autointent/",
"src/autointent/",
]

[tool.coverage.report]
Expand All @@ -227,7 +237,7 @@ local_partial_types = true
plugins = [
"pydantic.mypy",
]
mypy_path = "autointent"
mypy_path = "src/autointent"
disable_error_code = ["override"]

[[tool.mypy.overrides]]
Expand Down Expand Up @@ -268,4 +278,3 @@ module = [
"autointent.server.mcp",
]
ignore_errors = true

Loading
Loading