Skip to content

Make dependencies optional #253

@ckunki

Description

@ckunki

Environments other than the Exasol AI Lab may not need all the NC's dependencies.

Compare pyexasol

Installation

Installing a Single Optional Package

pip install pyexasol[<optional-package-name>]
poetry install -E <optional-package-name>

Installing Multiple Optional Packages

pip install pyexasol[p1, p2]
poetry install -E <p1> -E <p2>
poetry install -E "<p1> <p2>"
poetry install --all-extras

Specifying Dependencies in file pyproject.toml

Deprecated syntax

[tool.poetry.extras]
numpy = ["numpy"]

PEP 508 syntax supported by poetry ≥ 2.0

[project]
dependencies = [
  "sqlcipher3-binary (>= 0.5.0); sys_platform==\"linux\"",
  "sqlcipher3 (>= 0.5.0); sys_platform==\"darwin\" or sys_platform==\"win32\"",
  "exasol-saas-api (>=0.9.0, <3)",
]

Poetry Documentation:

Deprecated: Use project.optional-dependencies instead:

[project.optional-dependencies]
mysql = [ "mysqlclient>=1.3,<2.0" ]

Specifying Special Dependencies

  • Platform, see stackoverflow:
    sqlcipher3-binary = [ 'sqlcipher (3>=0.5.0); sys_platform=="darwin" or sys_platform=="win32"' ]
    
  • Extras, see pip documentation
    ibis-framework = [ "ibis-framework [exasol, something] (>=9.1.0, <10)" ]

See also https://stackoverflow.com/questions/64685527/pip-install-with-all-extras for

  • inspecting available extras of a package
  • creating a file setup.py that contains a special extra called all which includes all other extras.

Impacted GitHub Workflows

The GitHub workflows marked with ❌ need optional dependencies:

cd.yml

  • check-release-tag.yml
  • build-and-publish.yml
  • gh-pages.yml

checks.yml

  • matrix-python.yml

ci-cd.yml

  • check-release-tag.yml
  • ❌ checks.yml
  • build-and-publish.yml
  • report.yml

ci.yml

  • ❌ merge-gate.yml
  • report.yml

merge-gate.yml

  • ❌ checks.yml
  • ❌ tests-ordinary-integration.yml
  • ❌ tests-saas.yml
  • ❌ tests-large-runner.yml
  • ❌ tests-gpu.yml

pr-merge.yml

  • ❌ checks.yml
  • gh-pages.yml
  • report.yml

Metadata

Metadata

Assignees

Labels

refactoringCode improvement without behavior change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions