Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Add proper __version__ #214

Merged
merged 2 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 22 additions & 1 deletion fastapi_restful/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
import sys
import warnings

from .cbv_base import Api, Resource, set_responses, take_init_parameters

__version__ = "0.4.3"
if sys.version_info.minor < 8:
import pkg_resources

try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "unknown"
else:
import importlib.metadata

try:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "unknown"


__all__ = [
"Api",
Expand Down
Loading