bench icon indicating copy to clipboard operation
bench copied to clipboard

feat: Frappe package dependencies

Open ankush opened this issue 1 year ago • 0 comments

We can specify python dependencies in pyproject.toml

dependencies = [
    # Core dependencies
    "pycountry~=22.3.5",
    "Unidecode~=1.3.6",
    "barcodenumber~=0.5.0",
    "rapidfuzz~=2.15.0",
    "holidays~=0.28",
]

However we can't use Frappe app versions here because they are not published on pypi and pip can possibly fuckup and try to fetch it from pypi and fail catastrophically. (ref https://github.com/frappe/erpnext/pull/25501)

Possible solution:

  1. We use same syntax as requirements.txt https://pip.pypa.io/en/stable/reference/requirements-file-format/
  2. We add a special section in pyproject.toml
[tool.bench.frappe-dependencies]
frappe = ">=15.2.0"
erpnext = "~=15.1.1"
  1. When doing bench get-app bench ensures that dependencies are present before installing app.

Note: This won't resolve and install them at all. (Not ideal for platforms like FC where we can't just install arbitrary app dependencies) That can be handled some other day.

Possible problems:

  • Frappe is installed first but other apps aren't really providing any guarantee for ordering. Order of installation can matter here. No idea how to solve this. Mostly, in Frappe ecosystem currently Frappe and ERPNext version targeting is required first.

Example usage of custom pyproject config blocks: https://github.com/frappe/bench/blob/d84a05ed2a9e21ff7efd8bff98b14d13d8bacc18/bench/utils/bench.py#L110

ankush avatar Jan 31 '24 08:01 ankush