"Package version": {
"prefix": "package-version",
"body": [
"import pkg_resources",
"import setuptools_scm",
"",
"try:",
"\t# Try to get version number from repository",
"\tVERSION = setuptools_scm.get_version()",
"except LookupError:",
"\t# Not in repo, so try to get version number from pkg_resources",
"\ttry:",
"\t\tVERSION = pkg_resources.get_distribution(\"${1:package-name}\").version",
"\texcept pkg_resources.DistributionNotFound:",
"\t\t# Not installed?",
"\t\tVERSION = \"Unknown\"",
""
],
"description": "Snippet for getting a package's version using setuptools_scm and pkg_resources."
}