Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Document ingress_per_unit lib dependencies #36

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/charms/traefik_k8s/v0/ingress_per_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
charmcraft fetch-lib charms.traefik_k8s.v0.ingress_per_unit
```

Add the `jsonschema` dependency to the `requirements.txt` of your charm.

```yaml
requires:
ingress:
Expand Down Expand Up @@ -50,7 +52,14 @@ def _handle_ingress_per_unit(self, event):
import warnings
from typing import Dict, Optional, Tuple, TypeVar, Union

import jsonschema
try:
import jsonschema
except ModuleNotFoundError:
raise Exception(
"The ingress_per_unit library needs the jsonschema package as dependency; "
"add 'jsonschema' to the 'requirements.txt' of your charm."
)

import yaml
from ops.charm import CharmBase, RelationBrokenEvent, RelationEvent
from ops.framework import EventSource, Object, ObjectEvents
Expand All @@ -65,14 +74,14 @@ def _handle_ingress_per_unit(self, event):
)

# The unique Charmhub library identifier, never change it
LIBID = "7ef06111da2945ed84f4f5d4eb5b353a" # can't register a library until the charm is in the store 9_9
LIBID = "7ef06111da2945ed84f4f5d4eb5b353a"

# Increment this major API version when introducing breaking changes
LIBAPI = 0

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 7
LIBPATCH = 8

log = logging.getLogger(__name__)

Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ ops == 1.3.0 # 1.4.0 breaks SDI-based tests
deepmerge
lightkube >= 0.8.1
lightkube-models >= 1.22.0.4
serialized-data-interface>=0.4.0
# The following is needed by lib/charms/traefik_k8s/v0/ingress_per_unit.py
jsonschema
# The following is needed by lib/charms/traefik_k8s/v0/ingress.py
serialized-data-interface==0.4.0 # Pin to avoid incompatible changes until dropped