deepl-haystack 0.2.1__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepl_haystack-0.3.0/.github/dependabot.yml +52 -0
- deepl_haystack-0.3.0/.github/workflows/bump.yml +113 -0
- deepl_haystack-0.3.0/.github/workflows/lint.yml +25 -0
- deepl_haystack-0.3.0/.github/workflows/publish.yml +20 -0
- deepl_haystack-0.3.0/.github/workflows/release.yml +30 -0
- deepl_haystack-0.3.0/.github/workflows/test.yml +57 -0
- deepl_haystack-0.3.0/.gitignore +114 -0
- deepl_haystack-0.3.0/.pre-commit-config.yaml +48 -0
- deepl_haystack-0.3.0/Makefile +97 -0
- {deepl_haystack-0.2.1 → deepl_haystack-0.3.0}/PKG-INFO +40 -36
- {deepl_haystack-0.2.1 → deepl_haystack-0.3.0}/README.md +22 -18
- deepl_haystack-0.3.0/deepl_haystack/components.py +412 -0
- deepl_haystack-0.3.0/pyproject.toml +153 -0
- deepl_haystack-0.3.0/tests/__init__.py +1 -0
- deepl_haystack-0.3.0/tests/conftest.py +51 -0
- deepl_haystack-0.3.0/tests/test_deepl_document_translator.py +368 -0
- deepl_haystack-0.3.0/tests/test_deepl_haystack_init.py +39 -0
- deepl_haystack-0.3.0/tests/test_deepl_text_translator.py +377 -0
- deepl_haystack-0.3.0/uv.lock +1597 -0
- deepl_haystack-0.2.1/deepl_haystack/components.py +0 -205
- deepl_haystack-0.2.1/pyproject.toml +0 -112
- {deepl_haystack-0.2.1 → deepl_haystack-0.3.0}/LICENSE +0 -0
- {deepl_haystack-0.2.1 → deepl_haystack-0.3.0}/deepl_haystack/__init__.py +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "github-actions"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
12
|
+
groups:
|
|
13
|
+
all:
|
|
14
|
+
patterns:
|
|
15
|
+
- "*"
|
|
16
|
+
commit-message:
|
|
17
|
+
prefix: ":arrow_up:"
|
|
18
|
+
|
|
19
|
+
- package-ecosystem: "pip"
|
|
20
|
+
target-branch: "main"
|
|
21
|
+
directory: "/" # Location of package manifests
|
|
22
|
+
schedule:
|
|
23
|
+
interval: "weekly"
|
|
24
|
+
allow:
|
|
25
|
+
- dependency-type: "direct"
|
|
26
|
+
dependency-name: "deepl"
|
|
27
|
+
- dependency-type: "direct"
|
|
28
|
+
dependency-name: "haystack-ai"
|
|
29
|
+
groups:
|
|
30
|
+
all:
|
|
31
|
+
patterns:
|
|
32
|
+
- "*"
|
|
33
|
+
commit-message:
|
|
34
|
+
prefix: ":arrow_up:"
|
|
35
|
+
versioning-strategy: "lockfile-only"
|
|
36
|
+
|
|
37
|
+
- package-ecosystem: "pip"
|
|
38
|
+
directory: "/" # Location of package manifests
|
|
39
|
+
schedule:
|
|
40
|
+
interval: "weekly"
|
|
41
|
+
allow:
|
|
42
|
+
- dependency-type: "all"
|
|
43
|
+
ignore:
|
|
44
|
+
- dependency-name: "deepl"
|
|
45
|
+
- dependency-name: "haystack-ai"
|
|
46
|
+
groups:
|
|
47
|
+
all:
|
|
48
|
+
patterns:
|
|
49
|
+
- "*"
|
|
50
|
+
commit-message:
|
|
51
|
+
prefix: ":arrow_up:"
|
|
52
|
+
versioning-strategy: "increase"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
name: Bump
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: 'Version to release'
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- 'major'
|
|
12
|
+
- 'minor'
|
|
13
|
+
- 'patch'
|
|
14
|
+
default: 'patch'
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
create-release-branch:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: 'write'
|
|
21
|
+
id-token: 'write'
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v6
|
|
26
|
+
with:
|
|
27
|
+
enable-cache: true
|
|
28
|
+
- name: Bump version
|
|
29
|
+
id: bump-version
|
|
30
|
+
run: |
|
|
31
|
+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
32
|
+
git config --local user.name "github-actions[bot]"
|
|
33
|
+
make bump-version COMMIT_VERSION=${{ github.event.inputs.version }}
|
|
34
|
+
NEW_VERSION=v$(uv version --dry-run --short)
|
|
35
|
+
git tag -d $NEW_VERSION 2> /dev/null
|
|
36
|
+
echo "::add-mask::$NEW_VERSION"
|
|
37
|
+
echo "new-version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
|
38
|
+
- name: Push branch
|
|
39
|
+
uses: ad-m/github-push-action@master
|
|
40
|
+
with:
|
|
41
|
+
branch: release/${{ steps.bump-version.outputs.new-version }}
|
|
42
|
+
- name: Encrypt tag
|
|
43
|
+
id: encrypt-tag
|
|
44
|
+
shell: bash
|
|
45
|
+
run: |
|
|
46
|
+
NEW_VERSION=${{ steps.bump-version.outputs.new-version }};
|
|
47
|
+
BINARY_ENCRYPTED_SECRET=$(echo -n "$NEW_VERSION" | openssl enc -e -a -k "password" | base64);
|
|
48
|
+
echo "encrypted-version=$BINARY_ENCRYPTED_SECRET" >> $GITHUB_OUTPUT
|
|
49
|
+
outputs:
|
|
50
|
+
encrypted-version: ${{ steps.encrypt-tag.outputs.encrypted-version }}
|
|
51
|
+
|
|
52
|
+
create-pull-request:
|
|
53
|
+
needs: [create-release-branch]
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
permissions:
|
|
56
|
+
pull-requests: 'write'
|
|
57
|
+
contents: 'write'
|
|
58
|
+
id-token: 'write'
|
|
59
|
+
steps:
|
|
60
|
+
- name: Decrypt tag
|
|
61
|
+
id: decrypt-tag
|
|
62
|
+
shell: bash
|
|
63
|
+
run: |
|
|
64
|
+
ENCRYPTED_SECRET=${{ needs.create-release-branch.outputs.encrypted-version }};
|
|
65
|
+
VERSION=$(echo -n "$ENCRYPTED_SECRET" | base64 --decode | openssl enc -d -a -k "password");
|
|
66
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
67
|
+
- uses: actions/checkout@v4
|
|
68
|
+
with:
|
|
69
|
+
ref: main
|
|
70
|
+
- name: Reset release branch
|
|
71
|
+
run: |
|
|
72
|
+
git fetch origin release/${{ steps.decrypt-tag.outputs.version }}:release/${{ steps.decrypt-tag.outputs.version }}
|
|
73
|
+
git reset --hard release/${{ steps.decrypt-tag.outputs.version }}
|
|
74
|
+
- name: Generate token for release bot
|
|
75
|
+
uses: actions/create-github-app-token@v2
|
|
76
|
+
id: generate-token
|
|
77
|
+
with:
|
|
78
|
+
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
|
|
79
|
+
private-key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}
|
|
80
|
+
- name: Create Pull Request
|
|
81
|
+
id: cpr
|
|
82
|
+
uses: peter-evans/create-pull-request@v7
|
|
83
|
+
with:
|
|
84
|
+
token: ${{ steps.generate-token.outputs.token }}
|
|
85
|
+
commit-message: ":label: Version bump to ${{ steps.decrypt-tag.outputs.version }}"
|
|
86
|
+
base: ${{ github.ref_name }}
|
|
87
|
+
branch: release/${{ steps.decrypt-tag.outputs.version }}-merge
|
|
88
|
+
delete-branch: true
|
|
89
|
+
title: ":label: Version bump to ${{ steps.decrypt-tag.outputs.version }}"
|
|
90
|
+
reviewers: ${{ github.actor }}
|
|
91
|
+
|
|
92
|
+
delete-release-branch:
|
|
93
|
+
if: ${{ ! inputs.keep-release-branch }}
|
|
94
|
+
needs: [create-release-branch, create-pull-request]
|
|
95
|
+
runs-on: ubuntu-latest
|
|
96
|
+
permissions:
|
|
97
|
+
pull-requests: 'write'
|
|
98
|
+
contents: 'write'
|
|
99
|
+
id-token: 'write'
|
|
100
|
+
steps:
|
|
101
|
+
- name: Decrypt tag
|
|
102
|
+
id: decrypt-tag
|
|
103
|
+
shell: bash
|
|
104
|
+
run: |
|
|
105
|
+
ENCRYPTED_SECRET=${{ needs.create-release-branch.outputs.encrypted-version }};
|
|
106
|
+
VERSION=$(echo -n "$ENCRYPTED_SECRET" | base64 --decode | openssl enc -d -a -k "password");
|
|
107
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
108
|
+
- uses: actions/checkout@v4
|
|
109
|
+
with:
|
|
110
|
+
fetch-depth: 0
|
|
111
|
+
- name: Delete release branch
|
|
112
|
+
run: |
|
|
113
|
+
git push origin --delete release/${{ steps.decrypt-tag.outputs.version }}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize]
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.12'
|
|
21
|
+
enable-cache: true
|
|
22
|
+
- name: Install Dependencies
|
|
23
|
+
run: uv sync --no-default-groups --group ci --group lint
|
|
24
|
+
- name: Lint
|
|
25
|
+
run: make lint
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v6
|
|
15
|
+
with:
|
|
16
|
+
enable-cache: true
|
|
17
|
+
- name: Build
|
|
18
|
+
run: uv build --no-sources
|
|
19
|
+
- name: Publish
|
|
20
|
+
run: uv publish --token ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
create-release:
|
|
10
|
+
if: contains(github.event.head_commit.message, 'dribia/release/v') && contains(github.event.head_commit.message, '-merge')
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: 'write'
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
- name: Get release tag
|
|
18
|
+
id: get-tag
|
|
19
|
+
run: |
|
|
20
|
+
TAG=$(echo "${{ github.event.head_commit.message }}" | head -n1 | cut -d"/" -f3 | cut -d"-" -f1);
|
|
21
|
+
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
22
|
+
- name: Release
|
|
23
|
+
uses: softprops/action-gh-release@v2
|
|
24
|
+
with:
|
|
25
|
+
generate_release_notes: true
|
|
26
|
+
make_latest: true
|
|
27
|
+
tag_name: ${{ steps.get-tag.outputs.tag }}
|
|
28
|
+
draft: true
|
|
29
|
+
outputs:
|
|
30
|
+
tag: ${{ steps.get-tag.outputs.tag }}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize]
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
unit-tests:
|
|
14
|
+
name: Unit Tests
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
os: [ubuntu-latest]
|
|
19
|
+
fail-fast: false
|
|
20
|
+
runs-on: ${{ matrix.os }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v6
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
enable-cache: true
|
|
28
|
+
- name: Install Dependencies
|
|
29
|
+
run: uv sync --no-default-groups --group ci --group test
|
|
30
|
+
- name: Test
|
|
31
|
+
run: make test-unit
|
|
32
|
+
- uses: codecov/codecov-action@v4
|
|
33
|
+
with:
|
|
34
|
+
fail_ci_if_error: true
|
|
35
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
36
|
+
|
|
37
|
+
integration-tests:
|
|
38
|
+
name: Integration Tests
|
|
39
|
+
needs: unit-tests
|
|
40
|
+
strategy:
|
|
41
|
+
matrix:
|
|
42
|
+
python-version: [ "3.13" ]
|
|
43
|
+
os: [ ubuntu-latest ]
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
env:
|
|
46
|
+
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- name: Install uv
|
|
50
|
+
uses: astral-sh/setup-uv@v6
|
|
51
|
+
with:
|
|
52
|
+
python-version: ${{ matrix.python-version }}
|
|
53
|
+
enable-cache: true
|
|
54
|
+
- name: Install Dependencies
|
|
55
|
+
run: uv sync --no-default-groups --group ci --group test
|
|
56
|
+
- name: Test
|
|
57
|
+
run: make test-integration
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
.static_storage/
|
|
56
|
+
.media/
|
|
57
|
+
local_settings.py
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation
|
|
67
|
+
docs/sphinx/build/
|
|
68
|
+
docs/sphinx/source/api/
|
|
69
|
+
docs/sphinx/source/README.rst
|
|
70
|
+
docs/sphinx/source/LICENSE.rst
|
|
71
|
+
docs/sphinx/source/thirdparty.rst
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# pyenv
|
|
80
|
+
.python-version
|
|
81
|
+
|
|
82
|
+
# celery beat schedule file
|
|
83
|
+
celerybeat-schedule
|
|
84
|
+
|
|
85
|
+
# SageMath parsed files
|
|
86
|
+
*.sage.py
|
|
87
|
+
|
|
88
|
+
# Environments
|
|
89
|
+
.env
|
|
90
|
+
.venv
|
|
91
|
+
env/
|
|
92
|
+
venv/
|
|
93
|
+
ENV/
|
|
94
|
+
env.bak/
|
|
95
|
+
venv.bak/
|
|
96
|
+
|
|
97
|
+
# Spyder project settings
|
|
98
|
+
.spyderproject
|
|
99
|
+
.spyproject
|
|
100
|
+
|
|
101
|
+
# Rope project settings
|
|
102
|
+
.ropeproject
|
|
103
|
+
|
|
104
|
+
# mkdocs documentation
|
|
105
|
+
/site
|
|
106
|
+
|
|
107
|
+
# mypy
|
|
108
|
+
.mypy_cache/
|
|
109
|
+
|
|
110
|
+
# pycharm
|
|
111
|
+
.idea/
|
|
112
|
+
|
|
113
|
+
# sqlite databases files
|
|
114
|
+
data/db/*db
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
default_install_hook_types:
|
|
2
|
+
- pre-commit
|
|
3
|
+
- post-checkout
|
|
4
|
+
- post-merge
|
|
5
|
+
- post-rewrite
|
|
6
|
+
repos:
|
|
7
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
+
rev: v6.0.0
|
|
9
|
+
hooks:
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: check-json
|
|
12
|
+
- id: check-toml
|
|
13
|
+
- id: check-added-large-files
|
|
14
|
+
args:
|
|
15
|
+
- --maxkb=500
|
|
16
|
+
- id: end-of-file-fixer
|
|
17
|
+
- id: trailing-whitespace
|
|
18
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
19
|
+
rev: 0.8.14
|
|
20
|
+
hooks:
|
|
21
|
+
- id: uv-lock
|
|
22
|
+
- id: uv-sync
|
|
23
|
+
args: ["--locked", "--all-packages"]
|
|
24
|
+
- repo: https://github.com/dribia/sync-with-uv
|
|
25
|
+
rev: v0.1.1
|
|
26
|
+
hooks:
|
|
27
|
+
- id: sync-with-uv
|
|
28
|
+
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
29
|
+
rev: 0.33.3
|
|
30
|
+
hooks:
|
|
31
|
+
- id: check-github-workflows
|
|
32
|
+
- repo: https://github.com/mrtazz/checkmake.git
|
|
33
|
+
rev: 0.2.2
|
|
34
|
+
hooks:
|
|
35
|
+
- id: checkmake
|
|
36
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
37
|
+
rev: v0.12.11
|
|
38
|
+
hooks:
|
|
39
|
+
- id: ruff-check
|
|
40
|
+
types_or: [ python, pyi ]
|
|
41
|
+
args:
|
|
42
|
+
- --fix
|
|
43
|
+
- id: ruff-format
|
|
44
|
+
types_or: [ python, pyi ]
|
|
45
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
46
|
+
rev: v1.17.1
|
|
47
|
+
hooks:
|
|
48
|
+
- id: mypy
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.PHONY: all clean check format lint lock test test-unit test-integration
|
|
2
|
+
|
|
3
|
+
PROJECT ?= deepl_haystack
|
|
4
|
+
TESTS ?= tests
|
|
5
|
+
|
|
6
|
+
all:
|
|
7
|
+
make clean
|
|
8
|
+
make lint || exit 1
|
|
9
|
+
make test || exit 1
|
|
10
|
+
|
|
11
|
+
clean:
|
|
12
|
+
rm -rf .pytest_cache
|
|
13
|
+
rm -rf .mypy_cache
|
|
14
|
+
rm -rf .ruff_cache
|
|
15
|
+
|
|
16
|
+
check: format lint
|
|
17
|
+
|
|
18
|
+
format:
|
|
19
|
+
uv run ruff format $(PROJECT) tests
|
|
20
|
+
uv run ruff check --fix --unsafe-fixes $(PROJECT) $(TESTS)
|
|
21
|
+
|
|
22
|
+
--check-git-status:
|
|
23
|
+
@status=$$(git status --porcelain); \
|
|
24
|
+
if [ -n "$${status}" ]; \
|
|
25
|
+
then \
|
|
26
|
+
echo "ERROR:\n GIT status is not clean.\
|
|
27
|
+
\n Commit or discard your changes before using this script."; \
|
|
28
|
+
exit 1; \
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
lint:
|
|
32
|
+
uv run ruff format --check $(PROJECT) $(TESTS)
|
|
33
|
+
uv run ruff check $(PROJECT) $(TESTS)
|
|
34
|
+
uv run mypy $(PROJECT)
|
|
35
|
+
|
|
36
|
+
lock:
|
|
37
|
+
uv lock --no-upgrade
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
uv run pytest --cov --cov-report=html --cov-report=xml
|
|
41
|
+
|
|
42
|
+
test-unit:
|
|
43
|
+
uv run pytest --cov --cov-report=html --cov-report=xml -m "not integration"
|
|
44
|
+
|
|
45
|
+
test-integration:
|
|
46
|
+
uv run pytest -m "integration"
|
|
47
|
+
|
|
48
|
+
bump-version:
|
|
49
|
+
@make -- --check-git-status
|
|
50
|
+
@old_version=$$(uv version --dry-run --short); echo "Current version: $${old_version}"; \
|
|
51
|
+
bmp_vrs=$(COMMIT_VERSION); \
|
|
52
|
+
case $${bmp_vrs} in \
|
|
53
|
+
major|minor|patch) echo "Version bumping: $${bmp_vrs}"; uv version --bump $${bmp_vrs}; ;; \
|
|
54
|
+
*) echo "New version provided: $${bmp_vrs}"; uv version "$${bmp_vrs}"; ;; \
|
|
55
|
+
esac; \
|
|
56
|
+
new_version=$$(uv version --dry-run --short); \
|
|
57
|
+
if [ "$${new_version}" = "$${old_version}" ]; then \
|
|
58
|
+
echo "$${old_version} version update did not change the version number."; \
|
|
59
|
+
exit 0; \
|
|
60
|
+
else \
|
|
61
|
+
uv sync; \
|
|
62
|
+
uv run git commit pyproject.toml uv.lock -m ":bookmark: Bumping version from v$${old_version} to v$${new_version}"; \
|
|
63
|
+
git tag -a "v$${new_version}" -m ":bookmark: Bumping version from v$${old_version} to v$${new_version}"; \
|
|
64
|
+
echo "\nNew version: $${new_version}"; \
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
--setup-uv:
|
|
68
|
+
@echo "Checking if uv is installed ..."; \
|
|
69
|
+
uv_path=$$(command -v "uv"); \
|
|
70
|
+
if [ -z "$${uv_path}" ]; \
|
|
71
|
+
then \
|
|
72
|
+
echo "ERROR: uv not found.\
|
|
73
|
+
\n You should have uv installed in order to setup this project.\
|
|
74
|
+
\n https://docs.astral.sh/uv/getting-started/installation/\n"; \
|
|
75
|
+
exit 1; \
|
|
76
|
+
fi
|
|
77
|
+
@echo "Checking if uv.lock is up-to-date ..."; \
|
|
78
|
+
if uv lock --check > /dev/null 2>&1 ; \
|
|
79
|
+
then \
|
|
80
|
+
echo "uv.lock is up-to-date"; \
|
|
81
|
+
uv sync; \
|
|
82
|
+
uv run pre-commit install --install-hooks; \
|
|
83
|
+
else \
|
|
84
|
+
echo "uv.lock is NOT up-to-date."; \
|
|
85
|
+
echo "Update uv.lock and commit it."; \
|
|
86
|
+
uv sync; \
|
|
87
|
+
uv run pre-commit install --install-hooks; \
|
|
88
|
+
git add uv.lock; \
|
|
89
|
+
uv run pre-commit run --files uv.lock || true; \
|
|
90
|
+
uv run git commit .pre-commit-config.yaml uv.lock -m ":lock: Lock the project dependencies"; \
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
setup:
|
|
94
|
+
@make -- --check-git-status || exit 1
|
|
95
|
+
@make -- --setup-uv || exit 1
|
|
96
|
+
@echo "Checking pre-commits ..."; poetry run pre-commit run --all-files || exit 1
|
|
97
|
+
@echo "\nSetup completed successfully!\n"; exit 0
|