Skip to content

Deprecate Snake Case Variables and Deprecated Aliases #428

@exploreriii

Description

@exploreriii

This issue can be taken by new and existing contributors
👾 Description of the issue
In a prior SDK version, the TokenInfo and NFTId classes had used camelCase naming that was changed to snake_case. This was a breaking change, and we added backward compatibility measures and deprecation warnings. You can see the full list of deprecated alises in _DeprecatedAliasesMixin.

As warned, all these backward compatibility measures will now be cleaned up and the future release no longer support camelCase naming for these. These legacy aliases should be removed, and users should only use the new snake_case attributes.

Additionally, the _DeprecatedAliasesMixin file and its references are no longer needed and should be deleted.

💡 Solution
Files to work on:

  • src/hiero_sdk_python/_deprecated.py → remove entirely
  • tests/unit/test_deprecated.py → remove entirely
  • src/hiero_sdk_python/tokens/nft_id.py → remove _DeprecatedAliasesMixin usage and deprecated kwargs
  • src/hiero_sdk_python/tokens/token_info.py → remove all references to deprecated aliases and legacy camelCase maps
  • src/hiero_sdk_python/transaction/transaction_receipt.py -> emove all references to deprecated aliases and legacy camelCase maps

For example nft_id.py:
Delete: import warnings
Delete from hiero_sdk_python._deprecated import _DeprecatedAliasesMixin

class NftId(_DeprecatedAliasesMixin): --> class NftId:

Delete:

    *,
    tokenId:  Optional[TokenId]      = None,
    serialNumber: Optional[int]      = None,
) -> None:
    # Map legacy tokenId -> token_id
    if token_id is None and tokenId is not None:
        warnings.warn(
            "NftId(tokenId=…) is deprecated; use token_id",
            FutureWarning,
            stacklevel=2,
        )
        token_id = tokenId

    # Map legacy serialNumber -> serial_number
    if serial_number is None and serialNumber is not None:
        warnings.warn(
            "NftId(serialNumber=…) is deprecated; use serial_number",
            FutureWarning,
            stacklevel=2,
        )
        serial_number = serialNumber

For example token_info.py:
Delete: import warnings
from typing import Optional, ClassVar, Dict, Any, List, Callable, cast
-> from typing import Optional, List, Any, Callable, cast
Delete from hiero_sdk_python._deprecated import _DeprecatedAliasesMixin
class TokenInfo(_DeprecatedAliasesMixin): -> class TokenInfo:

Delete:

# map legacy camelCase → snake_case
LEGACY_MAP: ClassVar[Dict[str, str]] = {
    "tokenId":             "token_id",
    "totalSupply":         "total_supply",
    "isDeleted":           "is_deleted",
    "tokenType":           "token_type",
    "maxSupply":           "max_supply",
    "adminKey":            "admin_key",
    "kycKey":              "kyc_key",
    "freezeKey":           "freeze_key",
    "wipeKey":             "wipe_key",
    "supplyKey":           "supply_key",
    "defaultFreezeStatus": "default_freeze_status",
    "defaultKycStatus":    "default_kyc_status",
    "autoRenewAccount":    "auto_renew_account",
    "autoRenewPeriod":     "auto_renew_period",
    "pauseStatus":         "pause_status",
    "supplyType":          "supply_type",
    "customFees":          "custom_fees",
}

Delete:
# 1) Translate deprecated camelCase names → snake_case, with warnings
for legacy, snake in self.LEGACY_MAP.items():
if legacy in kwargs:
warnings.warn(
f"TokenInfo({legacy}=...) is deprecated; use {snake}",
FutureWarning,
stacklevel=2,
)
# only set snake-case if not already provided
if snake not in kwargs:
kwargs[snake] = kwargs.pop(legacy)
else:
kwargs.pop(legacy)

Delete:
# alias for backwards compatibility
set_adminKey = set_admin_key
(and all the rest!)

For example in transaction_receipt.py:
Update the docstring

Delete from hiero_sdk_python._deprecated import _DeprecatedAliasesMixin
class TransactionReceipt(_DeprecatedAliasesMixin): # type: ignore[misc]
-> class TransactionReceipt:

All docstrings should now avoid saying anything about deprecated etc
please ensure docstrings match cleaner code without prior functionality.

✅ Acceptance Criteria

  • _DeprecatedAliasesMixin removed.
  • NftId only uses token_id and serial_number; legacy kwargs removed.
  • TokenInfo only uses snake_case; legacy camelCase maps and aliases removed.
  • Tests for deprecated aliases removed.
  • All existing tests pass using only snake_case attributes.
  • All docstrings and existing functionality updated.
  • Class still passes all existing tests.

👩‍💻 Next steps

  • Comment below that you’d like to work on this issue.
  • Wait to be assigned by a maintainer.
  • Fork the repo and create a new branch (e.g., add-type-hints-transaction-receipt-query).
  • Read CONTRIBUTING.md for signing and changelog instructions and more.

If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow.
More information and concrete samples for shell commands for each step can be found in our CONTRIBUTING.md
file.
A more detailed general documentation of the GitHub PR workflow can be found here
.

For Python-specific contributing guidelines, see:

CONTRIBUTING.md

README.md

  • Claim this issue: Comment below that you are interested in working on the issue

  • Wait for assignment: A community member with the given rights will add you as an assignee

  • Work on the issue: Follow the steps above and submit a PR

  • You did it 🎉: We’ll review and merge your contribution — thanks for improving Hiero’s Python SDK ❤️

🎉 Contribute to Hacktoberfest

This issue is perfect for Hacktoberfest
participants looking to make a high-quality, beginner-friendly contribution to open source. 🌍💻

Metadata

Metadata

Assignees

Labels

Good First IssueIssues which are ideal for a first time or new project contributor.hacktoberfestIssues highlighted by lists for Hacktoberfest (https://hacktoberfest.com/)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions