Skip to content

Commit

Permalink
Use Python 3 sematics in Cython-compiled modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
tvalentyn committed Mar 11, 2021
1 parent 48f9f66 commit 27f713d
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/coders/stream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# cython: language_level=3

"""Compiled version of the Stream objects used by CoderImpl.
For internal use only; no backwards-compatibility guarantees.
Expand Down
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/metrics/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# cython: language_level=3

"""
This file contains metric cell classes. A metric cell is used to accumulate
in-memory changes to a metric. It represents a specific metric in a single
Expand Down
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/metrics/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# cython: language_level=3

"""
This module is for internal use only; no backwards-compatibility guarantees.
Expand Down
1 change: 1 addition & 0 deletions sdks/python/apache_beam/runners/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.
#
# cython: profile=True
# cython: language_level=3

"""Worker operations executor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

# cython: profile=True
# cython: language_level=3

"""State sampler for tracking time spent in execution steps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#

# cython: profile=True
# cython: language_level=3

""" For internal use only. No backwards compatibility guarantees."""

Expand Down
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/transforms/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# cython: language_level=3

"""This module has all statistic related transforms.
This ApproximateUnique class will be deprecated [1]. PLease look into using
Expand Down
1 change: 1 addition & 0 deletions sdks/python/apache_beam/utils/counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

# cython: profile=False
# cython: overflowcheck=True
# cython: language_level=3

"""Counters collect the progress of the Worker for reporting to the service.
Expand Down
3 changes: 2 additions & 1 deletion sdks/python/apache_beam/utils/windowed_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
# editing this file as WindowedValues are created for every element for
# every step in a Beam pipeline.

#cython: profile=True
# cython: profile=True
# cython: language_level=3

# pytype: skip-file

Expand Down
1 change: 1 addition & 0 deletions sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def run(self):
'*/*.pyx', '*/*/*.pyx', '*/*.pxd', '*/*/*.pxd', '*/*.h', '*/*/*.h',
'testing/data/*.yaml', 'portability/api/*.yaml']},
ext_modules=cythonize([
# Make sure to use language_level=3 cython directive in files below.
'apache_beam/**/*.pyx',
'apache_beam/coders/coder_impl.py',
'apache_beam/metrics/cells.py',
Expand Down

0 comments on commit 27f713d

Please sign in to comment.