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

tag-expressions: Remove deprecated method use_2to3 #1742

Merged
merged 2 commits into from
Sep 12, 2021

Conversation

krisgesling
Copy link
Contributor

Summary

Removes the call to use_2to3 in setup.py as this method has been deprecated in setuptools>=58.0.0 (see changelog).

Fixes #1736

Details

The standard library module lib2to3 is deprecated and will be removed in Python 3.10.

Further details about why this was deprecated can be found here:
pypa/setuptools#2086

Motivation and Context

Installation of cucumber-tag-expressions will fail if the system is using newer versions of setuptools. This is actively occuring on Github Actions.

How Has This Been Tested?

pip install setuptools>=58.0.0
pip install cucumber-tag-expressions

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

I haven't tested on Python2 and am not familiar with the details of use_2to3 so this may be a breaking change.

Checklist:

  • The change has been ported to Java.
  • The change has been ported to Ruby.
  • The change has been ported to JavaScript.
  • The change has been ported to Go.
  • The change has been ported to .NET.
  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the CHANGELOG accordingly.

Method has been deprecated in setuptools>=58.0.0
Fixes cucumber#1736
@graingert
Copy link

You'll need to apply 2to3 to the source code and set a python_requires >= '3.6'

aurelien-reeves
aurelien-reeves previously approved these changes Sep 9, 2021
Copy link
Contributor

@aurelien-reeves aurelien-reeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

Copy link

@graingert graingert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to apply lib2to3 to the source code for your package to support py3

@graingert
Copy link

you could alternatively use https://github.com/PyCQA/modernize to keep python2 support

@graingert
Copy link

graingert commented Sep 9, 2021

actually it looks like 2to3 was redundant in this project:

diff --git a/tag-expressions/python/cucumber_tag_expressions/__init__.py b/tag-expressions/python/cucumber_tag_expressions/__init__.py
index 45b88a343..0877fdfc4 100644
--- a/tag-expressions/python/cucumber_tag_expressions/__init__.py
+++ b/tag-expressions/python/cucumber_tag_expressions/__init__.py
@@ -13,7 +13,7 @@ Theses selected items are normally included in a test run.
 .. _`behave: Gherkin`: https://behave.readthedocs.io/en/latest/philosophy.html#the-gherkin-language
 """
 
-from __future__ import absolute_import
+
 from .parser import parse, TagExpressionParser, TagExpressionError
 
 __version__ = "1.1.2"
diff --git a/tag-expressions/python/cucumber_tag_expressions/parser.py b/tag-expressions/python/cucumber_tag_expressions/parser.py
index 792c065ad..71aba994b 100644
--- a/tag-expressions/python/cucumber_tag_expressions/parser.py
+++ b/tag-expressions/python/cucumber_tag_expressions/parser.py
@@ -14,7 +14,7 @@ UNSUPPORTED:
 * Support special tags w/ escaped-parens: ``@reqid\\(10\\)``
 """
 
-from __future__ import absolute_import
+
 from enum import Enum
 from cucumber_tag_expressions.model import Literal, And, Or, Not, True_
 
@@ -154,7 +154,7 @@ class TagExpressionParser(object):
     """
     # pylint: disable=too-few-public-methods
     TOKEN_MAP = {token.keyword: token
-                 for token in Token.__members__.values()}
+                 for token in list(Token.__members__.values())}
 
     @classmethod
     def select_token(cls, text):

@aurelien-reeves
Copy link
Contributor

@krisgesling @graingert thanks a lot folks! 🤩

For the moment, we do not have much python contributors to the cucumber projects. So, thank you very much for your contribution!

If you still have the possibility to submit other contribution, feel free to do so 😅

We have a dedicated slack workspace. Again, feel free to join! You can register then head over to #intro.

Finally, note that there is an Open Collective for Cucumber. You can be pay for your contributions!

@jenisys jenisys merged commit 1215d00 into cucumber:main Sep 12, 2021
@aslakhellesoy
Copy link
Contributor

Hi @krisgesling,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

jenisys added a commit to jenisys/cucumber that referenced this pull request Sep 12, 2021
* Prepare for next release
* FIXES cucumber#1736 (with pull-request: cucumber#1742)
* tox: Update to newer Python versions
jenisys added a commit that referenced this pull request Sep 12, 2021
Prepare for next release: `v4.0.1`

* BUMP-VERSION: 4.0.1 (was: 4.0.0)
* tox: Update to newer Python versions

FIXES:
* FIXES #1736 (with pull-request: #1742)

OTHERWISE:
* FIX: Incorrect version info
* FIX README: Badge for CI build server status (was: Travis, but is now: CircleCI)
* FIX README: Badge was using wrong LICENSE information.
@krisgesling
Copy link
Contributor Author

Thanks @aslakhellesoy - this is a great welcome message for new contributors!

I very much appreciate the great package you and the team have built too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cucumber-tag-expressions install failing on newer versions of setuptools
5 participants