From 0e3c1ea56634eb9217b0d5eee7df72e848a0ce9a Mon Sep 17 00:00:00 2001 From: Michal Bocek Date: Tue, 18 Dec 2018 23:44:54 +0100 Subject: [PATCH] Add section about dependencies --- docs/best-practices.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/best-practices.md b/docs/best-practices.md index 3673437a36..42ca693796 100644 --- a/docs/best-practices.md +++ b/docs/best-practices.md @@ -10,7 +10,7 @@ Despite the actors being written in Python, they are loaded beforehand to get al avoid slow downs during this load phase we ask you to not execute any code that is not absolutely necessary on a module level. Simple, fast code with no side-effects is acceptable, for example constant definitions. -## Avoid global non-Leapp imports +## Avoid certain global imports On a module level, try to import only the Python Standard Library modules or modules provided by the Leapp framework. Import any other module within your function or method. This has to do with possible slow down when loading repositories @@ -113,3 +113,22 @@ def do_the_actor_thingy(actor): ``` For more about unit testing, see the [tutorial](https://leapp.readthedocs.io/en/latest/unit-testing.html). + +## Do not introduce new dependencies + +Ideally, actors shouldn't require any additional dependency on top of the dependencies already in the +[leap](https://github.com/oamg/leapp/blob/master/packaging/leapp.spec) and +[leapp-repository](https://github.com/oamg/leapp-repository/blob/master/packaging/leapp-repository.spec) spec files, +which are, as of December 2018, just these: +- dnf +- python-six +- python-setuptools +- findutils + +Rather than adding a new dependency to the spec file, detect in the actor if the package is installed and +if not, have a fallback option or skip the action you wanted to perform and report to the user that they should install +the package if they want to experience as smooth upgrade as possible. + +If you're writing an actor for the RHEL 7 to RHEL 8 in-place upgrade workflow and you really need to have some package +installed, then the only acceptable packages to depend on are the the ones available in the +[minimal installation of RHEL 7](https://gitlab.cee.redhat.com/leapp/pes-data/blob/master/package-lists/minimal-installed.list).