import pkg_resources
# replace package name with correct name
version = pkg_resources.get_distribution('package-name').version
How to Get the Version of Your poetry-based Package from Python Code
1 min read