Skip to content

Commit

Permalink
Rename paas_app_charmer -> paas_charm (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdelapuente authored Oct 15, 2024
1 parent fb9ba3c commit 862d84e
Show file tree
Hide file tree
Showing 67 changed files with 265 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/paas-app-charmer
url: https://pypi.org/p/paas-charm
permissions:
id-token: write
if: github.event_name == 'workflow_dispatch'
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PaaS App Charmer
# PaaS Charm

Easily deploy and operate your Flask or Django applications and associated
infrastructure, such as databases and ingress, using open source tooling. This
Expand All @@ -8,7 +8,7 @@ developed by Canonical, the creators of Ubuntu.

Have you ever created an application and then wanted to deploy it for your users
only to either be forced to use a proprietary public cloud platform or manage
the deployment and operations yourself? PaaS App Charmer will take your
the deployment and operations yourself? PaaS Charm will take your
application and create an OCI image using Rockcraft and operations code using
Charmcraft for you. The full suite of tools is open source so you can see
exactly how it works and even contribute! After creating the app charm and
Expand Down Expand Up @@ -64,7 +64,7 @@ Additional resources:

## Contributing

Is there something missing from the PaaS App Charmer framework? PaaS App Charmer
Is there something missing from the PaaS Charm framework? PaaS Charm
welcomes contributions! This section covers how to add a new integration and a
new framework.

Expand All @@ -77,13 +77,13 @@ through below.
[charm topic on discourse](https://discourse.charmhub.io/c/charm/41). This
should cover things like:
* The integration you intend add
* For each of the frameworks that PaaS App Charmer supports:
* For each of the frameworks that PaaS Charm supports:
- The commonly used package(s) to make use of the integration
- The environment variables, configuration etc. that would be made available
to the app
- An example for how to use the integration within an app
* The proposed implementation in `paas-app-charmer`. Take a look at
[`charm.py`](paas_app_charmer/_gunicorn/charm.py) for `gunicorn` based
* The proposed implementation in `paas-app`. Take a look at
[`charm.py`](paas_charm/_gunicorn/charm.py) for `gunicorn` based
frameworks for integration examples.
1. Update the
[reference](https://juju.is/docs/sdk/charmcraft-extension-flask-framework)
Expand Down Expand Up @@ -113,7 +113,7 @@ below.
* How the configuration options of the charm map to environment variables,
configurations or another method of passing the information to the app
* The requirements and conventions for how users need to configure their app
to work with PaaS App Charmer
to work with PaaS Charm
* Which web server to use
1. Raise a pull request to [rockcraft](https://github.com/canonical/rockcraft)
adding a new extension and profile for the framework. This is the flask
Expand All @@ -124,7 +124,7 @@ below.
framework.
1. Raise a pull request to this repository adding a new parent class that can be
used by the app charms. The following is the
[example for flask](./paas_app_charmer/flask/charm.py).
[example for flask](./paas_charm/flask/charm.py).
1. Raise a pull request to
[charmcraft](https://github.com/canonical/charmcraft) adding a new extension
and profile for the framework. This is the flask
Expand Down
4 changes: 2 additions & 2 deletions examples/django/charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

import ops

import paas_app_charmer.django
import paas_charm.django

logger = logging.getLogger(__name__)


class DjangoCharm(paas_app_charmer.django.Charm):
class DjangoCharm(paas_charm.django.Charm):
"""Django Charm service."""

def __init__(self, *args: typing.Any) -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/fastapi/charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import ops

import paas_app_charmer.fastapi
import paas_charm.fastapi


class FastAPICharm(paas_app_charmer.fastapi.Charm):
class FastAPICharm(paas_charm.fastapi.Charm):
"""FastAPI Charm service."""

def __init__(self, *args: typing.Any) -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/flask/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

import ops

import paas_app_charmer.flask
import paas_charm.flask

logger = logging.getLogger(__name__)


class FlaskCharm(paas_app_charmer.flask.Charm):
class FlaskCharm(paas_charm.flask.Charm):
"""Flask Charm service."""

def __init__(self, *args: typing.Any) -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/go/charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import ops

import paas_app_charmer.go
import paas_charm.go


class GoCharm(paas_app_charmer.go.Charm):
class GoCharm(paas_charm.go.Charm):
"""Go Charm service."""

def __init__(self, *args: typing.Any) -> None:
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
[project]
name = "paas-app-charmer"
version = "1.3.1"
description = "Companion library for PaaS app charmer."
name = "paas-charm"
version = "1.0.0"
description = "Companion library for 12-factor app support in Charmcraft & Rockcraft."
readme = "README.md"
authors = [
{name = "Canonical IS DevOps team", email="[email protected]"},
Expand All @@ -20,13 +20,13 @@ classifiers = [


[project.urls]
Repository = "https://github.com/canonical/paas-app-charmer"
Repository = "https://github.com/canonical/paas-charm"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools.package-data]
paas_app_charmer = ["**/cos/**", "**/cos/**/.**"]
paas_charm = ["**/cos/**", "**/cos/**/.**"]

# Testing tools configuration
[tool.coverage.run]
Expand Down
13 changes: 13 additions & 0 deletions src/paas_app_charmer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated entrypoints for charms.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

import warnings

warnings.warn("paas_app_charmer package is deprecated", DeprecationWarning, stacklevel=2)
13 changes: 13 additions & 0 deletions src/paas_app_charmer/django/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Django module entrypoint.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

from .charm import Charm

__all__ = ["Charm"]
15 changes: 15 additions & 0 deletions src/paas_app_charmer/django/charm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Django Charm service.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

import paas_charm.django.charm


class Charm(paas_charm.django.charm.Charm):
"""Deprecated Django charm."""
13 changes: 13 additions & 0 deletions src/paas_app_charmer/fastapi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated FastAPI module entrypoint.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

from .charm import Charm

__all__ = ["Charm"]
16 changes: 16 additions & 0 deletions src/paas_app_charmer/fastapi/charm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.


"""Deprecated FastAPI Charm service.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

import paas_charm.fastapi.charm


class Charm(paas_charm.fastapi.charm.Charm):
"""Deprecated FastAPI charm."""
13 changes: 13 additions & 0 deletions src/paas_app_charmer/flask/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Flask module entrypoint.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

from .charm import Charm

__all__ = ["Charm"]
15 changes: 15 additions & 0 deletions src/paas_app_charmer/flask/charm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Flask Charm service.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

import paas_charm.flask.charm


class Charm(paas_charm.flask.charm.Charm):
"""Deprecated Flask charm."""
13 changes: 13 additions & 0 deletions src/paas_app_charmer/go/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Go module entrypoint.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""

from .charm import Charm

__all__ = ["Charm"]
16 changes: 16 additions & 0 deletions src/paas_app_charmer/go/charm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Deprecated Go Charm service.
This module can be removed when paas_charm>=2.0.
It has to be maintained for the life cycle of bases 22.04 and 24.04.
"""


import paas_charm.go.charm


class Charm(paas_charm.go.charm.Charm):
"""Deprecated Go charm."""
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"""Module __init__."""

from paas_app_charmer import exceptions
from paas_charm import exceptions

# Try the charm library imports to check whether they are present
try:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"""The base charm class for all charms."""
import logging

from paas_app_charmer._gunicorn.webserver import GunicornWebserver, WebserverConfig
from paas_app_charmer._gunicorn.workload_config import create_workload_config
from paas_app_charmer._gunicorn.wsgi_app import WsgiApp
from paas_app_charmer.app import App, WorkloadConfig
from paas_app_charmer.charm import PaasCharm
from paas_charm._gunicorn.webserver import GunicornWebserver, WebserverConfig
from paas_charm._gunicorn.workload_config import create_workload_config
from paas_charm._gunicorn.wsgi_app import WsgiApp
from paas_charm.app import App, WorkloadConfig
from paas_charm.charm import PaasCharm

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import ops
from ops.pebble import ExecError, PathError

from paas_app_charmer._gunicorn.workload_config import (
from paas_charm._gunicorn.workload_config import (
APPLICATION_ERROR_LOG_FILE_FMT,
APPLICATION_LOG_FILE_FMT,
STATSD_HOST,
)
from paas_app_charmer.app import WorkloadConfig
from paas_app_charmer.exceptions import CharmConfigInvalidError
from paas_app_charmer.utils import enable_pebble_log_forwarding
from paas_charm.app import WorkloadConfig
from paas_charm.exceptions import CharmConfigInvalidError
from paas_charm.utils import enable_pebble_log_forwarding

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pathlib

from paas_app_charmer.app import WorkloadConfig
from paas_charm.app import WorkloadConfig

STATSD_HOST = "localhost:9125"
APPLICATION_LOG_FILE_FMT = "/var/log/{framework}/access.log"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import ops

from paas_app_charmer._gunicorn.webserver import GunicornWebserver
from paas_app_charmer.app import App, WorkloadConfig
from paas_app_charmer.charm_state import CharmState
from paas_app_charmer.database_migration import DatabaseMigration
from paas_charm._gunicorn.webserver import GunicornWebserver
from paas_charm.app import App, WorkloadConfig
from paas_charm.charm_state import CharmState
from paas_charm.database_migration import DatabaseMigration

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions paas_app_charmer/app.py → src/paas_charm/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import ops

from paas_app_charmer.charm_state import CharmState, IntegrationsState
from paas_app_charmer.database_migration import DatabaseMigration
from paas_charm.charm_state import CharmState, IntegrationsState
from paas_charm.database_migration import DatabaseMigration

logger = logging.getLogger(__name__)

Expand Down
20 changes: 10 additions & 10 deletions paas_app_charmer/charm.py → src/paas_charm/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
from ops.model import Container
from pydantic import BaseModel, ValidationError

from paas_app_charmer.app import App, WorkloadConfig
from paas_app_charmer.charm_state import CharmState
from paas_app_charmer.charm_utils import block_if_invalid_config
from paas_app_charmer.database_migration import DatabaseMigration, DatabaseMigrationStatus
from paas_app_charmer.databases import make_database_requirers
from paas_app_charmer.exceptions import CharmConfigInvalidError
from paas_app_charmer.observability import Observability
from paas_app_charmer.rabbitmq import RabbitMQRequires
from paas_app_charmer.secret_storage import KeySecretStorage
from paas_app_charmer.utils import build_validation_error_message, config_get_with_secret
from paas_charm.app import App, WorkloadConfig
from paas_charm.charm_state import CharmState
from paas_charm.charm_utils import block_if_invalid_config
from paas_charm.database_migration import DatabaseMigration, DatabaseMigrationStatus
from paas_charm.databases import make_database_requirers
from paas_charm.exceptions import CharmConfigInvalidError
from paas_charm.observability import Observability
from paas_charm.rabbitmq import RabbitMQRequires
from paas_charm.secret_storage import KeySecretStorage
from paas_charm.utils import build_validation_error_message, config_get_with_secret

logger = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 862d84e

Please sign in to comment.