Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for py3k #374

Merged
merged 12 commits into from
Nov 24, 2014
Merged

Prepare for py3k #374

merged 12 commits into from
Nov 24, 2014

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Nov 13, 2014

Make a start toward #91 (we are still blocked on the protobuf dependency).

Selectively apply patches suggested by 'python-modernize --six-unicode'.

Tweak the pylint messages suppressed in test/demo code to work around issues involved in "straddling" Python2/Python3:

  • The six module does some import hackery which confuses pylint when used in a virtualenv: suppress import-error check (only in test/demo code). Note that the check is redundant (we have 100% coverage) as well as failing bogusly.
  • Rather than introduce from __future__ import print_statement in demos, just use print(), which is legal in Python2, and forward-compatible to Python3, but causes a `superfluous-parens' warning under pylint: suppress that warning (only test/demo code).

The 'six.moves' module (used in demo code) is known to confuse pylint
when used in conjunction with virtualenv.  See:

https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
The error trips over using 'print(thing)' in Python2, which is legal,
and forward-compatible to Py3k for simple cases.  Rather than introduce
the 'from __future__ import print_function' into the demo, just suppress
the warning.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling e544d27 on tseaver:modernize-prep_for_py3k into 9d6efcf on GoogleCloudPlatform:master.

@@ -16,47 +16,47 @@
toy.save()

# If we look it up by its key, we should find it...
print dataset.get_entities([toy.key()])
print(dataset.get_entities([toy.key()]))

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 92beb55 on tseaver:modernize-prep_for_py3k into 9d6efcf on GoogleCloudPlatform:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 7706cd9 on tseaver:modernize-prep_for_py3k into 9d6efcf on GoogleCloudPlatform:master.

@dhermes
Copy link
Contributor

dhermes commented Nov 16, 2014

All seems well except possible resolving the use of six.u, which can be done outside of this PR. Let's resolve (the decision) before I LGTM. We should run by @silvolu about explicitly not supporting 2.5 and / or 3.2.

Are we ready to add a py34 environ to tox? Do you want to do it in this PR or catch it in another cycle?

@tseaver
Copy link
Contributor Author

tseaver commented Nov 16, 2014

WRT 3.2: FWIW, 3.2 is the "system python3" version for Ubuntu 12.04 ("precise") and Debian stable ("wheezy"). Dropping support for 3.2 would make the six.u() ugliness go away.

WRT 2.5: Given that current travis / tox / virtualenv / pip / setuptools don't support Python 2.5, and that we therefore cannot automate testing for it, I recommend that we drop support, as recommended in Lennart Regebro's excellent book on porting to Python3.

WRT tox -e py34: We can't add 'py3x' until we get the transitive closure of our dependencies cleanly installable in Python 3 (google-apputils is the current crtiical path blocker).

@dhermes
Copy link
Contributor

dhermes commented Nov 17, 2014

RE: 3.2 on an LTS release, eek! This makes me sad, the EOL is still May 2017 so I'm not as confident as I previously was. If we use the from __future__ import unicode_literals import this will not be an issue, thought that import does not exist in 2.5.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 24, 2014

from future __import_literals__ is problematic if we care at all about being able to test with "native" strings on Python2. I'd rather drop 3.2 support than use it.

Since we have decided not to support Python 3.2.x, we can avoid the wart.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 38f7425 on tseaver:modernize-prep_for_py3k into 9d6efcf on GoogleCloudPlatform:master.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 24, 2014

@dhermes six.u replaced by unicode literals in 38f7425.

@@ -1,9 +1,11 @@
"""Script to populate datastore with regression test data."""
from __future__ import print_function

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Nov 24, 2014

LGTM pending your decision on the two imports of print_function in the regression directory.

Can we update #91 with what remains?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling dfa70b5 on tseaver:modernize-prep_for_py3k into 9d6efcf on GoogleCloudPlatform:master.

@tseaver
Copy link
Contributor Author

tseaver commented Nov 24, 2014

Re: updating #91: #91 (comment)

tseaver added a commit that referenced this pull request Nov 24, 2014
@tseaver tseaver merged commit 655191e into googleapis:master Nov 24, 2014
@tseaver tseaver deleted the modernize-prep_for_py3k branch November 24, 2014 22:26
parthea added a commit that referenced this pull request Sep 20, 2023
* feat: support async write mode for WriteUserEvent API
feat: support collect and import GA4 event format with prebuilt whistle rule
feat: support exact searchable and retrievable in catalog attribute config
feat: deprecate retrievable_fields in product attribute
feat: support diversity type in serving config
feat: allow set feed id in merchant center link
feat: support data output to GCS
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 495893148

Source-Link: googleapis/googleapis@02dcec3

Source-Link: googleapis/googleapis-gen@996aa46
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTk2YWE0NmZlNDgyZWY4MDdhMzNiNTZkMTViMjhhZDU1ZmJhYzdiOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix flaky test

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
Source-Link: https://github.com/googleapis/synthtool/commit/d0f51a0c2a9a6bcca86911eabea9e484baadf64b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc
parthea added a commit that referenced this pull request Sep 22, 2023
* chore: use gapic-generator-python 0.65.1

PiperOrigin-RevId: 441524537

Source-Link: googleapis/googleapis@2a27391

Source-Link: googleapis/googleapis-gen@ab6756a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
Source-Link: https://github.com/googleapis/synthtool/commit/cb960373d12d20f8dc38beee2bf884d49627165e
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2d816f26f728ac8b24248741e7d4c461c09764ef9f7be3684d557c9632e46dbd
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
* chore: Update gapic-generator-python to v1.8.4

PiperOrigin-RevId: 507808936

Source-Link: googleapis/googleapis@64cf849

Source-Link: googleapis/googleapis-gen@53c48ca
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNjNDhjYWMxNTNkM2IzN2YzZDJjMmRlYzQ4MzBjZmQ5MWVjNDE1MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
Source-Link: https://github.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7
parthea pushed a commit that referenced this pull request Oct 21, 2023
* chore: Update gapic-generator-python to v1.8.2

PiperOrigin-RevId: 504289125

Source-Link: googleapis/googleapis@38a48a4

Source-Link: googleapis/googleapis-gen@b2dc226
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJkYzIyNjYzZGJlNDdhOTcyYzhkOGMyZjhhNGRmMDEzZGFmZGNiYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants