Skip to content

Commit

Permalink
fix: consolidate summary and layout types from exposing SnapMetadata
Browse files Browse the repository at this point in the history
Pyright started finding issues after exposing the symbol

Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
  • Loading branch information
sergiusens committed Feb 14, 2024
1 parent 547b05d commit 3893e2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions snapcraft/meta/snap_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import pydantic
import yaml
from craft_application.models import BaseMetadata, constraints
from craft_application.models import BaseMetadata, SummaryStr, constraints
from craft_cli import emit
from pydantic import ValidationError, validator
from typing_extensions import override
Expand Down Expand Up @@ -229,7 +229,7 @@ class SnapMetadata(SnapcraftMetadata):
name: str
title: Optional[str]
version: str
summary: str
summary: SummaryStr
description: str
license: Optional[str]
type: Optional[str]
Expand All @@ -244,7 +244,9 @@ class SnapMetadata(SnapcraftMetadata):
plugs: Optional[Dict[str, Any]]
slots: Optional[Dict[str, Any]]
hooks: Optional[Dict[str, Any]]
layout: Optional[Dict[str, Dict[str, str]]]
layout: Optional[
Dict[str, Dict[Literal["symlink", "bind", "bind-file", "type"], str]]
]
system_usernames: Optional[Dict[str, Any]]
provenance: Optional[str]
links: Optional[Links]
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/services/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

from pathlib import Path

from craft_application.models import SummaryStr

from snapcraft import linters, meta, pack


Expand Down Expand Up @@ -49,7 +51,7 @@ def test_metadata(package_service, default_factory, new_dir):
name="default",
title=None,
version="1.0",
summary="default project",
summary=SummaryStr("default project"),
description="default project",
license="MIT",
type=None,
Expand Down

0 comments on commit 3893e2e

Please sign in to comment.