Skip to content

chore: clean up unused/unnecessary files#2444

Merged
lengau merged 5 commits intomainfrom
work/remove-unused
Sep 15, 2025
Merged

chore: clean up unused/unnecessary files#2444
lengau merged 5 commits intomainfrom
work/remove-unused

Conversation

@lengau
Copy link
Copy Markdown
Collaborator

@lengau lengau commented Sep 12, 2025

No description provided.

@github-actions
Copy link
Copy Markdown

Type checking with ty failed. This is a notification only and does not require action.

Command output
error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
    --> charmcraft/application/commands/store.py:2154:29
     |
2152 |     def write_output(
2153 |         fmt: cli.OutputFormat,
2154 |         updates: Collection[models.resource_revision_model.CharmResourceRevision],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2155 |     ) -> None:
2156 |         """Write formatted output for this command to the terminal."""
     |
info: rule `unresolved-attribute` is enabled by default

error[not-iterable]: Object of type `IO[str] | None` may not be iterable
   --> charmcraft/charm_builder.py:423:17
    |
422 |     # https://github.com/microsoft/pylance-release/issues/2385
423 |     for line in proc.stdout:  # pyright: ignore[reportOptionalIterable]
    |                 ^^^^^^^^^^^
424 |         print(f"   :: {line.rstrip()}")
425 |     retcode = proc.wait()
    |
info: It may not have an `__iter__` method and it doesn't have a `__getitem__` method
info: rule `not-iterable` is enabled by default

warning[possibly-unbound-attribute]: Attribute `split` on type `str | None` is possibly unbound
   --> charmcraft/linters.py:238:23
    |
236 |                     yield name.name.split(".")
237 |             elif isinstance(node, ast.ImportFrom):
238 |                 yield node.module.split(".")
    |                       ^^^^^^^^^^^^^^^^^
239 |
240 |     def _check_operator(self, basedir: pathlib.Path) -> bool:
    |
info: rule `possibly-unbound-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `merge_from` is incorrect
   --> charmcraft/parts/plugins/_charm.py:341:28
    |
339 |     def post_build_callback(self, step_info):
340 |         """Collect metrics left by charm_builder.py."""
341 |         instrum.merge_from(env.get_charm_builder_metrics_path())
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str`, found `Path`
342 |
343 |     def _get_os_special_priority_paths(self) -> str | None:
    |
info: Method defined here
  --> charmcraft/instrum.py:77:9
   |
75 |             json.dump(measurements, fh, indent=4)
76 |
77 |     def merge_from(self, filename: str) -> None:
   |         ^^^^^^^^^^       ------------- Parameter declared here
78 |         """Merge measurements from a file to the current ongoing structure."""
79 |         with open(filename) as fh:
   |
info: Union variant `bound method _Measurements.merge_from(filename: str) -> None` is incompatible with this call site
info: Attempted to call union type `Unknown | (bound method _Measurements.merge_from(filename: str) -> None)`
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:39:42
   |
39 | class ReactivePluginEnvironmentValidator(plugins.validator.PluginEnvironmentValidator):
   |                                          ^^^^^^^^^^^^^^^^^
40 |     """Check the execution environment for the Reactive plugin.
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:77:34
   |
75 |             ) from err
76 |         except subprocess.CalledProcessError as err:
77 |             if err.returncode != plugins.validator.COMMAND_NOT_FOUND:
   |                                  ^^^^^^^^^^^^^^^^^
78 |                 raise PluginEnvironmentValidationError(
79 |                     part_name=self._part_name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> charmcraft/services/package.py:120:20
    |
118 |             try:
119 |                 image_info = json.loads(image_info)
120 |             except json.decoder.JSONDecodeError as exc:
    |                    ^^^^^^^^^^^^
121 |                 msg = f"Failed to parse the content of {const.IMAGE_INFO_ENV_VAR} environment variable"
122 |                 raise errors.CraftError(msg) from exc
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:32:19
   |
30 |     """Charmcraft remote build service."""
31 |
32 |     RecipeClass = launchpad.models.CharmRecipe
   |                   ^^^^^^^^^^^^^^^^
33 |
34 |     def fetch_logs(self, output_dir: pathlib.Path) -> Mapping[str, pathlib.Path | None]:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:63:21
   |
61 |         self,
62 |         name: str,
63 |         repository: launchpad.models.GitRepository,
   |                     ^^^^^^^^^^^^^^^^
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:65:10
   |
63 |         repository: launchpad.models.GitRepository,
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |          ^^^^^^^^^^^^^^^^
66 |         """Create a new recipe."""
67 |         try:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:68:20
   |
66 |         """Create a new recipe."""
67 |         try:
68 |             return launchpad.models.CharmRecipe.new(
   |                    ^^^^^^^^^^^^^^^^
69 |                 self.lp,
70 |                 name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:84:49
   |
83 |     @override
84 |     def _get_build_states(self) -> Mapping[str, launchpad.models.BuildState]:
   |                                                 ^^^^^^^^^^^^^^^^
85 |         self._refresh_builds()
86 |         return {
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
   --> charmcraft/services/store.py:320:21
    |
318 |     def set_resource_revisions_architectures(
319 |         self, name: str, resource_name: str, updates: dict[int, list[str]]
320 |     ) -> Collection[models.resource_revision_model.CharmResourceRevision]:
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321 |         """Set the architectures for one or more resource revisions.
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store'>` has no attribute `http_client`
  --> charmcraft/store/client.py:62:29
   |
60 |         self.api_base_url = api_base_url.rstrip("/")
61 |         self.storage_base_url = storage_base_url.rstrip("/")
62 |         self._http_client = craft_store.http_client.HTTPClient(
   |                             ^^^^^^^^^^^^^^^^^^^^^^^
63 |             user_agent=build_user_agent()
64 |         )
   |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
  --> charmcraft/store/store.py:89:41
   |
87 | def _build_revision(item: dict[str, Any]) -> Revision:
88 |     """Build a Revision from a response item."""
89 |     bases = [(None if base is None else Base(**base)) for base in item["bases"]]
   |                                         ^^^^^^^^^^^^
90 |     return Revision(
91 |         revision=item["revision"],
   |
info: rule `missing-argument` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
   --> charmcraft/store/store.py:404:54
    |
402 |                 expires_at = parser.parse(expires_at)
403 |             resources = [_build_resource(r) for r in item["resources"]]
404 |             base = None if item["base"] is None else Base(**item["base"])
    |                                                      ^^^^^^^^^^^^^^^^^^^^
405 |             channel_map.append(
406 |                 Release(
    |
info: rule `missing-argument` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `error`
  --> charmcraft/utils/yaml.py:35:13
   |
33 |         with fpath.open("r") as fh:
34 |             content = yaml.safe_load(fh)
35 |     except (yaml.error.YAMLError, OSError) as err:
   |             ^^^^^^^^^^
36 |         emit.debug(f"Failed to read/parse config file {str(fpath)!r}: {err!r}")
37 |         return None
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `representer`
  --> charmcraft/utils/yaml.py:58:9
   |
56 |     yaml.add_representer(
57 |         const.CharmArch,
58 |         yaml.representer.SafeRepresenter.represent_str,
   |         ^^^^^^^^^^^^^^^^
59 |         Dumper=yaml.SafeDumper,
60 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.django
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.django`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.django
   |        ^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/custom-action-updatelogfile/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.flask
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.flask`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.flask
   |        ^^^^^^^^^^^^^^^^
13 |
14 | import requests
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:56:16
   |
54 |         except ops.pebble.PathError as e:
55 |             event.fail(str(e.message))
56 |         except requests.exceptions.RequestException as e:
   |                ^^^^^^^^^^^^^^^^^^^
57 |             # if it failed with http bad status code or the connection failed
58 |             if e.response is None:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/flask-async/app.py:3:8
  |
1 | from time import sleep
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.contrib`
  --> docs/tutorial/code/django/urls_django_hello_world.py:17:6
   |
15 |     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
16 | """
17 | from django.contrib import admin
   |      ^^^^^^^^^^^^^^
18 | from django.urls import include, path
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
  --> docs/tutorial/code/django/urls_django_hello_world.py:18:6
   |
16 | """
17 | from django.contrib import admin
18 | from django.urls import include, path
   |      ^^^^^^^^^^^
19 |
20 | urlpatterns = [
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
 --> docs/tutorial/code/django/urls_greeting.py:1:6
  |
1 | from django.urls import path
  |      ^^^^^^^^^^^
2 |
3 | from . import views
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Module `docs.tutorial.code.django` has no member `views`
 --> docs/tutorial/code/django/urls_greeting.py:3:15
  |
1 | from django.urls import path
2 |
3 | from . import views
  |               ^^^^^
4 |
5 | urlpatterns = [
  |
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting.py:1:6
  |
1 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting_configuration.py:3:6
  |
1 | import os
2 |
3 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/app.py:1:6
  |
1 | from fastapi import FastAPI
  |      ^^^^^^^
2 |
3 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/greeting_app.py:3:6
  |
1 | import os
2 |
3 | from fastapi import FastAPI
  |      ^^^^^^^
4 |
5 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/visitors_app.py:7:6
  |
5 | from typing import Annotated
6 |
7 | from fastapi import FastAPI, Header
  |      ^^^^^^^
8 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
  --> docs/tutorial/code/fastapi/visitors_app.py:8:8
   |
 7 | from fastapi import FastAPI, Header
 8 | import psycopg2
   |        ^^^^^^^^
 9 |
10 | app = FastAPI()
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/fastapi/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
6 |
7 | DATABASE_URI = os.environ["POSTGRESQL_DB_CONNECT_STRING"]
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/greeting_app.py:3:8
  |
1 | # Flask app with a greeting configuration
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/visitors_app.py:6:8
  |
4 | import os
5 |
6 | import flask
  |        ^^^^^
7 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_app.py:7:8
  |
6 | import flask
7 | import psycopg2
  |        ^^^^^^^^
8 |
9 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:22:36
   |
22 | def get_fake_revision(**kwargs) -> models.resource_revision_model.CharmResourceRevision:
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |     data = {
24 |         "bases": [],
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:36:12
   |
34 |     }
35 |     data.update(kwargs)
36 |     return models.resource_revision_model.CharmResourceRevision(**data)
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/commands/test_store_api.py:347:12
    |
345 |         "no longer valid, though)."
346 |     )
347 |     assert error.resolution == "Please logout first, then login again."
    |            ^^^^^^^^^^^^^^^^
348 |     assert error.__cause__ is original_exception
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1628:13
     |
1626 |     expected = {
1627 |         (test_lib_id, test_api): Library(
1628 |             api=test_api,
     |             ^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version"]`
1629 |             content=test_content,
1630 |             content_hash=test_hash,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1634:13
     |
1632 |             lib_name=test_lib_name,
1633 |             charm_name=test_charm_name,
1634 |             patch=test_patch,
     |             ^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version"]`
1635 |         ),
1636 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1718:13
     |
1716 |     expected = {
1717 |         (test_lib_id_1, test_api_1): Library(
1718 |             api=test_api_1,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-1"]`
1719 |             content=test_content_1,
1720 |             content_hash=test_hash_1,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1724:13
     |
1722 |             lib_name=test_lib_name_1,
1723 |             charm_name=test_charm_name_1,
1724 |             patch=test_patch_1,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-1"]`
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1727:13
     |
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
1727 |             api=test_api_2,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-2"]`
1728 |             content=test_content_2,
1729 |             content_hash=test_hash_2,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1733:13
     |
1731 |             lib_name=test_lib_name_2,
1732 |             charm_name=test_charm_name_2,
1733 |             patch=test_patch_2,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-2"]`
1734 |         ),
1735 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> tests/commands/test_store_client.py:83:19
   |
81 |             # the craft-store lib expects the error from requests, as what we're
82 |             # faking here normally is a "real response"
83 |             raise requests.exceptions.JSONDecodeError(exc.msg, exc.doc, exc.pos)
   |                   ^^^^^^^^^^^^^^^^^^^
84 |
85 |     @property
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/conftest.py:224:9
    |
222 |         build_base=craft_platforms.DistroBase("ubuntu", "22.04"),
223 |         build_on=arch,
224 |         build_for="arm64",
    |         ^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["arm64"]`
225 |         platform="distro-1-test64",
226 |     )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> tests/conftest.py:354:16
    |
352 |         try:
353 |             output_content = json.loads(raw_output)
354 |         except json.decoder.JSONDecodeError:
    |                ^^^^^^^^^^^^
355 |             pytest.fail("Last command output is not valid JSON.")
356 |         assert output_content == expected_content
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft'>` has no attribute `application`
  --> tests/integration/commands/test_init.py:75:17
   |
73 | def init_command():
74 |     return init.InitCommand(
75 |         {"app": charmcraft.application.APP_METADATA, "services": None}
   |                 ^^^^^^^^^^^^^^^^^^^^^^
76 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `RecordingEmitter` has no attribute `assert_json_output`
   --> tests/integration/commands/test_store_commands.py:225:9
    |
223 |             },
224 |         ]
225 |         emitter.assert_json_output(  # pyright: ignore[reportAttributeAccessIssue]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
226 |             expected
227 |         )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Unresolved attribute `client` on type `AppService`.
  --> tests/integration/conftest.py:45:5
   |
43 |     services.register_services()
44 |     factory = craft_application.ServiceFactory(app=application.APP_METADATA)
45 |     factory.get("store").client = mock.Mock(spec_set=craft_store.StoreClient)  # pyright: ignore[reportAttributeAccessIssue]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 |     factory.update_kwargs(
47 |         "charm_libs",
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/integration/services/test_image.py:28:9
   |
26 |     service = ImageService(
27 |         app=application.APP_METADATA,
28 |         services=None,  # pyright: ignore[reportArgumentType]
   |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
29 |     )
30 |     service.setup()
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:40:17
   |
38 |                 platform="something",
39 |                 build_on=craft_platforms.DebianArchitecture.from_host(),
40 |                 build_for="invalid",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["invalid"]`
41 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
42 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:88:17
   |
86 |                 platform="something",
87 |                 build_on=host_arch,
88 |                 build_for=f"{foreign_arch}-{host_arch}",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
89 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
90 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:9:8
   |
 7 | import pathlib
 8 |
 9 | import charm
   |        ^^^^^
10 | import scenario
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:10:8
   |
 9 | import charm
10 | import scenario
   |        ^^^^^^^^
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario.errors`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:11:8
   |
 9 | import charm
10 | import scenario
11 | import scenario.errors
   |        ^^^^^^^^^^^^^^^
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | # A standalone module for workload-specific logic (no charming concerns):
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `setuptools_scm_python`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:12:8
   |
11 | # A standalone module for workload-specific logic (no charming concerns):
12 | import setuptools_scm_python
   |        ^^^^^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-binary-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/missing-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/no-requirements/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies/charm/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charms.reactive`
 --> tests/spread/smoketests/reactive/reactivecharm/reactive/reactivecharm.py:1:6
  |
1 | from charms.reactive import set_flag, when_not
  |      ^^^^^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-24.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:6:8
  |
4 | import logging
5 |
6 | import ops
  |        ^^^
7 |
8 | # A standalone module for workload-specific logic (no charming concerns):
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `test_cmd`
  --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:9:8
   |
 8 | # A standalone module for workload-specific logic (no charming concerns):
 9 | import test_cmd
   |        ^^^^^^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `pytest_operator.plugin`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/integration/test_charm.py:7:6
  |
5 | import pytest
6 | import yaml
7 | from pytest_operator.plugin import OpsTest
  |      ^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | logger = logging.getLogger(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:2:6
  |
1 | import pytest
2 | from ops import testing
  |      ^^^
3 |
4 | from charm import TestCmdCharm
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:4:6
  |
2 | from ops import testing
3 |
4 | from charm import TestCmdCharm
  |      ^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1237:16
     |
1235 |                 with pytest.raises(SystemExit) as raised:
1236 |                     charm_builder.main()
1237 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1238 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1265:16
     |
1263 |                 with pytest.raises(SystemExit) as raised:
1264 |                     charm_builder.main()
1265 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1266 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:256:32
    |
254 |     assert measurements.measurements == {}
255 |
256 |     with Timer("test message", foo=42):
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
257 |         pass
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:274:28
    |
272 |     monkeypatch.setattr(instrum, "_measurements", measurements)
273 |
274 |     @Timer("test message", foo=42)
    |                            ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
275 |     def test_function(a, b):
276 |         assert a == 17
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:298:32
    |
296 |     assert measurements.measurements == {}
297 |
298 |     with Timer("test message", foo=42) as timer:
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
299 |         timer.mark("middle 1")
300 |         timer.mark("middle 2")
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:75:11
   |
73 |     with pytest.raises(pydantic.ValidationError) as raised:
74 |         parts.process_part_config(data)
75 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
76 |     assert len(err) == 1
77 |     assert err[0]["loc"] == ("color",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:89:11
   |
87 |     with pytest.raises(pydantic.ValidationError) as raised:
88 |         parts.process_part_config(data)
89 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
90 |     assert len(err) == 1
91 |     assert err[0]["loc"] == ("charm-timeout",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:40:15
   |
38 | def test_get_snap_configuration_empty(mock_snap_config):
39 |     def fake_get(key: str):
40 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
41 |
42 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:54:15
   |
52 |         if key == "provider":
53 |             return provider
54 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
55 |
56 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:68:15
   |
66 |         if key == "provider":
67 |             return provider
68 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
69 |
70 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `write`
  --> tests/unit/commands/test_lifecycle.py:91:5
   |
90 |     libs_service = cast("CharmLibsService", service_factory.get("charm_libs"))
91 |     libs_service.write = mock.Mock(wraps=libs_service.write)
   |     ^^^^^^^^^^^^^^^^^^
92 |
93 |     pack._update_charm_libs()
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `bound method CharmLibsService.write(library: Library) -> None` has no attribute `assert_called_once_with`
  --> tests/unit/commands/test_lifecycle.py:95:5
   |
93 |     pack._update_charm_libs()
94 |
95 |     libs_service.write.assert_called_once_with(store_lib)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96 |
97 |     with check():
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:236:12
    |
234 |         fetch_libs.run(argparse.Namespace())
235 |
236 |     assert exc_info.value.resolution == "Add a 'charm-libs' section to charmcraft.yaml."
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:485:9
    |
484 |     assert (
485 |         exc_info.value.resolution
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
486 |         == f"Did you mean: charmcraft promote --from-channel={to_channel} --to-channel={from_channel}"
487 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[non-subscriptable]: Cannot subscript object of type `None` with no `__getitem__` method
  --> tests/unit/models/test_config.py:75:23
   |
73 |     config = JujuConfig(options={"my-opt": option})
74 |
75 |     assert isinstance(config.options["my-opt"], type_)
   |                       ^^^^^^^^^^^^^^
   |
info: rule `non-subscriptable` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/models/test_project.py:582:12
    |
580 |         project.CharmcraftProject.from_yaml_file(pathlib.Path("/charmcraft.yaml"))
581 |
582 |     assert exc.value.details == details
    |            ^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No argument provided for required parameter `type`
   --> tests/unit/models/test_project.py:691:9
    |
689 | ):
690 |     with pytest.raises(error_cls, match=error_match):
691 |         project.BasesCharm(**values)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `missing-argument` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/unit/models/test_project.py:708:13
    |
706 |             description="",
707 |             base=base,
708 |             platforms={"amd64": None},
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `PlatformsDict`, found `dict[@Todo, @Todo]`
709 |             parts={"charm": {"plugin": "charm"}},
710 |         )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:140:11
    |
138 |     with pytest.raises(pydantic.ValidationError) as raised:
139 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
140 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
141 |
142 |     assert len(err) == 1
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:175:11
    |
173 |     with pytest.raises(pydantic.ValidationError) as raised:
174 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
175 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
176 |     assert len(err) == 1
177 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:190:11
    |
188 |     with pytest.raises(pydantic.ValidationError) as raised:
189 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
190 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
191 |     assert len(err) == 1
192 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_poetry.py:40:5
   |
39 | def test_get_pip_install_commands(poetry_plugin: plugins.PoetryPlugin):
40 |     poetry_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
41 |
42 |     assert poetry_plugin._get_pip_install_commands(
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_python.py:62:5
   |
60 |     }
61 |     python_plugin._options = plugins.PythonPluginProperties.unmarshal(spec)
62 |     python_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
63 |     copy_src_cmd = (
64 |         f"cp --archive --recursive --reflink=auto {build_path}/src {install_path}"
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:139:12
    |
137 |         validator.validate_environment()
138 |
139 |     assert raised.value.reason == (
    |            ^^^^^^^^^^^^^^^^^^^
140 |         "charm tool not found and part 'my-part' does not depend on a part named 'charm-tools'"
141 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:153:12
    |
151 |         validator.validate_environment()
152 |
153 |     assert raised.value.reason == "charm tools failed with error code 2"
    |            ^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_analysis.py:112:67
    |
110 | @pytest.fixture
111 | def analysis_service():
112 |     return analysis.AnalysisService(app=application.APP_METADATA, services=None)
    |                                                                   ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
    |
info: Method defined here
  --> charmcraft/services/analysis.py:37:9
   |
35 |     _project: models.CharmcraftProject  # type: ignore[assignment]
36 |
37 |     def __init__(  # (too many arguments)
   |         ^^^^^^^^
38 |         self,
39 |         app: craft_application.AppMetadata,
40 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
41 |     ) -> None:
42 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:55:17
   |
53 |                 platform="something",
54 |                 build_on=HOST_ARCH,
55 |                 build_for=plan_build_for,  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
56 |             )
57 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:94:17
   |
92 |                 platform="something",
93 |                 build_on=HOST_ARCH,
94 |                 build_for=f"{HOST_ARCH}-foreign",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
95 |             )
96 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
  --> tests/unit/services/test_package.py:42:21
   |
40 | )
41 |
42 | SIMPLE_BUILD_BASE = models.charmcraft.Base(
   |                     ^^^^^^^^^^^^^^^^^
43 |     name=HOST_BASE.distribution, channel=HOST_BASE.series, architectures=["arm64"]
44 | )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
   --> tests/unit/services/test_package.py:163:17
    |
161 |             "charmcraft-started-at": "2020-03-14T00:00:00+00:00",
162 |             "bases": [
163 |                 models.charmcraft.Base(
    |                 ^^^^^^^^^^^^^^^^^
164 |                     name=distro.id(),
165 |                     channel=distro.version(),
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_project.py:34:45
   |
32 | @pytest.fixture
33 | def service(project_path):
34 |     return ProjectService(app=APP_METADATA, services=None, project_dir=project_path)
   |                                             ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/project.py:57:9
   |
55 |     _project_model: models.Project | None
56 |
57 |     def __init__(
   |         ^^^^^^^^
58 |         self, app: AppMetadata, services: ServiceFactory, *, project_dir: pathlib.Path
   |                                 ------------------------ Parameter declared here
59 |     ) -> None:
60 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_provider.py:123:9
    |
121 |     provider_service = ProviderService(
122 |         app=APP_METADATA,
123 |         services=None,  # pyright: ignore[reportArgumentType]
    |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
124 |         work_dir=tmp_path,
125 |     )
    |
info: Method defined here
  --> charmcraft/services/provider.py:43:9
   |
41 |     """Business logic for getting providers."""
42 |
43 |     def __init__(
   |         ^^^^^^^^
44 |         self,
45 |         app: craft_application.AppMetadata,
46 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
47 |         *,
48 |         work_dir: pathlib.Path,
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_store.py:50:56
   |
48 | @pytest.fixture(scope="module")
49 | def reusable_store():
50 |     store = StoreService(app=application.APP_METADATA, services=None)
   |                                                        ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
51 |     store.client = mock.Mock(spec_set=craft_store.StoreClient)
52 |     store._publisher = mock.Mock(spec_set=craft_store.PublisherGateway)
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:43:12
   |
41 | )
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:44:12
   |
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:46:9
   |
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 |         == name
48 |     )
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:62:12
   |
60 | )
61 | def test_min_version_regex_matches(string, expected):
62 |     assert linters.MIN_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:76:24
   |
74 | )
75 | def test_approx_version_regex_matches(string, expected):
76 |     assert expected in linters.APPROX_VERSION_REGEX.search(string).group(1, 2)
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:84:12
   |
82 | )
83 | def test_exact_version_regex_matches(string, expected):
84 |     assert linters.EXACT_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/unit/test_parts.py:91:42
   |
89 |         parts.process_part_config(part_config)
90 |
91 |     assert message in {e["msg"] for e in exc_info.value.errors()}
   |                                          ^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[no-matching-overload]: No overload of function `format_content` matches arguments
   --> tests/unit/utils/test_cli.py:285:9
    |
283 | def test_format_content_invalid(fmt):
284 |     with pytest.raises(ValueError, match="^Unknown output format "):
285 |         format_content(None, fmt)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: First overload defined here
   --> charmcraft/utils/cli.py:184:5
    |
183 |   @overload
184 |   def format_content(
    |  _____^
185 | |     content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None
186 | | ) -> str: ...
    | |________^
    |
info: Possible overloads for function `format_content`:
info:   (content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None) -> str
info:   (content: str | Real | list[Unknown] | dict[Unknown, Unknown], fmt: OutputFormat | str | None) -> str
info: Overload implementation defined here
   --> charmcraft/utils/cli.py:195:5
    |
195 | def format_content(content, fmt=None):
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 |     """Format command output."""
197 |     if not isinstance(fmt, OutputFormat):
    |
info: rule `no-matching-overload` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `extra_dependencies`
   --> tests/unit/utils/test_package.py:221:12
    |
219 |         validate_strict_dependencies(dependencies, other_packages)
220 |
221 |     assert exc_info.value.extra_dependencies == extra_packages
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/utils/test_platform.py:162:12
    |
160 |         validate_architectures(architectures)
161 |
162 |     assert exc_info.value.details == details
    |            ^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/utils/test_project.py:111:17
    |
110 |     check.equal(exc_info.value.args, expected.args)
111 |     check.equal(exc_info.value.resolution, expected.resolution)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

Found 124 diagnostics

Comment thread MANIFEST.in
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure we haven't needed this since we switched to pyproject.toml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, when I was looking at this file in snapcraft I determined that it was only necessary for windows packaging, so I'm seconding this

Comment thread libexec/craftctl
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

craft-parts generates this.

Comment thread osv-scanner.toml
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ignore has long since passed.

Comment thread setup.py
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this remained for the Windows build that's removed in 4.0.0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Charmcraft hasn't had these measurements in a long time.

Comment thread tools/version.py
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've moved to setuptools_scm for this.

@github-actions
Copy link
Copy Markdown

Type checking with ty failed. This is a notification only and does not require action.

Command output
error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
    --> charmcraft/application/commands/store.py:2154:29
     |
2152 |     def write_output(
2153 |         fmt: cli.OutputFormat,
2154 |         updates: Collection[models.resource_revision_model.CharmResourceRevision],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2155 |     ) -> None:
2156 |         """Write formatted output for this command to the terminal."""
     |
info: rule `unresolved-attribute` is enabled by default

error[not-iterable]: Object of type `IO[str] | None` may not be iterable
   --> charmcraft/charm_builder.py:423:17
    |
422 |     # https://github.com/microsoft/pylance-release/issues/2385
423 |     for line in proc.stdout:  # pyright: ignore[reportOptionalIterable]
    |                 ^^^^^^^^^^^
424 |         print(f"   :: {line.rstrip()}")
425 |     retcode = proc.wait()
    |
info: It may not have an `__iter__` method and it doesn't have a `__getitem__` method
info: rule `not-iterable` is enabled by default

warning[possibly-unbound-attribute]: Attribute `split` on type `str | None` is possibly unbound
   --> charmcraft/linters.py:238:23
    |
236 |                     yield name.name.split(".")
237 |             elif isinstance(node, ast.ImportFrom):
238 |                 yield node.module.split(".")
    |                       ^^^^^^^^^^^^^^^^^
239 |
240 |     def _check_operator(self, basedir: pathlib.Path) -> bool:
    |
info: rule `possibly-unbound-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `merge_from` is incorrect
   --> charmcraft/parts/plugins/_charm.py:341:28
    |
339 |     def post_build_callback(self, step_info):
340 |         """Collect metrics left by charm_builder.py."""
341 |         instrum.merge_from(env.get_charm_builder_metrics_path())
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str`, found `Path`
342 |
343 |     def _get_os_special_priority_paths(self) -> str | None:
    |
info: Method defined here
  --> charmcraft/instrum.py:77:9
   |
75 |             json.dump(measurements, fh, indent=4)
76 |
77 |     def merge_from(self, filename: str) -> None:
   |         ^^^^^^^^^^       ------------- Parameter declared here
78 |         """Merge measurements from a file to the current ongoing structure."""
79 |         with open(filename) as fh:
   |
info: Union variant `bound method _Measurements.merge_from(filename: str) -> None` is incompatible with this call site
info: Attempted to call union type `Unknown | (bound method _Measurements.merge_from(filename: str) -> None)`
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:39:42
   |
39 | class ReactivePluginEnvironmentValidator(plugins.validator.PluginEnvironmentValidator):
   |                                          ^^^^^^^^^^^^^^^^^
40 |     """Check the execution environment for the Reactive plugin.
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:77:34
   |
75 |             ) from err
76 |         except subprocess.CalledProcessError as err:
77 |             if err.returncode != plugins.validator.COMMAND_NOT_FOUND:
   |                                  ^^^^^^^^^^^^^^^^^
78 |                 raise PluginEnvironmentValidationError(
79 |                     part_name=self._part_name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> charmcraft/services/package.py:120:20
    |
118 |             try:
119 |                 image_info = json.loads(image_info)
120 |             except json.decoder.JSONDecodeError as exc:
    |                    ^^^^^^^^^^^^
121 |                 msg = f"Failed to parse the content of {const.IMAGE_INFO_ENV_VAR} environment variable"
122 |                 raise errors.CraftError(msg) from exc
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:32:19
   |
30 |     """Charmcraft remote build service."""
31 |
32 |     RecipeClass = launchpad.models.CharmRecipe
   |                   ^^^^^^^^^^^^^^^^
33 |
34 |     def fetch_logs(self, output_dir: pathlib.Path) -> Mapping[str, pathlib.Path | None]:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:63:21
   |
61 |         self,
62 |         name: str,
63 |         repository: launchpad.models.GitRepository,
   |                     ^^^^^^^^^^^^^^^^
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:65:10
   |
63 |         repository: launchpad.models.GitRepository,
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |          ^^^^^^^^^^^^^^^^
66 |         """Create a new recipe."""
67 |         try:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:68:20
   |
66 |         """Create a new recipe."""
67 |         try:
68 |             return launchpad.models.CharmRecipe.new(
   |                    ^^^^^^^^^^^^^^^^
69 |                 self.lp,
70 |                 name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:84:49
   |
83 |     @override
84 |     def _get_build_states(self) -> Mapping[str, launchpad.models.BuildState]:
   |                                                 ^^^^^^^^^^^^^^^^
85 |         self._refresh_builds()
86 |         return {
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
   --> charmcraft/services/store.py:320:21
    |
318 |     def set_resource_revisions_architectures(
319 |         self, name: str, resource_name: str, updates: dict[int, list[str]]
320 |     ) -> Collection[models.resource_revision_model.CharmResourceRevision]:
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321 |         """Set the architectures for one or more resource revisions.
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store'>` has no attribute `http_client`
  --> charmcraft/store/client.py:62:29
   |
60 |         self.api_base_url = api_base_url.rstrip("/")
61 |         self.storage_base_url = storage_base_url.rstrip("/")
62 |         self._http_client = craft_store.http_client.HTTPClient(
   |                             ^^^^^^^^^^^^^^^^^^^^^^^
63 |             user_agent=build_user_agent()
64 |         )
   |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
  --> charmcraft/store/store.py:89:41
   |
87 | def _build_revision(item: dict[str, Any]) -> Revision:
88 |     """Build a Revision from a response item."""
89 |     bases = [(None if base is None else Base(**base)) for base in item["bases"]]
   |                                         ^^^^^^^^^^^^
90 |     return Revision(
91 |         revision=item["revision"],
   |
info: rule `missing-argument` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
   --> charmcraft/store/store.py:404:54
    |
402 |                 expires_at = parser.parse(expires_at)
403 |             resources = [_build_resource(r) for r in item["resources"]]
404 |             base = None if item["base"] is None else Base(**item["base"])
    |                                                      ^^^^^^^^^^^^^^^^^^^^
405 |             channel_map.append(
406 |                 Release(
    |
info: rule `missing-argument` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `error`
  --> charmcraft/utils/yaml.py:35:13
   |
33 |         with fpath.open("r") as fh:
34 |             content = yaml.safe_load(fh)
35 |     except (yaml.error.YAMLError, OSError) as err:
   |             ^^^^^^^^^^
36 |         emit.debug(f"Failed to read/parse config file {str(fpath)!r}: {err!r}")
37 |         return None
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `representer`
  --> charmcraft/utils/yaml.py:58:9
   |
56 |     yaml.add_representer(
57 |         const.CharmArch,
58 |         yaml.representer.SafeRepresenter.represent_str,
   |         ^^^^^^^^^^^^^^^^
59 |         Dumper=yaml.SafeDumper,
60 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.django
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.django`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.django
   |        ^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/custom-action-updatelogfile/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.flask
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.flask`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.flask
   |        ^^^^^^^^^^^^^^^^
13 |
14 | import requests
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:56:16
   |
54 |         except ops.pebble.PathError as e:
55 |             event.fail(str(e.message))
56 |         except requests.exceptions.RequestException as e:
   |                ^^^^^^^^^^^^^^^^^^^
57 |             # if it failed with http bad status code or the connection failed
58 |             if e.response is None:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/flask-async/app.py:3:8
  |
1 | from time import sleep
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.contrib`
  --> docs/tutorial/code/django/urls_django_hello_world.py:17:6
   |
15 |     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
16 | """
17 | from django.contrib import admin
   |      ^^^^^^^^^^^^^^
18 | from django.urls import include, path
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
  --> docs/tutorial/code/django/urls_django_hello_world.py:18:6
   |
16 | """
17 | from django.contrib import admin
18 | from django.urls import include, path
   |      ^^^^^^^^^^^
19 |
20 | urlpatterns = [
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
 --> docs/tutorial/code/django/urls_greeting.py:1:6
  |
1 | from django.urls import path
  |      ^^^^^^^^^^^
2 |
3 | from . import views
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Module `docs.tutorial.code.django` has no member `views`
 --> docs/tutorial/code/django/urls_greeting.py:3:15
  |
1 | from django.urls import path
2 |
3 | from . import views
  |               ^^^^^
4 |
5 | urlpatterns = [
  |
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting.py:1:6
  |
1 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting_configuration.py:3:6
  |
1 | import os
2 |
3 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/app.py:1:6
  |
1 | from fastapi import FastAPI
  |      ^^^^^^^
2 |
3 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/greeting_app.py:3:6
  |
1 | import os
2 |
3 | from fastapi import FastAPI
  |      ^^^^^^^
4 |
5 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/visitors_app.py:7:6
  |
5 | from typing import Annotated
6 |
7 | from fastapi import FastAPI, Header
  |      ^^^^^^^
8 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
  --> docs/tutorial/code/fastapi/visitors_app.py:8:8
   |
 7 | from fastapi import FastAPI, Header
 8 | import psycopg2
   |        ^^^^^^^^
 9 |
10 | app = FastAPI()
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/fastapi/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
6 |
7 | DATABASE_URI = os.environ["POSTGRESQL_DB_CONNECT_STRING"]
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/greeting_app.py:3:8
  |
1 | # Flask app with a greeting configuration
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/visitors_app.py:6:8
  |
4 | import os
5 |
6 | import flask
  |        ^^^^^
7 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_app.py:7:8
  |
6 | import flask
7 | import psycopg2
  |        ^^^^^^^^
8 |
9 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:22:36
   |
22 | def get_fake_revision(**kwargs) -> models.resource_revision_model.CharmResourceRevision:
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |     data = {
24 |         "bases": [],
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:36:12
   |
34 |     }
35 |     data.update(kwargs)
36 |     return models.resource_revision_model.CharmResourceRevision(**data)
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/commands/test_store_api.py:347:12
    |
345 |         "no longer valid, though)."
346 |     )
347 |     assert error.resolution == "Please logout first, then login again."
    |            ^^^^^^^^^^^^^^^^
348 |     assert error.__cause__ is original_exception
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1628:13
     |
1626 |     expected = {
1627 |         (test_lib_id, test_api): Library(
1628 |             api=test_api,
     |             ^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version"]`
1629 |             content=test_content,
1630 |             content_hash=test_hash,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1634:13
     |
1632 |             lib_name=test_lib_name,
1633 |             charm_name=test_charm_name,
1634 |             patch=test_patch,
     |             ^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version"]`
1635 |         ),
1636 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1718:13
     |
1716 |     expected = {
1717 |         (test_lib_id_1, test_api_1): Library(
1718 |             api=test_api_1,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-1"]`
1719 |             content=test_content_1,
1720 |             content_hash=test_hash_1,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1724:13
     |
1722 |             lib_name=test_lib_name_1,
1723 |             charm_name=test_charm_name_1,
1724 |             patch=test_patch_1,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-1"]`
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1727:13
     |
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
1727 |             api=test_api_2,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-2"]`
1728 |             content=test_content_2,
1729 |             content_hash=test_hash_2,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1733:13
     |
1731 |             lib_name=test_lib_name_2,
1732 |             charm_name=test_charm_name_2,
1733 |             patch=test_patch_2,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-2"]`
1734 |         ),
1735 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> tests/commands/test_store_client.py:83:19
   |
81 |             # the craft-store lib expects the error from requests, as what we're
82 |             # faking here normally is a "real response"
83 |             raise requests.exceptions.JSONDecodeError(exc.msg, exc.doc, exc.pos)
   |                   ^^^^^^^^^^^^^^^^^^^
84 |
85 |     @property
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/conftest.py:224:9
    |
222 |         build_base=craft_platforms.DistroBase("ubuntu", "22.04"),
223 |         build_on=arch,
224 |         build_for="arm64",
    |         ^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["arm64"]`
225 |         platform="distro-1-test64",
226 |     )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> tests/conftest.py:354:16
    |
352 |         try:
353 |             output_content = json.loads(raw_output)
354 |         except json.decoder.JSONDecodeError:
    |                ^^^^^^^^^^^^
355 |             pytest.fail("Last command output is not valid JSON.")
356 |         assert output_content == expected_content
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft'>` has no attribute `application`
  --> tests/integration/commands/test_init.py:75:17
   |
73 | def init_command():
74 |     return init.InitCommand(
75 |         {"app": charmcraft.application.APP_METADATA, "services": None}
   |                 ^^^^^^^^^^^^^^^^^^^^^^
76 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `RecordingEmitter` has no attribute `assert_json_output`
   --> tests/integration/commands/test_store_commands.py:225:9
    |
223 |             },
224 |         ]
225 |         emitter.assert_json_output(  # pyright: ignore[reportAttributeAccessIssue]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
226 |             expected
227 |         )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Unresolved attribute `client` on type `AppService`.
  --> tests/integration/conftest.py:45:5
   |
43 |     services.register_services()
44 |     factory = craft_application.ServiceFactory(app=application.APP_METADATA)
45 |     factory.get("store").client = mock.Mock(spec_set=craft_store.StoreClient)  # pyright: ignore[reportAttributeAccessIssue]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 |     factory.update_kwargs(
47 |         "charm_libs",
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/integration/services/test_image.py:28:9
   |
26 |     service = ImageService(
27 |         app=application.APP_METADATA,
28 |         services=None,  # pyright: ignore[reportArgumentType]
   |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
29 |     )
30 |     service.setup()
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:40:17
   |
38 |                 platform="something",
39 |                 build_on=craft_platforms.DebianArchitecture.from_host(),
40 |                 build_for="invalid",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["invalid"]`
41 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
42 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:88:17
   |
86 |                 platform="something",
87 |                 build_on=host_arch,
88 |                 build_for=f"{foreign_arch}-{host_arch}",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
89 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
90 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:9:8
   |
 7 | import pathlib
 8 |
 9 | import charm
   |        ^^^^^
10 | import scenario
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:10:8
   |
 9 | import charm
10 | import scenario
   |        ^^^^^^^^
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario.errors`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:11:8
   |
 9 | import charm
10 | import scenario
11 | import scenario.errors
   |        ^^^^^^^^^^^^^^^
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | # A standalone module for workload-specific logic (no charming concerns):
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `setuptools_scm_python`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:12:8
   |
11 | # A standalone module for workload-specific logic (no charming concerns):
12 | import setuptools_scm_python
   |        ^^^^^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-binary-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/missing-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/no-requirements/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies/charm/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charms.reactive`
 --> tests/spread/smoketests/reactive/reactivecharm/reactive/reactivecharm.py:1:6
  |
1 | from charms.reactive import set_flag, when_not
  |      ^^^^^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-24.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:6:8
  |
4 | import logging
5 |
6 | import ops
  |        ^^^
7 |
8 | # A standalone module for workload-specific logic (no charming concerns):
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `test_cmd`
  --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:9:8
   |
 8 | # A standalone module for workload-specific logic (no charming concerns):
 9 | import test_cmd
   |        ^^^^^^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `pytest_operator.plugin`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/integration/test_charm.py:7:6
  |
5 | import pytest
6 | import yaml
7 | from pytest_operator.plugin import OpsTest
  |      ^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | logger = logging.getLogger(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:2:6
  |
1 | import pytest
2 | from ops import testing
  |      ^^^
3 |
4 | from charm import TestCmdCharm
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:4:6
  |
2 | from ops import testing
3 |
4 | from charm import TestCmdCharm
  |      ^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1237:16
     |
1235 |                 with pytest.raises(SystemExit) as raised:
1236 |                     charm_builder.main()
1237 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1238 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1265:16
     |
1263 |                 with pytest.raises(SystemExit) as raised:
1264 |                     charm_builder.main()
1265 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1266 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:256:32
    |
254 |     assert measurements.measurements == {}
255 |
256 |     with Timer("test message", foo=42):
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
257 |         pass
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:274:28
    |
272 |     monkeypatch.setattr(instrum, "_measurements", measurements)
273 |
274 |     @Timer("test message", foo=42)
    |                            ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
275 |     def test_function(a, b):
276 |         assert a == 17
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:298:32
    |
296 |     assert measurements.measurements == {}
297 |
298 |     with Timer("test message", foo=42) as timer:
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
299 |         timer.mark("middle 1")
300 |         timer.mark("middle 2")
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:75:11
   |
73 |     with pytest.raises(pydantic.ValidationError) as raised:
74 |         parts.process_part_config(data)
75 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
76 |     assert len(err) == 1
77 |     assert err[0]["loc"] == ("color",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:89:11
   |
87 |     with pytest.raises(pydantic.ValidationError) as raised:
88 |         parts.process_part_config(data)
89 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
90 |     assert len(err) == 1
91 |     assert err[0]["loc"] == ("charm-timeout",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:40:15
   |
38 | def test_get_snap_configuration_empty(mock_snap_config):
39 |     def fake_get(key: str):
40 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
41 |
42 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:54:15
   |
52 |         if key == "provider":
53 |             return provider
54 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
55 |
56 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:68:15
   |
66 |         if key == "provider":
67 |             return provider
68 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
69 |
70 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `write`
  --> tests/unit/commands/test_lifecycle.py:91:5
   |
90 |     libs_service = cast("CharmLibsService", service_factory.get("charm_libs"))
91 |     libs_service.write = mock.Mock(wraps=libs_service.write)
   |     ^^^^^^^^^^^^^^^^^^
92 |
93 |     pack._update_charm_libs()
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `bound method CharmLibsService.write(library: Library) -> None` has no attribute `assert_called_once_with`
  --> tests/unit/commands/test_lifecycle.py:95:5
   |
93 |     pack._update_charm_libs()
94 |
95 |     libs_service.write.assert_called_once_with(store_lib)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96 |
97 |     with check():
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:236:12
    |
234 |         fetch_libs.run(argparse.Namespace())
235 |
236 |     assert exc_info.value.resolution == "Add a 'charm-libs' section to charmcraft.yaml."
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:485:9
    |
484 |     assert (
485 |         exc_info.value.resolution
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
486 |         == f"Did you mean: charmcraft promote --from-channel={to_channel} --to-channel={from_channel}"
487 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[non-subscriptable]: Cannot subscript object of type `None` with no `__getitem__` method
  --> tests/unit/models/test_config.py:75:23
   |
73 |     config = JujuConfig(options={"my-opt": option})
74 |
75 |     assert isinstance(config.options["my-opt"], type_)
   |                       ^^^^^^^^^^^^^^
   |
info: rule `non-subscriptable` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/models/test_project.py:582:12
    |
580 |         project.CharmcraftProject.from_yaml_file(pathlib.Path("/charmcraft.yaml"))
581 |
582 |     assert exc.value.details == details
    |            ^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No argument provided for required parameter `type`
   --> tests/unit/models/test_project.py:691:9
    |
689 | ):
690 |     with pytest.raises(error_cls, match=error_match):
691 |         project.BasesCharm(**values)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `missing-argument` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/unit/models/test_project.py:708:13
    |
706 |             description="",
707 |             base=base,
708 |             platforms={"amd64": None},
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `PlatformsDict`, found `dict[@Todo, @Todo]`
709 |             parts={"charm": {"plugin": "charm"}},
710 |         )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:140:11
    |
138 |     with pytest.raises(pydantic.ValidationError) as raised:
139 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
140 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
141 |
142 |     assert len(err) == 1
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:175:11
    |
173 |     with pytest.raises(pydantic.ValidationError) as raised:
174 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
175 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
176 |     assert len(err) == 1
177 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:190:11
    |
188 |     with pytest.raises(pydantic.ValidationError) as raised:
189 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
190 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
191 |     assert len(err) == 1
192 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_poetry.py:40:5
   |
39 | def test_get_pip_install_commands(poetry_plugin: plugins.PoetryPlugin):
40 |     poetry_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
41 |
42 |     assert poetry_plugin._get_pip_install_commands(
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_python.py:62:5
   |
60 |     }
61 |     python_plugin._options = plugins.PythonPluginProperties.unmarshal(spec)
62 |     python_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
63 |     copy_src_cmd = (
64 |         f"cp --archive --recursive --reflink=auto {build_path}/src {install_path}"
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:139:12
    |
137 |         validator.validate_environment()
138 |
139 |     assert raised.value.reason == (
    |            ^^^^^^^^^^^^^^^^^^^
140 |         "charm tool not found and part 'my-part' does not depend on a part named 'charm-tools'"
141 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:153:12
    |
151 |         validator.validate_environment()
152 |
153 |     assert raised.value.reason == "charm tools failed with error code 2"
    |            ^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_analysis.py:112:67
    |
110 | @pytest.fixture
111 | def analysis_service():
112 |     return analysis.AnalysisService(app=application.APP_METADATA, services=None)
    |                                                                   ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
    |
info: Method defined here
  --> charmcraft/services/analysis.py:37:9
   |
35 |     _project: models.CharmcraftProject  # type: ignore[assignment]
36 |
37 |     def __init__(  # (too many arguments)
   |         ^^^^^^^^
38 |         self,
39 |         app: craft_application.AppMetadata,
40 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
41 |     ) -> None:
42 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:55:17
   |
53 |                 platform="something",
54 |                 build_on=HOST_ARCH,
55 |                 build_for=plan_build_for,  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
56 |             )
57 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:94:17
   |
92 |                 platform="something",
93 |                 build_on=HOST_ARCH,
94 |                 build_for=f"{HOST_ARCH}-foreign",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
95 |             )
96 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
  --> tests/unit/services/test_package.py:42:21
   |
40 | )
41 |
42 | SIMPLE_BUILD_BASE = models.charmcraft.Base(
   |                     ^^^^^^^^^^^^^^^^^
43 |     name=HOST_BASE.distribution, channel=HOST_BASE.series, architectures=["arm64"]
44 | )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
   --> tests/unit/services/test_package.py:163:17
    |
161 |             "charmcraft-started-at": "2020-03-14T00:00:00+00:00",
162 |             "bases": [
163 |                 models.charmcraft.Base(
    |                 ^^^^^^^^^^^^^^^^^
164 |                     name=distro.id(),
165 |                     channel=distro.version(),
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_project.py:34:45
   |
32 | @pytest.fixture
33 | def service(project_path):
34 |     return ProjectService(app=APP_METADATA, services=None, project_dir=project_path)
   |                                             ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/project.py:57:9
   |
55 |     _project_model: models.Project | None
56 |
57 |     def __init__(
   |         ^^^^^^^^
58 |         self, app: AppMetadata, services: ServiceFactory, *, project_dir: pathlib.Path
   |                                 ------------------------ Parameter declared here
59 |     ) -> None:
60 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_provider.py:123:9
    |
121 |     provider_service = ProviderService(
122 |         app=APP_METADATA,
123 |         services=None,  # pyright: ignore[reportArgumentType]
    |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
124 |         work_dir=tmp_path,
125 |     )
    |
info: Method defined here
  --> charmcraft/services/provider.py:43:9
   |
41 |     """Business logic for getting providers."""
42 |
43 |     def __init__(
   |         ^^^^^^^^
44 |         self,
45 |         app: craft_application.AppMetadata,
46 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
47 |         *,
48 |         work_dir: pathlib.Path,
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_store.py:50:56
   |
48 | @pytest.fixture(scope="module")
49 | def reusable_store():
50 |     store = StoreService(app=application.APP_METADATA, services=None)
   |                                                        ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
51 |     store.client = mock.Mock(spec_set=craft_store.StoreClient)
52 |     store._publisher = mock.Mock(spec_set=craft_store.PublisherGateway)
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:43:12
   |
41 | )
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:44:12
   |
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:46:9
   |
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 |         == name
48 |     )
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:62:12
   |
60 | )
61 | def test_min_version_regex_matches(string, expected):
62 |     assert linters.MIN_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:76:24
   |
74 | )
75 | def test_approx_version_regex_matches(string, expected):
76 |     assert expected in linters.APPROX_VERSION_REGEX.search(string).group(1, 2)
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:84:12
   |
82 | )
83 | def test_exact_version_regex_matches(string, expected):
84 |     assert linters.EXACT_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/unit/test_parts.py:91:42
   |
89 |         parts.process_part_config(part_config)
90 |
91 |     assert message in {e["msg"] for e in exc_info.value.errors()}
   |                                          ^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[no-matching-overload]: No overload of function `format_content` matches arguments
   --> tests/unit/utils/test_cli.py:285:9
    |
283 | def test_format_content_invalid(fmt):
284 |     with pytest.raises(ValueError, match="^Unknown output format "):
285 |         format_content(None, fmt)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: First overload defined here
   --> charmcraft/utils/cli.py:184:5
    |
183 |   @overload
184 |   def format_content(
    |  _____^
185 | |     content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None
186 | | ) -> str: ...
    | |________^
    |
info: Possible overloads for function `format_content`:
info:   (content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None) -> str
info:   (content: str | Real | list[Unknown] | dict[Unknown, Unknown], fmt: OutputFormat | str | None) -> str
info: Overload implementation defined here
   --> charmcraft/utils/cli.py:195:5
    |
195 | def format_content(content, fmt=None):
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 |     """Format command output."""
197 |     if not isinstance(fmt, OutputFormat):
    |
info: rule `no-matching-overload` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `extra_dependencies`
   --> tests/unit/utils/test_package.py:221:12
    |
219 |         validate_strict_dependencies(dependencies, other_packages)
220 |
221 |     assert exc_info.value.extra_dependencies == extra_packages
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/utils/test_platform.py:162:12
    |
160 |         validate_architectures(architectures)
161 |
162 |     assert exc_info.value.details == details
    |            ^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/utils/test_project.py:111:17
    |
110 |     check.equal(exc_info.value.args, expected.args)
111 |     check.equal(exc_info.value.resolution, expected.resolution)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

Found 124 diagnostics

@github-actions
Copy link
Copy Markdown

Type checking with ty failed. This is a notification only and does not require action.

Command output
error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
    --> charmcraft/application/commands/store.py:2154:29
     |
2152 |     def write_output(
2153 |         fmt: cli.OutputFormat,
2154 |         updates: Collection[models.resource_revision_model.CharmResourceRevision],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2155 |     ) -> None:
2156 |         """Write formatted output for this command to the terminal."""
     |
info: rule `unresolved-attribute` is enabled by default

error[not-iterable]: Object of type `IO[str] | None` may not be iterable
   --> charmcraft/charm_builder.py:423:17
    |
422 |     # https://github.com/microsoft/pylance-release/issues/2385
423 |     for line in proc.stdout:  # pyright: ignore[reportOptionalIterable]
    |                 ^^^^^^^^^^^
424 |         print(f"   :: {line.rstrip()}")
425 |     retcode = proc.wait()
    |
info: It may not have an `__iter__` method and it doesn't have a `__getitem__` method
info: rule `not-iterable` is enabled by default

warning[possibly-unbound-attribute]: Attribute `split` on type `str | None` is possibly unbound
   --> charmcraft/linters.py:238:23
    |
236 |                     yield name.name.split(".")
237 |             elif isinstance(node, ast.ImportFrom):
238 |                 yield node.module.split(".")
    |                       ^^^^^^^^^^^^^^^^^
239 |
240 |     def _check_operator(self, basedir: pathlib.Path) -> bool:
    |
info: rule `possibly-unbound-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `merge_from` is incorrect
   --> charmcraft/parts/plugins/_charm.py:341:28
    |
339 |     def post_build_callback(self, step_info):
340 |         """Collect metrics left by charm_builder.py."""
341 |         instrum.merge_from(env.get_charm_builder_metrics_path())
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str`, found `Path`
342 |
343 |     def _get_os_special_priority_paths(self) -> str | None:
    |
info: Method defined here
  --> charmcraft/instrum.py:77:9
   |
75 |             json.dump(measurements, fh, indent=4)
76 |
77 |     def merge_from(self, filename: str) -> None:
   |         ^^^^^^^^^^       ------------- Parameter declared here
78 |         """Merge measurements from a file to the current ongoing structure."""
79 |         with open(filename) as fh:
   |
info: Union variant `bound method _Measurements.merge_from(filename: str) -> None` is incompatible with this call site
info: Attempted to call union type `Unknown | (bound method _Measurements.merge_from(filename: str) -> None)`
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:39:42
   |
39 | class ReactivePluginEnvironmentValidator(plugins.validator.PluginEnvironmentValidator):
   |                                          ^^^^^^^^^^^^^^^^^
40 |     """Check the execution environment for the Reactive plugin.
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:77:34
   |
75 |             ) from err
76 |         except subprocess.CalledProcessError as err:
77 |             if err.returncode != plugins.validator.COMMAND_NOT_FOUND:
   |                                  ^^^^^^^^^^^^^^^^^
78 |                 raise PluginEnvironmentValidationError(
79 |                     part_name=self._part_name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> charmcraft/services/package.py:120:20
    |
118 |             try:
119 |                 image_info = json.loads(image_info)
120 |             except json.decoder.JSONDecodeError as exc:
    |                    ^^^^^^^^^^^^
121 |                 msg = f"Failed to parse the content of {const.IMAGE_INFO_ENV_VAR} environment variable"
122 |                 raise errors.CraftError(msg) from exc
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:32:19
   |
30 |     """Charmcraft remote build service."""
31 |
32 |     RecipeClass = launchpad.models.CharmRecipe
   |                   ^^^^^^^^^^^^^^^^
33 |
34 |     def fetch_logs(self, output_dir: pathlib.Path) -> Mapping[str, pathlib.Path | None]:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:63:21
   |
61 |         self,
62 |         name: str,
63 |         repository: launchpad.models.GitRepository,
   |                     ^^^^^^^^^^^^^^^^
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:65:10
   |
63 |         repository: launchpad.models.GitRepository,
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |          ^^^^^^^^^^^^^^^^
66 |         """Create a new recipe."""
67 |         try:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:68:20
   |
66 |         """Create a new recipe."""
67 |         try:
68 |             return launchpad.models.CharmRecipe.new(
   |                    ^^^^^^^^^^^^^^^^
69 |                 self.lp,
70 |                 name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:84:49
   |
83 |     @override
84 |     def _get_build_states(self) -> Mapping[str, launchpad.models.BuildState]:
   |                                                 ^^^^^^^^^^^^^^^^
85 |         self._refresh_builds()
86 |         return {
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
   --> charmcraft/services/store.py:320:21
    |
318 |     def set_resource_revisions_architectures(
319 |         self, name: str, resource_name: str, updates: dict[int, list[str]]
320 |     ) -> Collection[models.resource_revision_model.CharmResourceRevision]:
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321 |         """Set the architectures for one or more resource revisions.
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store'>` has no attribute `http_client`
  --> charmcraft/store/client.py:62:29
   |
60 |         self.api_base_url = api_base_url.rstrip("/")
61 |         self.storage_base_url = storage_base_url.rstrip("/")
62 |         self._http_client = craft_store.http_client.HTTPClient(
   |                             ^^^^^^^^^^^^^^^^^^^^^^^
63 |             user_agent=build_user_agent()
64 |         )
   |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
  --> charmcraft/store/store.py:89:41
   |
87 | def _build_revision(item: dict[str, Any]) -> Revision:
88 |     """Build a Revision from a response item."""
89 |     bases = [(None if base is None else Base(**base)) for base in item["bases"]]
   |                                         ^^^^^^^^^^^^
90 |     return Revision(
91 |         revision=item["revision"],
   |
info: rule `missing-argument` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
   --> charmcraft/store/store.py:404:54
    |
402 |                 expires_at = parser.parse(expires_at)
403 |             resources = [_build_resource(r) for r in item["resources"]]
404 |             base = None if item["base"] is None else Base(**item["base"])
    |                                                      ^^^^^^^^^^^^^^^^^^^^
405 |             channel_map.append(
406 |                 Release(
    |
info: rule `missing-argument` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `error`
  --> charmcraft/utils/yaml.py:35:13
   |
33 |         with fpath.open("r") as fh:
34 |             content = yaml.safe_load(fh)
35 |     except (yaml.error.YAMLError, OSError) as err:
   |             ^^^^^^^^^^
36 |         emit.debug(f"Failed to read/parse config file {str(fpath)!r}: {err!r}")
37 |         return None
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `representer`
  --> charmcraft/utils/yaml.py:58:9
   |
56 |     yaml.add_representer(
57 |         const.CharmArch,
58 |         yaml.representer.SafeRepresenter.represent_str,
   |         ^^^^^^^^^^^^^^^^
59 |         Dumper=yaml.SafeDumper,
60 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.django
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.django`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.django
   |        ^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/custom-action-updatelogfile/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.flask
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.flask`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.flask
   |        ^^^^^^^^^^^^^^^^
13 |
14 | import requests
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:56:16
   |
54 |         except ops.pebble.PathError as e:
55 |             event.fail(str(e.message))
56 |         except requests.exceptions.RequestException as e:
   |                ^^^^^^^^^^^^^^^^^^^
57 |             # if it failed with http bad status code or the connection failed
58 |             if e.response is None:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/flask-async/app.py:3:8
  |
1 | from time import sleep
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.contrib`
  --> docs/tutorial/code/django/urls_django_hello_world.py:17:6
   |
15 |     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
16 | """
17 | from django.contrib import admin
   |      ^^^^^^^^^^^^^^
18 | from django.urls import include, path
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
  --> docs/tutorial/code/django/urls_django_hello_world.py:18:6
   |
16 | """
17 | from django.contrib import admin
18 | from django.urls import include, path
   |      ^^^^^^^^^^^
19 |
20 | urlpatterns = [
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
 --> docs/tutorial/code/django/urls_greeting.py:1:6
  |
1 | from django.urls import path
  |      ^^^^^^^^^^^
2 |
3 | from . import views
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Module `docs.tutorial.code.django` has no member `views`
 --> docs/tutorial/code/django/urls_greeting.py:3:15
  |
1 | from django.urls import path
2 |
3 | from . import views
  |               ^^^^^
4 |
5 | urlpatterns = [
  |
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting.py:1:6
  |
1 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting_configuration.py:3:6
  |
1 | import os
2 |
3 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/app.py:1:6
  |
1 | from fastapi import FastAPI
  |      ^^^^^^^
2 |
3 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/greeting_app.py:3:6
  |
1 | import os
2 |
3 | from fastapi import FastAPI
  |      ^^^^^^^
4 |
5 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/visitors_app.py:7:6
  |
5 | from typing import Annotated
6 |
7 | from fastapi import FastAPI, Header
  |      ^^^^^^^
8 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
  --> docs/tutorial/code/fastapi/visitors_app.py:8:8
   |
 7 | from fastapi import FastAPI, Header
 8 | import psycopg2
   |        ^^^^^^^^
 9 |
10 | app = FastAPI()
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/fastapi/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
6 |
7 | DATABASE_URI = os.environ["POSTGRESQL_DB_CONNECT_STRING"]
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/greeting_app.py:3:8
  |
1 | # Flask app with a greeting configuration
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/visitors_app.py:6:8
  |
4 | import os
5 |
6 | import flask
  |        ^^^^^
7 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_app.py:7:8
  |
6 | import flask
7 | import psycopg2
  |        ^^^^^^^^
8 |
9 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:22:36
   |
22 | def get_fake_revision(**kwargs) -> models.resource_revision_model.CharmResourceRevision:
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |     data = {
24 |         "bases": [],
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:36:12
   |
34 |     }
35 |     data.update(kwargs)
36 |     return models.resource_revision_model.CharmResourceRevision(**data)
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/commands/test_store_api.py:347:12
    |
345 |         "no longer valid, though)."
346 |     )
347 |     assert error.resolution == "Please logout first, then login again."
    |            ^^^^^^^^^^^^^^^^
348 |     assert error.__cause__ is original_exception
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1628:13
     |
1626 |     expected = {
1627 |         (test_lib_id, test_api): Library(
1628 |             api=test_api,
     |             ^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version"]`
1629 |             content=test_content,
1630 |             content_hash=test_hash,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1634:13
     |
1632 |             lib_name=test_lib_name,
1633 |             charm_name=test_charm_name,
1634 |             patch=test_patch,
     |             ^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version"]`
1635 |         ),
1636 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1718:13
     |
1716 |     expected = {
1717 |         (test_lib_id_1, test_api_1): Library(
1718 |             api=test_api_1,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-1"]`
1719 |             content=test_content_1,
1720 |             content_hash=test_hash_1,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1724:13
     |
1722 |             lib_name=test_lib_name_1,
1723 |             charm_name=test_charm_name_1,
1724 |             patch=test_patch_1,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-1"]`
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1727:13
     |
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
1727 |             api=test_api_2,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-2"]`
1728 |             content=test_content_2,
1729 |             content_hash=test_hash_2,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1733:13
     |
1731 |             lib_name=test_lib_name_2,
1732 |             charm_name=test_charm_name_2,
1733 |             patch=test_patch_2,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-2"]`
1734 |         ),
1735 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> tests/commands/test_store_client.py:83:19
   |
81 |             # the craft-store lib expects the error from requests, as what we're
82 |             # faking here normally is a "real response"
83 |             raise requests.exceptions.JSONDecodeError(exc.msg, exc.doc, exc.pos)
   |                   ^^^^^^^^^^^^^^^^^^^
84 |
85 |     @property
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/conftest.py:224:9
    |
222 |         build_base=craft_platforms.DistroBase("ubuntu", "22.04"),
223 |         build_on=arch,
224 |         build_for="arm64",
    |         ^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["arm64"]`
225 |         platform="distro-1-test64",
226 |     )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> tests/conftest.py:354:16
    |
352 |         try:
353 |             output_content = json.loads(raw_output)
354 |         except json.decoder.JSONDecodeError:
    |                ^^^^^^^^^^^^
355 |             pytest.fail("Last command output is not valid JSON.")
356 |         assert output_content == expected_content
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft'>` has no attribute `application`
  --> tests/integration/commands/test_init.py:75:17
   |
73 | def init_command():
74 |     return init.InitCommand(
75 |         {"app": charmcraft.application.APP_METADATA, "services": None}
   |                 ^^^^^^^^^^^^^^^^^^^^^^
76 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `RecordingEmitter` has no attribute `assert_json_output`
   --> tests/integration/commands/test_store_commands.py:225:9
    |
223 |             },
224 |         ]
225 |         emitter.assert_json_output(  # pyright: ignore[reportAttributeAccessIssue]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
226 |             expected
227 |         )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Unresolved attribute `client` on type `AppService`.
  --> tests/integration/conftest.py:45:5
   |
43 |     services.register_services()
44 |     factory = craft_application.ServiceFactory(app=application.APP_METADATA)
45 |     factory.get("store").client = mock.Mock(spec_set=craft_store.StoreClient)  # pyright: ignore[reportAttributeAccessIssue]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 |     factory.update_kwargs(
47 |         "charm_libs",
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/integration/services/test_image.py:28:9
   |
26 |     service = ImageService(
27 |         app=application.APP_METADATA,
28 |         services=None,  # pyright: ignore[reportArgumentType]
   |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
29 |     )
30 |     service.setup()
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:40:17
   |
38 |                 platform="something",
39 |                 build_on=craft_platforms.DebianArchitecture.from_host(),
40 |                 build_for="invalid",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["invalid"]`
41 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
42 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:88:17
   |
86 |                 platform="something",
87 |                 build_on=host_arch,
88 |                 build_for=f"{foreign_arch}-{host_arch}",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
89 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
90 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:9:8
   |
 7 | import pathlib
 8 |
 9 | import charm
   |        ^^^^^
10 | import scenario
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:10:8
   |
 9 | import charm
10 | import scenario
   |        ^^^^^^^^
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario.errors`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:11:8
   |
 9 | import charm
10 | import scenario
11 | import scenario.errors
   |        ^^^^^^^^^^^^^^^
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | # A standalone module for workload-specific logic (no charming concerns):
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `setuptools_scm_python`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:12:8
   |
11 | # A standalone module for workload-specific logic (no charming concerns):
12 | import setuptools_scm_python
   |        ^^^^^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-binary-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/missing-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/no-requirements/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies/charm/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charms.reactive`
 --> tests/spread/smoketests/reactive/reactivecharm/reactive/reactivecharm.py:1:6
  |
1 | from charms.reactive import set_flag, when_not
  |      ^^^^^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-24.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:6:8
  |
4 | import logging
5 |
6 | import ops
  |        ^^^
7 |
8 | # A standalone module for workload-specific logic (no charming concerns):
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `test_cmd`
  --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:9:8
   |
 8 | # A standalone module for workload-specific logic (no charming concerns):
 9 | import test_cmd
   |        ^^^^^^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `pytest_operator.plugin`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/integration/test_charm.py:7:6
  |
5 | import pytest
6 | import yaml
7 | from pytest_operator.plugin import OpsTest
  |      ^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | logger = logging.getLogger(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:2:6
  |
1 | import pytest
2 | from ops import testing
  |      ^^^
3 |
4 | from charm import TestCmdCharm
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:4:6
  |
2 | from ops import testing
3 |
4 | from charm import TestCmdCharm
  |      ^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1237:16
     |
1235 |                 with pytest.raises(SystemExit) as raised:
1236 |                     charm_builder.main()
1237 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1238 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1265:16
     |
1263 |                 with pytest.raises(SystemExit) as raised:
1264 |                     charm_builder.main()
1265 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1266 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:256:32
    |
254 |     assert measurements.measurements == {}
255 |
256 |     with Timer("test message", foo=42):
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
257 |         pass
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:274:28
    |
272 |     monkeypatch.setattr(instrum, "_measurements", measurements)
273 |
274 |     @Timer("test message", foo=42)
    |                            ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
275 |     def test_function(a, b):
276 |         assert a == 17
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:298:32
    |
296 |     assert measurements.measurements == {}
297 |
298 |     with Timer("test message", foo=42) as timer:
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
299 |         timer.mark("middle 1")
300 |         timer.mark("middle 2")
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:75:11
   |
73 |     with pytest.raises(pydantic.ValidationError) as raised:
74 |         parts.process_part_config(data)
75 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
76 |     assert len(err) == 1
77 |     assert err[0]["loc"] == ("color",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:89:11
   |
87 |     with pytest.raises(pydantic.ValidationError) as raised:
88 |         parts.process_part_config(data)
89 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
90 |     assert len(err) == 1
91 |     assert err[0]["loc"] == ("charm-timeout",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:40:15
   |
38 | def test_get_snap_configuration_empty(mock_snap_config):
39 |     def fake_get(key: str):
40 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
41 |
42 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:54:15
   |
52 |         if key == "provider":
53 |             return provider
54 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
55 |
56 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:68:15
   |
66 |         if key == "provider":
67 |             return provider
68 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
69 |
70 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `write`
  --> tests/unit/commands/test_lifecycle.py:91:5
   |
90 |     libs_service = cast("CharmLibsService", service_factory.get("charm_libs"))
91 |     libs_service.write = mock.Mock(wraps=libs_service.write)
   |     ^^^^^^^^^^^^^^^^^^
92 |
93 |     pack._update_charm_libs()
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `bound method CharmLibsService.write(library: Library) -> None` has no attribute `assert_called_once_with`
  --> tests/unit/commands/test_lifecycle.py:95:5
   |
93 |     pack._update_charm_libs()
94 |
95 |     libs_service.write.assert_called_once_with(store_lib)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96 |
97 |     with check():
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:236:12
    |
234 |         fetch_libs.run(argparse.Namespace())
235 |
236 |     assert exc_info.value.resolution == "Add a 'charm-libs' section to charmcraft.yaml."
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:485:9
    |
484 |     assert (
485 |         exc_info.value.resolution
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
486 |         == f"Did you mean: charmcraft promote --from-channel={to_channel} --to-channel={from_channel}"
487 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[non-subscriptable]: Cannot subscript object of type `None` with no `__getitem__` method
  --> tests/unit/models/test_config.py:75:23
   |
73 |     config = JujuConfig(options={"my-opt": option})
74 |
75 |     assert isinstance(config.options["my-opt"], type_)
   |                       ^^^^^^^^^^^^^^
   |
info: rule `non-subscriptable` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/models/test_project.py:582:12
    |
580 |         project.CharmcraftProject.from_yaml_file(pathlib.Path("/charmcraft.yaml"))
581 |
582 |     assert exc.value.details == details
    |            ^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No argument provided for required parameter `type`
   --> tests/unit/models/test_project.py:691:9
    |
689 | ):
690 |     with pytest.raises(error_cls, match=error_match):
691 |         project.BasesCharm(**values)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `missing-argument` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/unit/models/test_project.py:708:13
    |
706 |             description="",
707 |             base=base,
708 |             platforms={"amd64": None},
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `PlatformsDict`, found `dict[@Todo, @Todo]`
709 |             parts={"charm": {"plugin": "charm"}},
710 |         )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:140:11
    |
138 |     with pytest.raises(pydantic.ValidationError) as raised:
139 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
140 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
141 |
142 |     assert len(err) == 1
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:175:11
    |
173 |     with pytest.raises(pydantic.ValidationError) as raised:
174 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
175 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
176 |     assert len(err) == 1
177 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:190:11
    |
188 |     with pytest.raises(pydantic.ValidationError) as raised:
189 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
190 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
191 |     assert len(err) == 1
192 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_poetry.py:40:5
   |
39 | def test_get_pip_install_commands(poetry_plugin: plugins.PoetryPlugin):
40 |     poetry_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
41 |
42 |     assert poetry_plugin._get_pip_install_commands(
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_python.py:62:5
   |
60 |     }
61 |     python_plugin._options = plugins.PythonPluginProperties.unmarshal(spec)
62 |     python_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
63 |     copy_src_cmd = (
64 |         f"cp --archive --recursive --reflink=auto {build_path}/src {install_path}"
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:139:12
    |
137 |         validator.validate_environment()
138 |
139 |     assert raised.value.reason == (
    |            ^^^^^^^^^^^^^^^^^^^
140 |         "charm tool not found and part 'my-part' does not depend on a part named 'charm-tools'"
141 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:153:12
    |
151 |         validator.validate_environment()
152 |
153 |     assert raised.value.reason == "charm tools failed with error code 2"
    |            ^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_analysis.py:112:67
    |
110 | @pytest.fixture
111 | def analysis_service():
112 |     return analysis.AnalysisService(app=application.APP_METADATA, services=None)
    |                                                                   ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
    |
info: Method defined here
  --> charmcraft/services/analysis.py:37:9
   |
35 |     _project: models.CharmcraftProject  # type: ignore[assignment]
36 |
37 |     def __init__(  # (too many arguments)
   |         ^^^^^^^^
38 |         self,
39 |         app: craft_application.AppMetadata,
40 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
41 |     ) -> None:
42 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:55:17
   |
53 |                 platform="something",
54 |                 build_on=HOST_ARCH,
55 |                 build_for=plan_build_for,  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
56 |             )
57 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:94:17
   |
92 |                 platform="something",
93 |                 build_on=HOST_ARCH,
94 |                 build_for=f"{HOST_ARCH}-foreign",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
95 |             )
96 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
  --> tests/unit/services/test_package.py:42:21
   |
40 | )
41 |
42 | SIMPLE_BUILD_BASE = models.charmcraft.Base(
   |                     ^^^^^^^^^^^^^^^^^
43 |     name=HOST_BASE.distribution, channel=HOST_BASE.series, architectures=["arm64"]
44 | )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
   --> tests/unit/services/test_package.py:163:17
    |
161 |             "charmcraft-started-at": "2020-03-14T00:00:00+00:00",
162 |             "bases": [
163 |                 models.charmcraft.Base(
    |                 ^^^^^^^^^^^^^^^^^
164 |                     name=distro.id(),
165 |                     channel=distro.version(),
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_project.py:34:45
   |
32 | @pytest.fixture
33 | def service(project_path):
34 |     return ProjectService(app=APP_METADATA, services=None, project_dir=project_path)
   |                                             ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/project.py:58:9
   |
56 |     _project_model: models.Project | None
57 |
58 |     def __init__(
   |         ^^^^^^^^
59 |         self, app: AppMetadata, services: ServiceFactory, *, project_dir: pathlib.Path
   |                                 ------------------------ Parameter declared here
60 |     ) -> None:
61 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_provider.py:123:9
    |
121 |     provider_service = ProviderService(
122 |         app=APP_METADATA,
123 |         services=None,  # pyright: ignore[reportArgumentType]
    |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
124 |         work_dir=tmp_path,
125 |     )
    |
info: Method defined here
  --> charmcraft/services/provider.py:43:9
   |
41 |     """Business logic for getting providers."""
42 |
43 |     def __init__(
   |         ^^^^^^^^
44 |         self,
45 |         app: craft_application.AppMetadata,
46 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
47 |         *,
48 |         work_dir: pathlib.Path,
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_store.py:50:56
   |
48 | @pytest.fixture(scope="module")
49 | def reusable_store():
50 |     store = StoreService(app=application.APP_METADATA, services=None)
   |                                                        ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
51 |     store.client = mock.Mock(spec_set=craft_store.StoreClient)
52 |     store._publisher = mock.Mock(spec_set=craft_store.PublisherGateway)
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:43:12
   |
41 | )
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:44:12
   |
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:46:9
   |
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 |         == name
48 |     )
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:62:12
   |
60 | )
61 | def test_min_version_regex_matches(string, expected):
62 |     assert linters.MIN_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:76:24
   |
74 | )
75 | def test_approx_version_regex_matches(string, expected):
76 |     assert expected in linters.APPROX_VERSION_REGEX.search(string).group(1, 2)
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:84:12
   |
82 | )
83 | def test_exact_version_regex_matches(string, expected):
84 |     assert linters.EXACT_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/unit/test_parts.py:91:42
   |
89 |         parts.process_part_config(part_config)
90 |
91 |     assert message in {e["msg"] for e in exc_info.value.errors()}
   |                                          ^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[no-matching-overload]: No overload of function `format_content` matches arguments
   --> tests/unit/utils/test_cli.py:285:9
    |
283 | def test_format_content_invalid(fmt):
284 |     with pytest.raises(ValueError, match="^Unknown output format "):
285 |         format_content(None, fmt)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: First overload defined here
   --> charmcraft/utils/cli.py:184:5
    |
183 |   @overload
184 |   def format_content(
    |  _____^
185 | |     content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None
186 | | ) -> str: ...
    | |________^
    |
info: Possible overloads for function `format_content`:
info:   (content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None) -> str
info:   (content: str | Real | list[Unknown] | dict[Unknown, Unknown], fmt: OutputFormat | str | None) -> str
info: Overload implementation defined here
   --> charmcraft/utils/cli.py:195:5
    |
195 | def format_content(content, fmt=None):
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 |     """Format command output."""
197 |     if not isinstance(fmt, OutputFormat):
    |
info: rule `no-matching-overload` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `extra_dependencies`
   --> tests/unit/utils/test_package.py:221:12
    |
219 |         validate_strict_dependencies(dependencies, other_packages)
220 |
221 |     assert exc_info.value.extra_dependencies == extra_packages
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/utils/test_platform.py:162:12
    |
160 |         validate_architectures(architectures)
161 |
162 |     assert exc_info.value.details == details
    |            ^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/utils/test_project.py:111:17
    |
110 |     check.equal(exc_info.value.args, expected.args)
111 |     check.equal(exc_info.value.resolution, expected.resolution)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

Found 124 diagnostics

@github-actions
Copy link
Copy Markdown

Type checking with ty failed. This is a notification only and does not require action.

Command output
error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
    --> charmcraft/application/commands/store.py:2154:29
     |
2152 |     def write_output(
2153 |         fmt: cli.OutputFormat,
2154 |         updates: Collection[models.resource_revision_model.CharmResourceRevision],
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2155 |     ) -> None:
2156 |         """Write formatted output for this command to the terminal."""
     |
info: rule `unresolved-attribute` is enabled by default

error[not-iterable]: Object of type `IO[str] | None` may not be iterable
   --> charmcraft/charm_builder.py:423:17
    |
422 |     # https://github.com/microsoft/pylance-release/issues/2385
423 |     for line in proc.stdout:  # pyright: ignore[reportOptionalIterable]
    |                 ^^^^^^^^^^^
424 |         print(f"   :: {line.rstrip()}")
425 |     retcode = proc.wait()
    |
info: It may not have an `__iter__` method and it doesn't have a `__getitem__` method
info: rule `not-iterable` is enabled by default

warning[possibly-unbound-attribute]: Attribute `split` on type `str | None` is possibly unbound
   --> charmcraft/linters.py:238:23
    |
236 |                     yield name.name.split(".")
237 |             elif isinstance(node, ast.ImportFrom):
238 |                 yield node.module.split(".")
    |                       ^^^^^^^^^^^^^^^^^
239 |
240 |     def _check_operator(self, basedir: pathlib.Path) -> bool:
    |
info: rule `possibly-unbound-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `merge_from` is incorrect
   --> charmcraft/parts/plugins/_charm.py:341:28
    |
339 |     def post_build_callback(self, step_info):
340 |         """Collect metrics left by charm_builder.py."""
341 |         instrum.merge_from(env.get_charm_builder_metrics_path())
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str`, found `Path`
342 |
343 |     def _get_os_special_priority_paths(self) -> str | None:
    |
info: Method defined here
  --> charmcraft/instrum.py:77:9
   |
75 |             json.dump(measurements, fh, indent=4)
76 |
77 |     def merge_from(self, filename: str) -> None:
   |         ^^^^^^^^^^       ------------- Parameter declared here
78 |         """Merge measurements from a file to the current ongoing structure."""
79 |         with open(filename) as fh:
   |
info: Union variant `bound method _Measurements.merge_from(filename: str) -> None` is incompatible with this call site
info: Attempted to call union type `Unknown | (bound method _Measurements.merge_from(filename: str) -> None)`
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:39:42
   |
39 | class ReactivePluginEnvironmentValidator(plugins.validator.PluginEnvironmentValidator):
   |                                          ^^^^^^^^^^^^^^^^^
40 |     """Check the execution environment for the Reactive plugin.
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_parts.plugins'>` has no attribute `validator`
  --> charmcraft/parts/plugins/_reactive.py:77:34
   |
75 |             ) from err
76 |         except subprocess.CalledProcessError as err:
77 |             if err.returncode != plugins.validator.COMMAND_NOT_FOUND:
   |                                  ^^^^^^^^^^^^^^^^^
78 |                 raise PluginEnvironmentValidationError(
79 |                     part_name=self._part_name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> charmcraft/services/package.py:120:20
    |
118 |             try:
119 |                 image_info = json.loads(image_info)
120 |             except json.decoder.JSONDecodeError as exc:
    |                    ^^^^^^^^^^^^
121 |                 msg = f"Failed to parse the content of {const.IMAGE_INFO_ENV_VAR} environment variable"
122 |                 raise errors.CraftError(msg) from exc
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:32:19
   |
30 |     """Charmcraft remote build service."""
31 |
32 |     RecipeClass = launchpad.models.CharmRecipe
   |                   ^^^^^^^^^^^^^^^^
33 |
34 |     def fetch_logs(self, output_dir: pathlib.Path) -> Mapping[str, pathlib.Path | None]:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:63:21
   |
61 |         self,
62 |         name: str,
63 |         repository: launchpad.models.GitRepository,
   |                     ^^^^^^^^^^^^^^^^
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:65:10
   |
63 |         repository: launchpad.models.GitRepository,
64 |         **_: Any,
65 |     ) -> launchpad.models.Recipe:
   |          ^^^^^^^^^^^^^^^^
66 |         """Create a new recipe."""
67 |         try:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:68:20
   |
66 |         """Create a new recipe."""
67 |         try:
68 |             return launchpad.models.CharmRecipe.new(
   |                    ^^^^^^^^^^^^^^^^
69 |                 self.lp,
70 |                 name,
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_application.launchpad'>` has no attribute `models`
  --> charmcraft/services/remotebuild.py:84:49
   |
83 |     @override
84 |     def _get_build_states(self) -> Mapping[str, launchpad.models.BuildState]:
   |                                                 ^^^^^^^^^^^^^^^^
85 |         self._refresh_builds()
86 |         return {
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
   --> charmcraft/services/store.py:320:21
    |
318 |     def set_resource_revisions_architectures(
319 |         self, name: str, resource_name: str, updates: dict[int, list[str]]
320 |     ) -> Collection[models.resource_revision_model.CharmResourceRevision]:
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321 |         """Set the architectures for one or more resource revisions.
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store'>` has no attribute `http_client`
  --> charmcraft/store/client.py:62:29
   |
60 |         self.api_base_url = api_base_url.rstrip("/")
61 |         self.storage_base_url = storage_base_url.rstrip("/")
62 |         self._http_client = craft_store.http_client.HTTPClient(
   |                             ^^^^^^^^^^^^^^^^^^^^^^^
63 |             user_agent=build_user_agent()
64 |         )
   |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
  --> charmcraft/store/store.py:89:41
   |
87 | def _build_revision(item: dict[str, Any]) -> Revision:
88 |     """Build a Revision from a response item."""
89 |     bases = [(None if base is None else Base(**base)) for base in item["bases"]]
   |                                         ^^^^^^^^^^^^
90 |     return Revision(
91 |         revision=item["revision"],
   |
info: rule `missing-argument` is enabled by default

error[missing-argument]: No arguments provided for required parameters `architecture`, `channel`, `name`
   --> charmcraft/store/store.py:404:54
    |
402 |                 expires_at = parser.parse(expires_at)
403 |             resources = [_build_resource(r) for r in item["resources"]]
404 |             base = None if item["base"] is None else Base(**item["base"])
    |                                                      ^^^^^^^^^^^^^^^^^^^^
405 |             channel_map.append(
406 |                 Release(
    |
info: rule `missing-argument` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `error`
  --> charmcraft/utils/yaml.py:35:13
   |
33 |         with fpath.open("r") as fh:
34 |             content = yaml.safe_load(fh)
35 |     except (yaml.error.YAMLError, OSError) as err:
   |             ^^^^^^^^^^
36 |         emit.debug(f"Failed to read/parse config file {str(fpath)!r}: {err!r}")
37 |         return None
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'yaml'>` has no attribute `representer`
  --> charmcraft/utils/yaml.py:58:9
   |
56 |     yaml.add_representer(
57 |         const.CharmArch,
58 |         yaml.representer.SafeRepresenter.represent_str,
   |         ^^^^^^^^^^^^^^^^
59 |         Dumper=yaml.SafeDumper,
60 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.django
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.django`
  --> docs/howto/code/custom-action-clearsession/clearsession_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.django
   |        ^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/custom-action-updatelogfile/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:10:8
   |
 8 | import typing
 9 |
10 | import ops
   |        ^^^
11 |
12 | import paas_charm.flask
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `paas_charm.flask`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:12:8
   |
10 | import ops
11 |
12 | import paas_charm.flask
   |        ^^^^^^^^^^^^^^^^
13 |
14 | import requests
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> docs/howto/code/custom-action-updatelogfile/updatelogfile_action_charm.py:56:16
   |
54 |         except ops.pebble.PathError as e:
55 |             event.fail(str(e.message))
56 |         except requests.exceptions.RequestException as e:
   |                ^^^^^^^^^^^^^^^^^^^
57 |             # if it failed with http bad status code or the connection failed
58 |             if e.response is None:
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/howto/code/flask-async/app.py:3:8
  |
1 | from time import sleep
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.contrib`
  --> docs/tutorial/code/django/urls_django_hello_world.py:17:6
   |
15 |     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
16 | """
17 | from django.contrib import admin
   |      ^^^^^^^^^^^^^^
18 | from django.urls import include, path
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
  --> docs/tutorial/code/django/urls_django_hello_world.py:18:6
   |
16 | """
17 | from django.contrib import admin
18 | from django.urls import include, path
   |      ^^^^^^^^^^^
19 |
20 | urlpatterns = [
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.urls`
 --> docs/tutorial/code/django/urls_greeting.py:1:6
  |
1 | from django.urls import path
  |      ^^^^^^^^^^^
2 |
3 | from . import views
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Module `docs.tutorial.code.django` has no member `views`
 --> docs/tutorial/code/django/urls_greeting.py:3:15
  |
1 | from django.urls import path
2 |
3 | from . import views
  |               ^^^^^
4 |
5 | urlpatterns = [
  |
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting.py:1:6
  |
1 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `django.http`
 --> docs/tutorial/code/django/views_greeting_configuration.py:3:6
  |
1 | import os
2 |
3 | from django.http import HttpResponse
  |      ^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/app.py:1:6
  |
1 | from fastapi import FastAPI
  |      ^^^^^^^
2 |
3 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/greeting_app.py:3:6
  |
1 | import os
2 |
3 | from fastapi import FastAPI
  |      ^^^^^^^
4 |
5 | app = FastAPI()
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `fastapi`
 --> docs/tutorial/code/fastapi/visitors_app.py:7:6
  |
5 | from typing import Annotated
6 |
7 | from fastapi import FastAPI, Header
  |      ^^^^^^^
8 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
  --> docs/tutorial/code/fastapi/visitors_app.py:8:8
   |
 7 | from fastapi import FastAPI, Header
 8 | import psycopg2
   |        ^^^^^^^^
 9 |
10 | app = FastAPI()
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/fastapi/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
6 |
7 | DATABASE_URI = os.environ["POSTGRESQL_DB_CONNECT_STRING"]
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/app.py:3:8
  |
1 | # initial hello world Flask app
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/greeting_app.py:3:8
  |
1 | # Flask app with a greeting configuration
2 |
3 | import flask
  |        ^^^^^
4 |
5 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `flask`
 --> docs/tutorial/code/flask/visitors_app.py:6:8
  |
4 | import os
5 |
6 | import flask
  |        ^^^^^
7 | import psycopg2
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_app.py:7:8
  |
6 | import flask
7 | import psycopg2
  |        ^^^^^^^^
8 |
9 | app = flask.Flask(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `psycopg2`
 --> docs/tutorial/code/flask/visitors_migrate.py:5:8
  |
3 | import os
4 |
5 | import psycopg2
  |        ^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:22:36
   |
22 | def get_fake_revision(**kwargs) -> models.resource_revision_model.CharmResourceRevision:
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |     data = {
24 |         "bases": [],
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'craft_store.models'>` has no attribute `resource_revision_model`
  --> tests/__init__.py:36:12
   |
34 |     }
35 |     data.update(kwargs)
36 |     return models.resource_revision_model.CharmResourceRevision(**data)
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/commands/test_store_api.py:347:12
    |
345 |         "no longer valid, though)."
346 |     )
347 |     assert error.resolution == "Please logout first, then login again."
    |            ^^^^^^^^^^^^^^^^
348 |     assert error.__cause__ is original_exception
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1628:13
     |
1626 |     expected = {
1627 |         (test_lib_id, test_api): Library(
1628 |             api=test_api,
     |             ^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version"]`
1629 |             content=test_content,
1630 |             content_hash=test_hash,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1634:13
     |
1632 |             lib_name=test_lib_name,
1633 |             charm_name=test_charm_name,
1634 |             patch=test_patch,
     |             ^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version"]`
1635 |         ),
1636 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1718:13
     |
1716 |     expected = {
1717 |         (test_lib_id_1, test_api_1): Library(
1718 |             api=test_api_1,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-1"]`
1719 |             content=test_content_1,
1720 |             content_hash=test_hash_1,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1724:13
     |
1722 |             lib_name=test_lib_name_1,
1723 |             charm_name=test_charm_name_1,
1724 |             patch=test_patch_1,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-1"]`
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1727:13
     |
1725 |         ),
1726 |         (test_lib_id_2, test_api_2): Library(
1727 |             api=test_api_2,
     |             ^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-api-version-2"]`
1728 |             content=test_content_2,
1729 |             content_hash=test_hash_2,
     |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
    --> tests/commands/test_store_api.py:1733:13
     |
1731 |             lib_name=test_lib_name_2,
1732 |             charm_name=test_charm_name_2,
1733 |             patch=test_patch_2,
     |             ^^^^^^^^^^^^^^^^^^ Expected `int`, found `Literal["test-patch-version-2"]`
1734 |         ),
1735 |     }
     |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'requests'>` has no attribute `exceptions`
  --> tests/commands/test_store_client.py:83:19
   |
81 |             # the craft-store lib expects the error from requests, as what we're
82 |             # faking here normally is a "real response"
83 |             raise requests.exceptions.JSONDecodeError(exc.msg, exc.doc, exc.pos)
   |                   ^^^^^^^^^^^^^^^^^^^
84 |
85 |     @property
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/conftest.py:224:9
    |
222 |         build_base=craft_platforms.DistroBase("ubuntu", "22.04"),
223 |         build_on=arch,
224 |         build_for="arm64",
    |         ^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["arm64"]`
225 |         platform="distro-1-test64",
226 |     )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'json'>` has no attribute `decoder`
   --> tests/conftest.py:354:16
    |
352 |         try:
353 |             output_content = json.loads(raw_output)
354 |         except json.decoder.JSONDecodeError:
    |                ^^^^^^^^^^^^
355 |             pytest.fail("Last command output is not valid JSON.")
356 |         assert output_content == expected_content
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft'>` has no attribute `application`
  --> tests/integration/commands/test_init.py:75:17
   |
73 | def init_command():
74 |     return init.InitCommand(
75 |         {"app": charmcraft.application.APP_METADATA, "services": None}
   |                 ^^^^^^^^^^^^^^^^^^^^^^
76 |     )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `RecordingEmitter` has no attribute `assert_json_output`
   --> tests/integration/commands/test_store_commands.py:225:9
    |
223 |             },
224 |         ]
225 |         emitter.assert_json_output(  # pyright: ignore[reportAttributeAccessIssue]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
226 |             expected
227 |         )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Unresolved attribute `client` on type `AppService`.
  --> tests/integration/conftest.py:45:5
   |
43 |     services.register_services()
44 |     factory = craft_application.ServiceFactory(app=application.APP_METADATA)
45 |     factory.get("store").client = mock.Mock(spec_set=craft_store.StoreClient)  # pyright: ignore[reportAttributeAccessIssue]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 |     factory.update_kwargs(
47 |         "charm_libs",
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/integration/services/test_image.py:28:9
   |
26 |     service = ImageService(
27 |         app=application.APP_METADATA,
28 |         services=None,  # pyright: ignore[reportArgumentType]
   |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
29 |     )
30 |     service.setup()
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:40:17
   |
38 |                 platform="something",
39 |                 build_on=craft_platforms.DebianArchitecture.from_host(),
40 |                 build_for="invalid",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `Literal["invalid"]`
41 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
42 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/integration/services/test_lifecycle.py:88:17
   |
86 |                 platform="something",
87 |                 build_on=host_arch,
88 |                 build_for=f"{foreign_arch}-{host_arch}",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
89 |                 build_base=craft_platforms.DistroBase(distro.id(), distro.version()),
90 |             )
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:9:8
   |
 7 | import pathlib
 8 |
 9 | import charm
   |        ^^^^^
10 | import scenario
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:10:8
   |
 9 | import charm
10 | import scenario
   |        ^^^^^^^^
11 | import scenario.errors
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `scenario.errors`
  --> tests/spread/commands/init-extensions/tests/unit/test_charm.py:11:8
   |
 9 | import charm
10 | import scenario
11 | import scenario.errors
   |        ^^^^^^^^^^^^^^^
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | # A standalone module for workload-specific logic (no charming concerns):
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `setuptools_scm_python`
  --> tests/spread/dependencies/setuptools-scm-python/src/charm.py:12:8
   |
11 | # A standalone module for workload-specific logic (no charming concerns):
12 | import setuptools_scm_python
   |        ^^^^^^^^^^^^^^^^^^^^^
13 |
14 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-binary-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/extra-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/missing-packages/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies-errors/no-requirements/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/dependencies/strict-dependencies/charm/src/charm.py:17:8
   |
15 | import logging
16 |
17 | import ops
   |        ^^^
18 |
19 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charms.reactive`
 --> tests/spread/smoketests/reactive/reactivecharm/reactive/reactivecharm.py:1:6
  |
1 | from charms.reactive import set_flag, when_not
  |      ^^^^^^^^^^^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-20.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/bases/src/charm.py:18:8
   |
16 | from typing import cast
17 |
18 | import ops
   |        ^^^
19 |
20 | # Log messages can be retrieved using juju debug-log
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-22.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
  --> tests/spread/ubuntu-24.04/charm/platforms/src/charm.py:9:8
   |
 7 | import logging
 8 |
 9 | import ops
   |        ^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:6:8
  |
4 | import logging
5 |
6 | import ops
  |        ^^^
7 |
8 | # A standalone module for workload-specific logic (no charming concerns):
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `test_cmd`
  --> tests/spread/ubuntu-24.04/test-cmd/src/charm.py:9:8
   |
 8 | # A standalone module for workload-specific logic (no charming concerns):
 9 | import test_cmd
   |        ^^^^^^^^
10 |
11 | logger = logging.getLogger(__name__)
   |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `pytest_operator.plugin`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/integration/test_charm.py:7:6
  |
5 | import pytest
6 | import yaml
7 | from pytest_operator.plugin import OpsTest
  |      ^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | logger = logging.getLogger(__name__)
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `ops`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:2:6
  |
1 | import pytest
2 | from ops import testing
  |      ^^^
3 |
4 | from charm import TestCmdCharm
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-import]: Cannot resolve imported module `charm`
 --> tests/spread/ubuntu-24.04/test-cmd/tests/unit/test_charm.py:4:6
  |
2 | from ops import testing
3 |
4 | from charm import TestCmdCharm
  |      ^^^^^
  |
info: Searched in the following paths during module resolution:
info:   1. /home/runner/work/charmcraft/charmcraft (first-party code)
info:   2. vendored://stdlib (stdlib typeshed stubs vendored by ty)
info:   3. /home/runner/work/charmcraft/charmcraft/.venv/lib/python3.12/site-packages (site-packages)
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1237:16
     |
1235 |                 with pytest.raises(SystemExit) as raised:
1236 |                     charm_builder.main()
1237 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1238 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `code`
    --> tests/test_charm_builder.py:1265:16
     |
1263 |                 with pytest.raises(SystemExit) as raised:
1264 |                     charm_builder.main()
1265 |         assert raised.value.code == 42
     |                ^^^^^^^^^^^^^^^^^
1266 |     mock_collect_pydeps.assert_called_with(pathlib.Path("builddir"))
     |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:256:32
    |
254 |     assert measurements.measurements == {}
255 |
256 |     with Timer("test message", foo=42):
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
257 |         pass
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:274:28
    |
272 |     monkeypatch.setattr(instrum, "_measurements", measurements)
273 |
274 |     @Timer("test message", foo=42)
    |                            ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
275 |     def test_function(a, b):
276 |         assert a == 17
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/test_instrum.py:298:32
    |
296 |     assert measurements.measurements == {}
297 |
298 |     with Timer("test message", foo=42) as timer:
    |                                ^^^^^^ Expected `dict[str, Any]`, found `Literal[42]`
299 |         timer.mark("middle 1")
300 |         timer.mark("middle 2")
    |
info: Method defined here
   --> charmcraft/instrum.py:129:9
    |
127 |     """
128 |
129 |     def __init__(self, msg: str, **extra_info: dict[str, Any]):
    |         ^^^^^^^^                 ---------------------------- Parameter declared here
130 |         self.msg = msg
131 |         self.extra_info = extra_info
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:75:11
   |
73 |     with pytest.raises(pydantic.ValidationError) as raised:
74 |         parts.process_part_config(data)
75 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
76 |     assert len(err) == 1
77 |     assert err[0]["loc"] == ("color",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/test_parts.py:89:11
   |
87 |     with pytest.raises(pydantic.ValidationError) as raised:
88 |         parts.process_part_config(data)
89 |     err = raised.value.errors()
   |           ^^^^^^^^^^^^^^^^^^^
90 |     assert len(err) == 1
91 |     assert err[0]["loc"] == ("charm-timeout",)
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:40:15
   |
38 | def test_get_snap_configuration_empty(mock_snap_config):
39 |     def fake_get(key: str):
40 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
41 |
42 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:54:15
   |
52 |         if key == "provider":
53 |             return provider
54 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
55 |
56 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'snaphelpers'>` has no attribute `_conf`
  --> tests/test_snap.py:68:15
   |
66 |         if key == "provider":
67 |             return provider
68 |         raise snaphelpers._conf.UnknownConfigKey(key=key)
   |               ^^^^^^^^^^^^^^^^^
69 |
70 |     mock_snap_config.return_value.get.side_effect = fake_get
   |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `write`
  --> tests/unit/commands/test_lifecycle.py:91:5
   |
90 |     libs_service = cast("CharmLibsService", service_factory.get("charm_libs"))
91 |     libs_service.write = mock.Mock(wraps=libs_service.write)
   |     ^^^^^^^^^^^^^^^^^^
92 |
93 |     pack._update_charm_libs()
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `bound method CharmLibsService.write(library: Library) -> None` has no attribute `assert_called_once_with`
  --> tests/unit/commands/test_lifecycle.py:95:5
   |
93 |     pack._update_charm_libs()
94 |
95 |     libs_service.write.assert_called_once_with(store_lib)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96 |
97 |     with check():
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:236:12
    |
234 |         fetch_libs.run(argparse.Namespace())
235 |
236 |     assert exc_info.value.resolution == "Add a 'charm-libs' section to charmcraft.yaml."
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/commands/test_store.py:485:9
    |
484 |     assert (
485 |         exc_info.value.resolution
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
486 |         == f"Did you mean: charmcraft promote --from-channel={to_channel} --to-channel={from_channel}"
487 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[non-subscriptable]: Cannot subscript object of type `None` with no `__getitem__` method
  --> tests/unit/models/test_config.py:75:23
   |
73 |     config = JujuConfig(options={"my-opt": option})
74 |
75 |     assert isinstance(config.options["my-opt"], type_)
   |                       ^^^^^^^^^^^^^^
   |
info: rule `non-subscriptable` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/models/test_project.py:582:12
    |
580 |         project.CharmcraftProject.from_yaml_file(pathlib.Path("/charmcraft.yaml"))
581 |
582 |     assert exc.value.details == details
    |            ^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[missing-argument]: No argument provided for required parameter `type`
   --> tests/unit/models/test_project.py:691:9
    |
689 | ):
690 |     with pytest.raises(error_cls, match=error_match):
691 |         project.BasesCharm(**values)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `missing-argument` is enabled by default

error[invalid-argument-type]: Argument is incorrect
   --> tests/unit/models/test_project.py:708:13
    |
706 |             description="",
707 |             base=base,
708 |             platforms={"amd64": None},
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `PlatformsDict`, found `dict[@Todo, @Todo]`
709 |             parts={"charm": {"plugin": "charm"}},
710 |         )
    |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:140:11
    |
138 |     with pytest.raises(pydantic.ValidationError) as raised:
139 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
140 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
141 |
142 |     assert len(err) == 1
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:175:11
    |
173 |     with pytest.raises(pydantic.ValidationError) as raised:
174 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
175 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
176 |     assert len(err) == 1
177 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
   --> tests/unit/parts/plugins/test_charm.py:190:11
    |
188 |     with pytest.raises(pydantic.ValidationError) as raised:
189 |         parts.plugins.CharmPlugin.properties_class.unmarshal(content)
190 |     err = raised.value.errors()
    |           ^^^^^^^^^^^^^^^^^^^
191 |     assert len(err) == 1
192 |     assert err[0]["loc"] == ("charm-entrypoint",)
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_poetry.py:40:5
   |
39 | def test_get_pip_install_commands(poetry_plugin: plugins.PoetryPlugin):
40 |     poetry_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
41 |
42 |     assert poetry_plugin._get_pip_install_commands(
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[invalid-assignment]: Implicit shadowing of function `_get_pip`
  --> tests/unit/parts/plugins/test_python.py:62:5
   |
60 |     }
61 |     python_plugin._options = plugins.PythonPluginProperties.unmarshal(spec)
62 |     python_plugin._get_pip = lambda: "/python -m pip"
   |     ^^^^^^^^^^^^^^^^^^^^^^
63 |     copy_src_cmd = (
64 |         f"cp --archive --recursive --reflink=auto {build_path}/src {install_path}"
   |
info: Annotate to make it explicit if this is intentional
info: rule `invalid-assignment` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:139:12
    |
137 |         validator.validate_environment()
138 |
139 |     assert raised.value.reason == (
    |            ^^^^^^^^^^^^^^^^^^^
140 |         "charm tool not found and part 'my-part' does not depend on a part named 'charm-tools'"
141 |     )
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `reason`
   --> tests/unit/parts/plugins/test_reactive.py:153:12
    |
151 |         validator.validate_environment()
152 |
153 |     assert raised.value.reason == "charm tools failed with error code 2"
    |            ^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_analysis.py:112:67
    |
110 | @pytest.fixture
111 | def analysis_service():
112 |     return analysis.AnalysisService(app=application.APP_METADATA, services=None)
    |                                                                   ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
    |
info: Method defined here
  --> charmcraft/services/analysis.py:37:9
   |
35 |     _project: models.CharmcraftProject  # type: ignore[assignment]
36 |
37 |     def __init__(  # (too many arguments)
   |         ^^^^^^^^
38 |         self,
39 |         app: craft_application.AppMetadata,
40 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
41 |     ) -> None:
42 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:55:17
   |
53 |                 platform="something",
54 |                 build_on=HOST_ARCH,
55 |                 build_for=plan_build_for,  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
56 |             )
57 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument is incorrect
  --> tests/unit/services/test_lifecycle.py:94:17
   |
92 |                 platform="something",
93 |                 build_on=HOST_ARCH,
94 |                 build_for=f"{HOST_ARCH}-foreign",  # pyright: ignore[reportArgumentType]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `DebianArchitecture | Literal["all"]`, found `str`
95 |             )
96 |         ]
   |
info: rule `invalid-argument-type` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
  --> tests/unit/services/test_package.py:42:21
   |
40 | )
41 |
42 | SIMPLE_BUILD_BASE = models.charmcraft.Base(
   |                     ^^^^^^^^^^^^^^^^^
43 |     name=HOST_BASE.distribution, channel=HOST_BASE.series, architectures=["arm64"]
44 | )
   |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `<module 'charmcraft.models'>` has no attribute `charmcraft`
   --> tests/unit/services/test_package.py:163:17
    |
161 |             "charmcraft-started-at": "2020-03-14T00:00:00+00:00",
162 |             "bases": [
163 |                 models.charmcraft.Base(
    |                 ^^^^^^^^^^^^^^^^^
164 |                     name=distro.id(),
165 |                     channel=distro.version(),
    |
info: rule `unresolved-attribute` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_project.py:34:45
   |
32 | @pytest.fixture
33 | def service(project_path):
34 |     return ProjectService(app=APP_METADATA, services=None, project_dir=project_path)
   |                                             ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/project.py:58:9
   |
56 |     _project_model: models.Project | None
57 |
58 |     def __init__(
   |         ^^^^^^^^
59 |         self, app: AppMetadata, services: ServiceFactory, *, project_dir: pathlib.Path
   |                                 ------------------------ Parameter declared here
60 |     ) -> None:
61 |         super().__init__(app, services)
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
   --> tests/unit/services/test_provider.py:123:9
    |
121 |     provider_service = ProviderService(
122 |         app=APP_METADATA,
123 |         services=None,  # pyright: ignore[reportArgumentType]
    |         ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
124 |         work_dir=tmp_path,
125 |     )
    |
info: Method defined here
  --> charmcraft/services/provider.py:43:9
   |
41 |     """Business logic for getting providers."""
42 |
43 |     def __init__(
   |         ^^^^^^^^
44 |         self,
45 |         app: craft_application.AppMetadata,
46 |         services: craft_application.ServiceFactory,
   |         ------------------------------------------ Parameter declared here
47 |         *,
48 |         work_dir: pathlib.Path,
   |
info: rule `invalid-argument-type` is enabled by default

error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
  --> tests/unit/services/test_store.py:50:56
   |
48 | @pytest.fixture(scope="module")
49 | def reusable_store():
50 |     store = StoreService(app=application.APP_METADATA, services=None)
   |                                                        ^^^^^^^^^^^^^ Expected `ServiceFactory`, found `None`
51 |     store.client = mock.Mock(spec_set=craft_store.StoreClient)
52 |     store._publisher = mock.Mock(spec_set=craft_store.PublisherGateway)
   |
info: Method defined here
  --> .venv/lib/python3.12/site-packages/craft_application/services/base.py:39:9
   |
37 |     """
38 |
39 |     def __init__(self, app: AppMetadata, services: ServiceFactory) -> None:
   |         ^^^^^^^^                         ------------------------ Parameter declared here
40 |         self._app = app
41 |         self._services = services
   |
info: rule `invalid-argument-type` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:43:12
   |
41 | )
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:44:12
   |
42 | def test_fuzz_python_name_regex(name, next_char, further_garbage):
43 |     assert linters.PYTHON_NAME_REGEX.match(name).group(0) == name
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:46:9
   |
44 |     assert linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}").group(0) == name
45 |     assert (
46 |         linters.PYTHON_NAME_REGEX.match(f"{name}{next_char}{further_garbage}").group(0)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 |         == name
48 |     )
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:62:12
   |
60 | )
61 | def test_min_version_regex_matches(string, expected):
62 |     assert linters.MIN_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:76:24
   |
74 | )
75 | def test_approx_version_regex_matches(string, expected):
76 |     assert expected in linters.APPROX_VERSION_REGEX.search(string).group(1, 2)
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

warning[possibly-unbound-attribute]: Attribute `group` on type `Unknown | Match[str] | None` is possibly unbound
  --> tests/unit/test_linters.py:84:12
   |
82 | )
83 | def test_exact_version_regex_matches(string, expected):
84 |     assert linters.EXACT_VERSION_REGEX.search(string).group(1) == expected
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `possibly-unbound-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `errors`
  --> tests/unit/test_parts.py:91:42
   |
89 |         parts.process_part_config(part_config)
90 |
91 |     assert message in {e["msg"] for e in exc_info.value.errors()}
   |                                          ^^^^^^^^^^^^^^^^^^^^^
   |
info: rule `unresolved-attribute` is enabled by default

error[no-matching-overload]: No overload of function `format_content` matches arguments
   --> tests/unit/utils/test_cli.py:285:9
    |
283 | def test_format_content_invalid(fmt):
284 |     with pytest.raises(ValueError, match="^Unknown output format "):
285 |         format_content(None, fmt)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: First overload defined here
   --> charmcraft/utils/cli.py:184:5
    |
183 |   @overload
184 |   def format_content(
    |  _____^
185 | |     content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None
186 | | ) -> str: ...
    | |________^
    |
info: Possible overloads for function `format_content`:
info:   (content: dict[str, Any] | list[dict[str, Any]], fmt: OutputFormat | str | None) -> str
info:   (content: str | Real | list[Unknown] | dict[Unknown, Unknown], fmt: OutputFormat | str | None) -> str
info: Overload implementation defined here
   --> charmcraft/utils/cli.py:195:5
    |
195 | def format_content(content, fmt=None):
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 |     """Format command output."""
197 |     if not isinstance(fmt, OutputFormat):
    |
info: rule `no-matching-overload` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `extra_dependencies`
   --> tests/unit/utils/test_package.py:221:12
    |
219 |         validate_strict_dependencies(dependencies, other_packages)
220 |
221 |     assert exc_info.value.extra_dependencies == extra_packages
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `details`
   --> tests/unit/utils/test_platform.py:162:12
    |
160 |         validate_architectures(architectures)
161 |
162 |     assert exc_info.value.details == details
    |            ^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

error[unresolved-attribute]: Type `BaseException` has no attribute `resolution`
   --> tests/unit/utils/test_project.py:111:17
    |
110 |     check.equal(exc_info.value.args, expected.args)
111 |     check.equal(exc_info.value.resolution, expected.resolution)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
info: rule `unresolved-attribute` is enabled by default

Found 124 diagnostics

@lengau lengau marked this pull request as ready for review September 13, 2025 02:25
@lengau lengau requested a review from a team September 13, 2025 02:25
Comment thread .github/workflows/policy.yaml
@upils upils requested a review from a team September 15, 2025 06:20
@lengau lengau merged commit 6b94f66 into main Sep 15, 2025
29 of 33 checks passed
@lengau lengau deleted the work/remove-unused branch September 15, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants