Skip to content

Commit

Permalink
PLAT-1338: Update Catalog documentation
Browse files Browse the repository at this point in the history
Add deprecation flags to catalog v1. Improve documentation.
  • Loading branch information
victoreram committed Dec 16, 2024
1 parent 34128a5 commit f4235f3
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 120 deletions.
21 changes: 21 additions & 0 deletions coinmetrics/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,24 @@ def get_keys_from_catalog(d: Dict[str, str]) -> Set[str]:
else:
keys.append(k)
return set(keys)


def deprecated(endpoint: Optional[str] = None) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
message = f"Function {func.__name__} is deprecated. "
if endpoint == 'catalog':
message += "Use 'catalog-v2' and 'reference-data' instead. For more information, see: https://docs.coinmetrics.io/tutorials-and-examples/user-guides/how-to-migrate-from-catalog-v1-to-catalog-v2 "
message += "\nNote: markets are truncated to 170,000 entries. Data may be out of date."

docstring = func.__doc__ or ""
deprecation_note = f"\n\nDeprecated: {message}\n"
func.__doc__ = deprecation_note + docstring

@wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
logger.warning(message)
return func(*args, **kwargs)

return wrapper

return decorator
Loading

0 comments on commit f4235f3

Please sign in to comment.