File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed
Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 2121.. autodata:: __all__
2222"""
2323
24- from pkg_resources import get_distribution
24+ from google . cloud . ndb import version
2525
26- __version__ = get_distribution ( "google-cloud-ndb" ). version
26+ __version__ = version . __version__
2727
2828from google .cloud .ndb .client import Client
2929from google .cloud .ndb .context import AutoBatcher
131131from google .cloud .ndb ._transaction import non_transactional
132132
133133__all__ = [
134+ "__version__" ,
134135 "AutoBatcher" ,
135136 "Client" ,
136137 "Context" ,
Original file line number Diff line number Diff line change 1+ # Copyright 2023 Google LLC
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+ #
15+ __version__ = "2.2.2"
Original file line number Diff line number Diff line change 1414
1515import io
1616import os
17+ import re
1718
1819import setuptools
1920
2021
22+ PACKAGE_ROOT = os .path .abspath (os .path .dirname (__file__ ))
23+
24+ version = None
25+
26+ with open (os .path .join (PACKAGE_ROOT , "google/cloud/ndb/version.py" )) as fp :
27+ version_candidates = re .findall (r"(?<=\")\d+.\d+.\d+(?=\")" , fp .read ())
28+ assert len (version_candidates ) == 1
29+ version = version_candidates [0 ]
30+
2131def main ():
2232 package_root = os .path .abspath (os .path .dirname (__file__ ))
2333 readme_filename = os .path .join (package_root , "README.md" )
@@ -36,7 +46,7 @@ def main():
3646
3747 setuptools .setup (
3848 name = "google-cloud-ndb" ,
39- version = "2.2.2" ,
49+ version = version ,
4050 description = "NDB library for Google Cloud Datastore" ,
4151 long_description = readme ,
4252 long_description_content_type = "text/markdown" ,
You can’t perform that action at this time.
0 commit comments