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

feat!: move all dependencies to extras #93

Merged
merged 8 commits into from
Dec 6, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
make all deps optional and test simple interface
Signed-off-by: Michele Dolfi <[email protected]>
dolfim-ibm committed Dec 4, 2024
commit e1abdec71e356e846e17bbc72e5eeaf38a949d8f
13 changes: 12 additions & 1 deletion .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ inputs:
python-version:
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
default: '3.11'
run_install:
description: "Install the dependencies."
default: 'true'
install_extras:
description: "When installing depdencies, the extra dependencies are included."
default: 'true'
runs:
using: 'composite'
steps:
@@ -21,6 +27,11 @@ runs:
poetry env use ${{ steps.py.outputs.python-path }}
poetry run python --version
shell: bash
- name: Install only dependencies and not the package itself
- name: Install the dependencies and the extas (but not the package itself)
if: ${{ inputs.run_install == 'true' && inputs.install_extras == 'true' }}
run: poetry install --all-extras --no-root
shell: bash
- name: Install only dependencies and not the package itself
if: ${{ inputs.run_install == 'true' && inputs.install_extras != 'true' }}
run: poetry install --no-root
shell: bash
13 changes: 12 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,18 @@ jobs:
- uses: ./.github/actions/setup-poetry
with:
python-version: ${{ matrix.python-version }}
- name: Install with poetry
run_install: 'false'

- name: Install extras
run: |
poetry install
ls -l
ls -l deepsearch_glm

- name: Test interface without extras
run: |
poetry run pytest ./tests/test_simple_interface.py -vs
- name: Install extras
run: |
poetry install --all-extras
ls -l
32 changes: 17 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -24,16 +24,16 @@ build = "build.py"

[tool.poetry.dependencies]
python = "^3.9"
docling-core = "^2.0"
pywin32 = { version = "^307", markers = "sys_platform == 'win32'" }
docling-core = { version = "^2.0", optional = true }
deepsearch-toolkit = { version = "^1.1.0", optional = true }
tabulate = ">=0.8.9"
pandas = ">=1.5.1,<3.0.0"
tabulate = { version = ">=0.8.9", optional = true }
pandas = { version = ">=1.5.1,<3.0.0", optional = true }
matplotlib = { version = "^3.7.1", optional = true }
python-dotenv = { version = "^1.0.0", optional = true }
tqdm = "^4.64.0"
rich = "^13.7.0"
pywin32 = { version = "^307", markers = "sys_platform == 'win32'" }
requests = "^2.32.3"
tqdm = { version = "^4.64.0", optional = true }
rich = { version = "^13.7.0", optional = true }
requests = { version = "^2.32.3", optional = true }

[tool.poetry.group.test.dependencies]
pytest = "^7.4.2"
@@ -73,7 +73,8 @@ pandas = [

pyplot = ["matplotlib"]
toolkit = ["deepsearch-toolkit", "python-dotenv"]

docling = ["docling-core", "pandas"]
utils = ["tabulate", "python-dotenv", "pandas", "tqdm", "rich", "requests"]

[tool.black]
line-length = 88
17 changes: 17 additions & 0 deletions tests/test_simple_interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import json

from deepsearch_glm.andromeda_nlp import nlp_model


def test_simple_interface():
model = nlp_model()
model.set_loglevel("WARNING")

config = model.get_apply_configs()[0]
config["models"] = ""
config["subject-filters"] = []

model.initialise(config)

doc = json.load(open("tests/data/docs/1806.02284.json"))
output = model.apply_on_doc(doc)