Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: add indy deprecation warnings #2332

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions aries_cloudagent/config/logging.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"""Utilities related to logging."""
import asyncio
from datetime import datetime, timedelta
Copy link
Contributor

@andrewwhitehead andrewwhitehead Jul 20, 2023

Choose a reason for hiding this comment

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

These imports ought to be grouped to avoid re-ordering...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've considered adding isort or similar to pre-commit hooks and our format checks lol so it's handled automatically like black for formatting.

from io import TextIOWrapper
import logging
from logging.config import fileConfig
from logging.handlers import BaseRotatingHandler
import os
import pkg_resources
import sys
from random import randint
import re
import sys
import time as mod_time
from typing import Optional, TextIO

from datetime import datetime, timedelta
from io import TextIOWrapper
from logging.handlers import BaseRotatingHandler
from logging.config import fileConfig
from portalocker import lock, unlock, LOCK_EX
import pkg_resources
from portalocker import LOCK_EX, lock, unlock
from pythonjsonlogger import jsonlogger
from typing import Optional, TextIO

from ..config.settings import Settings
from ..core.profile import Profile
from ..version import __version__
from ..wallet.base import BaseWallet, DIDInfo

from .banner import Banner
from .base import BaseSettings

Expand Down Expand Up @@ -199,6 +199,18 @@ def print_banner(
print("Listening...")
print()

@classmethod
def print_notices(cls, settings: Settings):
"""Print notices and warnings."""
if settings.get("wallet.type", "in_memory").lower() == "indy":
print("DEPRECATTION NOTICE:", file=sys.stderr)
dbluhm marked this conversation as resolved.
Show resolved Hide resolved
print(
"\tThe Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
file=sys.stderr,
)
print()


######################################################################
# Derived from
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ async def start(self) -> None:
self.setup_public_did and self.setup_public_did.did,
self.admin_server,
)
LoggingConfigurator.print_notices(context.settings)

# record ACA-Py version in Wallet, if needed
from_version_storage = None
Expand Down
18 changes: 13 additions & 5 deletions aries_cloudagent/indy/sdk/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

import asyncio
import logging

from typing import Any, Mapping
import warnings
from weakref import finalize, ref

from ...config.injection_context import InjectionContext
from ...config.provider import ClassProvider
from ...core.profile import Profile, ProfileManager, ProfileSession
from ...core.error import ProfileError
from ...core.profile import Profile, ProfileManager, ProfileSession
from ...ledger.base import BaseLedger
from ...ledger.indy import IndySdkLedger, IndySdkLedgerPool
from ...storage.base import BaseStorage, BaseStorageSearch
from ...storage.vc_holder.base import VCHolder
from ...wallet.base import BaseWallet
from ...wallet.indy import IndySdkWallet

from ..holder import IndyHolder
from ..issuer import IndyIssuer
from ..verifier import IndyVerifier

from .wallet_setup import IndyWalletConfig, IndyOpenWallet
from .wallet_setup import IndyOpenWallet, IndyWalletConfig

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -191,6 +189,16 @@ async def open(
self, context: InjectionContext, config: Mapping[str, Any] = None
) -> Profile:
"""Open an instance of an existing profile."""
warnings.warn(
"Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
DeprecationWarning,
)
LOGGER.warning(
"Indy wallet type is deprecated, use Askar instead; see: "
"https://github.com/hyperledger/aries-cloudagent-python/issues/2330",
)

indy_config = IndyWalletConfig(config)
opened = await indy_config.open_wallet()
return IndySdkProfile(opened, context)