Skip to content

Commit 9880318

Browse files
authored
Include version.py in distribution for certain packages (census-instrumentation#1143)
1 parent 8200ad0 commit 9880318

File tree

12 files changed

+42
-8
lines changed

12 files changed

+42
-8
lines changed

context/opencensus-context/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- Move `version.py` file into `runtime_context` folder
6+
([#1143](https://github.com/census-instrumentation/opencensus-python/pull/1143))
7+
58
## 0.1.2
69
Released 2020-06-29
710

context/opencensus-context/setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
1517
from setuptools import find_packages, setup
1618

17-
from version import __version__
19+
BASE_DIR = os.path.dirname(__file__)
20+
VERSION_FILENAME = os.path.join(
21+
BASE_DIR, "opencensus", "common", "runtime_context", "version.py"
22+
)
23+
PACKAGE_INFO = {}
24+
with open(VERSION_FILENAME) as f:
25+
exec(f.read(), PACKAGE_INFO)
1826

1927
setup(
2028
name='opencensus-context',
21-
version=__version__, # noqa
29+
version=PACKAGE_INFO["__version__"], # noqa
2230
author='OpenCensus Authors',
2331
author_email='[email protected]',
2432
classifiers=[

contrib/opencensus-ext-flask/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- Move `version.py` file into `common` folder
6+
([#1143](https://github.com/census-instrumentation/opencensus-python/pull/1143))
7+
58
## 0.8.0
69
Released 2022-04-20
710

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

contrib/opencensus-ext-flask/setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
1517
from setuptools import find_packages, setup
1618

17-
from version import __version__
19+
BASE_DIR = os.path.dirname(__file__)
20+
VERSION_FILENAME = os.path.join(
21+
BASE_DIR, "opencensus", "ext", "flask", "common", "version.py"
22+
)
23+
PACKAGE_INFO = {}
24+
with open(VERSION_FILENAME) as f:
25+
exec(f.read(), PACKAGE_INFO)
1826

1927
setup(
2028
name='opencensus-ext-flask',
21-
version=__version__, # noqa
29+
version=PACKAGE_INFO["__version__"], # noqa
2230
author='OpenCensus Authors',
2331
author_email='[email protected]',
2432
classifiers=[

contrib/opencensus-ext-requests/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Move `version.py` file into `common` folder
6+
([#1143](https://github.com/census-instrumentation/opencensus-python/pull/1143))
57
- Add `requests` library as a hard dependency
68
([#1146](https://github.com/census-instrumentation/opencensus-python/pull/1146))
79

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

contrib/opencensus-ext-requests/setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
1517
from setuptools import find_packages, setup
1618

17-
from version import __version__
19+
BASE_DIR = os.path.dirname(__file__)
20+
VERSION_FILENAME = os.path.join(
21+
BASE_DIR, "opencensus", "ext", "requests", "common", "version.py"
22+
)
23+
PACKAGE_INFO = {}
24+
with open(VERSION_FILENAME) as f:
25+
exec(f.read(), PACKAGE_INFO)
1826

1927
setup(
2028
name='opencensus-ext-requests',
21-
version=__version__, # noqa
29+
version=PACKAGE_INFO["__version__"], # noqa
2230
author='OpenCensus Authors',
2331
author_email='[email protected]',
2432
classifiers=[

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ deps =
5050
unit,lint,bandit: -e contrib/opencensus-ext-threading
5151
unit,lint,bandit: -e contrib/opencensus-ext-zipkin
5252
unit,lint,bandit: -e contrib/opencensus-ext-google-cloud-clientlibs
53-
lint: flake8
53+
lint: flake8 ~= 4.0.1
5454
lint: isort ~= 4.3.21
5555
setup: docutils
5656
setup: pygments
@@ -68,4 +68,4 @@ commands =
6868
bandit: bandit -r context/ contrib/ opencensus/ -lll -q
6969
py39-setup: python setup.py check --restructuredtext --strict
7070
py39-docs: bash ./scripts/update_docs.sh
71-
; TODO deployment
71+
; TODO deployment

0 commit comments

Comments
 (0)