Installing and managing dependencies¶
A Lime CRM project has a number of first and third party dependencies. To install and manage them we use a tool called Poetry.
Poetry is a tool for managing dependencies and virtual environments, as well as building and publishing your Python packages. It serves as a modern replacement for pip, making the development experience easier. This quick start guide provides the basics of using poetry for working with Lime packages and solutions.
The official documentation for poetry lives here: https://python-poetry.org/docs/
pyproject.toml
file¶
Poetry uses a single standardized pyproject.toml
file to replace
setup.py, requirements.txt, setup.cfg, MANIFEST.in, and Pipfile.
This file is used to store all your metadata and dependency declarations.
Dependencies and dev-dependencies are declared in their corresponding
sections tool.poetry.dependencies
and tool.poetry.dev-dependencies
of the pyproject.toml
file.
For newly created solutions using lime-project
, the file will look
similar to this:
[build-system]
requires = ['poetry-core>=1.3']
build-backend = 'poetry.core.masonry.api'
[tool.metadata]
display_name = 'test'
package_name = 'solution-test'
lib_name = 'solution_test'
[tool.poetry]
name = 'solution-test'
version = '0.1.0'
description = 'Lime CRM solution'
authors = ['Author <[email protected]>']
[[tool.poetry.source]]
name = 'lime'
url = 'https://pypi.lime.tech/simple/'
[tool.poetry.plugins.'lime_plugins']
'solution-test' = 'solution_test'
[tool.poetry.dependencies]
python = '^3.11'
lime-crm = '^2.457.0'
[tool.poetry.group.dev.dependencies]
autopep8 = '>=1'
pytest = '>=6.2.3'
flake8 = '^3.7'
black = '^22.1.0'
isort = '^5.0.0'
[tool.lime]
[tool.lime.project]
project_version = '1.189.2'
project_type = 'solution'
project_target = 'cloud'
project_imagebaker_version = '2.38.1'
project_autoupdate = true
project_autoupdate_env = "production"
[tool.pytest.ini_options]
minversion = '6.0'
norecursedirs = [
'venv',
'.venv',
'build',
'dist',
'.plugins',
'frontend',
'.env',
'.git',
'.github',
'.lime',
'.vscode'
]
faulthandler_timeout = 300
[tool.black]
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.venv
| frontend
| poetry.lock
)/
'''
[tool.isort]
profile = "black"
multi_line_output = 3
The lime-crm
dependency¶
Each project always has a dependency on lime-crm
, the underlying library for Lime CRM. A package should keep as broad range of versions as its dependencies, while a solution should narrow it down.
Adding dependencies¶
Dependencies are added running
For more information regarding options and dependency specification please see Poetry's documentation
Managing dependencies¶
Project dependencies must be locked in a file called poetry.lock
before your project is published to the remote repo. This is done by running:
Once dependencies are lock, all following installs will use the lock-file to install dependencies. To update any dependency run:
Warning
Without the poetry.lock
file will fail to build
when pushed to the main branch.
Dependencies can be installed from the poetry.lock
file by running:
Info
If you don't have a lock-file, running poetry install
will create one
For more info on managing dependencies, refer to https://python-poetry.org/docs/cli/#install.