Skip to main content

Pack charms with local Python package dependencies

Project description

charmcraftlocal

Pack charms with local Python package dependencies

Installation

Install pipx: https://pipx.pypa.io/stable/installation/

pipx install charmcraftlocal

Usage

At the moment, only charms that manage Python dependencies with Poetry are supported.

Example directory layout

common/
    # Local Python package with shared code
    pyproject.toml
    common/
        __init__.py
kubernetes/
    charmcraft.yaml
    pyproject.toml
    poetry.lock
    # [...]
machines/
    charmcraft.yaml
    pyproject.toml
    poetry.lock
    # [...]
Example common/pyproject.toml
[project]
name = "common"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
]

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

Step 1: Add local package to charm dependencies

Repeat this step for each charm that depends on the local package.

poetry add ../common --editable

Example pyproject.toml

[tool.poetry.dependencies]
common = {path = "../common", develop = true}

Step 2: Pack charm

ccl pack

How it works

Currently, during charmcraft pack, charmcraft can only access files in the directory that contains charmcraft.yaml.

charmcraftlocal

  • searches (the charm's) pyproject.toml for local Python dependencies,
  • copies them to the charm directory,
  • and calls Poetry to update pyproject.toml and poetry.lock to reference the copied package(s)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charmcraftlocal-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

charmcraftlocal-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file charmcraftlocal-0.1.0.tar.gz.

File metadata

  • Download URL: charmcraftlocal-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for charmcraftlocal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 81fb3f67756122c37f299c1162c836149a56704cf303e7901db4d07dd03d89a2
MD5 1615dab6a5f00f938c9a73cb45929d01
BLAKE2b-256 457af472069c22fcef772bccbf3a18c867a3c5ebb57e550055a887eb6947c5a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmcraftlocal-0.1.0.tar.gz:

Publisher: release.yaml on canonical/charmcraftlocal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file charmcraftlocal-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for charmcraftlocal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 525dcb93aba288ad069210a8ad1ee6f3a801735afca1dc2cdf633b13b2a7177a
MD5 26161536bc0f001735f9c26293107233
BLAKE2b-256 0cf41dc149961afe63336074e6d9006c810f0d0108dc7173a24b316652ce360f

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmcraftlocal-0.1.0-py3-none-any.whl:

Publisher: release.yaml on canonical/charmcraftlocal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page