Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: requirements.txt: Repository Level vs Module Level
Re: requirements.txt: Repository Level vs Module Level
Re: requirements.txt: Repository Level vs Module Level
by
Acsone SA/NV, Stéphane Bidoul
Hi Dmytro,
You can achieve fine grained (per module) installation using pip.
You can achieve fine grained (per module) installation using pip.
For OCA modules and your example: "pip install odoo12-addon-partner_email_check" should just work, as the OCA modules are available on PyPI.
Dependencies on python libraries are installed automatically if they are declared in the manifest, as it is the case for that module.
You can also install from git using the PEP 508 syntax for pip VCS urls: "pip install odoo12-addon-partner_email_check@git+https://github.com/OCA/partner-contact@12.0#subdirectory=setup/partner_email_check".
You can find more information in this post from 2015 (time flies :) and how it is done in setuptools-odoo.
> Looking for python dependencies in manifest is also not good, because
there are python packages exists, that has different name for package
and python module inside package.
This particular problem is also resolved by setuptools-odoo (look for external dependencies override in the setuptools-odoo doc).
And for Odoo >=13 you can and should declare the PyPI project name in external_dependencies in the manifest.
Best regards,
-sbi
On Thu, Feb 11, 2021 at 10:56 AM Dmytro Katyukha <dmytro.katyukha@gmail.com> wrote:
Hi all,As i see, usually in OCA repositories "requirements.txt" file with pip dependencies is located in the root of the repository and contains a list of all python dependencies for all addons in the repository. This way it works fine, when we clone full repository, and install all dependencies for all modules there, thus when user will try to install new module on DB, 99% that all python dependencies will be satisfied.But, let's take for example repository partner-contact repository for Odoo 12.0 and let's try to add the module 'partner_email_check' to odoo server. For this task, i will use [odoo-helper-scripts](https://github.com/katyukha/odoo-helper-scripts) that can automatically resolve repository dependencies (including those specified by oca_dependencies.txt). So, at first i would try to fetch (clone) repository partner-contact, and in this case system will automatically fetch 42 OCA repositories following 'oca_requirements.txt', and also it will try to install python dependencies mentioned in requirements.txt. It is good for development. But installation this way on prod, may lead to a lot of unneeded modules, that polutes system with strange dependencies that are in some cases may be not installable (for example because of system dependencies).To solve this reason, we started to use 'assembly' approach, that assumes that we have to create separate git repository with only addons needed on server. But in this case, if assembly repo created automatically, there is no way to get python requirements for module, if it is not specified in module directory. Looking for python dependencies in manifest is also not good, because there are python packages exists, that has different name for package and python module inside package.So, may be it have sense to place requirements.txt inside module directory? Thus module's requirements will be always delivered with module, that will make easier installation of module. Also, i think this way, it will be much easier to generate setup.py files for modules, that will contain info about module's python dependencies.Possible drawbacks may be in case, when different versions of python dep will be specified in different modules. But same is applicable for repositories.What do you think about this?With regards,Dmytro Katyukha_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe
Reference
-
requirements.txt: Repository Level vs Module Level
bydmytro.katyukha-
Re: requirements.txt: Repository Level vs Module Level
byTecnativa. S. L., Pedro M. Baeza -
Re: requirements.txt: Repository Level vs Module Level
byClosingAp Open Source Integrators Europe, LDA, Daniel Reis -
Re: requirements.txt: Repository Level vs Module Level
byAcsone SA/NV, Stéphane Bidoul -
Re: requirements.txt: Repository Level vs Module Level
byCamptocamp SA, Simone Orsi
-