Skip to content

Commit

Permalink
Add section about dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bocekm committed Dec 19, 2018
1 parent aab3b83 commit 34a1df0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (packages from the @core group + their dependencies).

0 comments on commit 34a1df0

Please sign in to comment.