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

Remove --python3 option #5100

Merged
merged 14 commits into from
Jan 6, 2021
Merged

Remove --python3 option #5100

merged 14 commits into from
Jan 6, 2021

Conversation

amanda11
Copy link
Contributor

@amanda11 amanda11 commented Dec 3, 2020

Remove the --python3 option and associated python3_... config items.

@pull-request-size pull-request-size bot added the size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review. label Dec 3, 2020
@amanda11 amanda11 marked this pull request as draft December 3, 2020 15:28
@amanda11 amanda11 changed the title Initial changes [WIP] Remove --python3 option Dec 3, 2020
@amanda11
Copy link
Contributor Author

amanda11 commented Dec 3, 2020

Waiting for U16 to move to python3, and is also dependant on fixes in progress for cryptography and using python3 on ST tests.

@amanda11 amanda11 added this to the 3.4.0 milestone Dec 3, 2020
@pull-request-size pull-request-size bot added size/L PR that changes 100-499 lines. Requires some effort to review. and removed size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review. labels Dec 4, 2020
@amanda11 amanda11 changed the title [WIP] Remove --python3 option Remove --python3 option Dec 14, 2020
@amanda11 amanda11 marked this pull request as ready for review December 14, 2020 14:09
Copy link
Contributor

@blag blag left a comment

Choose a reason for hiding this comment

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

Keep backwards compatibility for the CLI, since we haven't been emitting deprecation warnings for that. We can emit a warning when it is passed in, but we don't need to pass it to the ST2 API.

st2client/st2client/commands/pack.py Outdated Show resolved Hide resolved
st2client/st2client/commands/pack.py Show resolved Hide resolved
st2client/st2client/models/core.py Show resolved Hide resolved
@arm4b
Copy link
Member

arm4b commented Dec 15, 2020

@blag We announced that we're removing python2 completely and users had that notice and time to migrate. This means we're removing all the python2-related functionality.

I don't think keeping that old flag would help anymore, considering this behavior doesn't work and would just provide erroneous results. I think that'll bring confusion and false sense of a working feature.

We had enough deprecation Warnings about full Python2 removal via:

  1. st2 startup logs
  2. via st2ctl cmd
  3. on pack install

This includes entire platform python2 feature set.

@amanda11
Copy link
Contributor Author

The cli did have a warning. St2 pack install had a warning in 3.3 if you installed a python 2 pack.

@blag
Copy link
Contributor

blag commented Dec 15, 2020

If my understanding is correct, then there's two warnings that should have been generated:

  • Warning about installing Python 2-only pack
  • Warning about --python3 flag being deprecated and removed, since ST2 is going Python 3 only (unless you use the --force flag)

We definitely warned about Python 2 packs, but did we also warn about the removal of the --python3 flag? I don't see it, but if I missed it, please let me know.

Consider what people would have done in the past to ensure that their packs were always Python 3:

  1. Their packs were Python 2 --> not good.
  2. Update their packs to support Python 2 and Python 3 --> better.
  3. Install their packs with --python3 in their deployment scripts or whatever --> awesome.

So now their pack still has to be installed with the --python3 flag, otherwise it gets installed with Python 2.

Since we defaulted to installing packs as Python 2 for so long, people who are trying to do things right have been forced into using the --python3 flag to ensure that their packs use Python 3.

If we up and remove this flag, the CLI will no longer recognize the flag and throw an error. That will cause those people's deployment scripts or whatever to immediately break. That's pretty rude of us - we are effectively penalizing people who have been doing things "right" and trying to switch to Python 3 for awhile.

Instead, we should at least allow a grace period where we still accept that (now superfluous) --python3 flag, but we emit a warning about it. That will give our users, who have been doing things the Right Way (tm) so far, time to remove the use of that flag from their deployment scripts.

If I have been operating under a misconception please correct me, but as I understand it, we should not break things for our best users.

@amanda11
Copy link
Contributor Author

I think your understanding is correct, and I get your point as to why we should allow them to still use --python3 option with a warning.
I am happy to rework as per your suggestion, if @armab also happy.

@arm4b
Copy link
Member

arm4b commented Dec 25, 2020

@amanda11 Per https://stackstorm-community.slack.com/archives/CSBELJ78A/p1608157605269500 discussion, I'm 👍 fine with @blag plan to keep the flag for one more release if there are concerns that python 2 removal/deprecation communication wasn't enough for this change.

@amanda11
Copy link
Contributor Author

amanda11 commented Dec 28, 2020

@blag @armab I've kept in the --python3 option in the CLI, but I only kept it in the commands/pack.py. I didn't see any other print etc being done in the manager files, so I wasn't sure why we wanted to pass the argument through to the manager and do the prints in there, as all the other printing seems to be done in the commands/*.py files.
If it's needed I will move it to the manager file, but I wasn't sure on that suggestion.

Feedback appreciated on the code and warning text.

Example output:

$ st2 pack install aws_boto3 --python3

For the "aws_boto3" pack, the following content will be registered:

actions   |  6
rules     |  0
sensors   |  0
aliases   |  0
triggers  |  0

Installation may take a while for packs with many items.

DEPRECATION WARNING: --python3 flag will be ignored, as ST2 now runs with python3 as the default on all OS


	[ succeeded ] init_task
	[ succeeded ] download_pack
	[ succeeded ] make_a_prerun
	[ succeeded ] get_pack_dependencies
	[ succeeded ] check_dependency_and_conflict_list
	[ succeeded ] install_pack_requirements
	[ succeeded ] get_pack_warnings
	[ succeeded ] register_pack

+-------------+-------------------------+
| Property    | Value                   |
+-------------+-------------------------+
| ref         | aws_boto3               |
| name        | aws_boto3               |
| description | AWS actions using boto3 |
| version     | 0.8.0                   |
| author      | StackStorm, Inc.        |
+-------------+-------------------------+

@@ -210,7 +210,10 @@ def run(self, args, **kwargs):
if not is_structured_output:
self._get_content_counts_for_pack(args, **kwargs)

return self.manager.install(args.packs, python3=args.python3, force=args.force,
if args.python3:
print('\nDEPRECATION WARNING: --python3 flag will be ignored, as ST2 now runs with python3 as the default on all OS\n')
Copy link
Member

Choose a reason for hiding this comment

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

Maybe something along the lines would be more precise?

DEPRECATION WARNING: --python3 flag is ignored and will be removed in v3.5.0 as StackStorm now runs with python3 only

@@ -210,7 +210,10 @@ def run(self, args, **kwargs):
if not is_structured_output:
self._get_content_counts_for_pack(args, **kwargs)

return self.manager.install(args.packs, python3=args.python3, force=args.force,
if args.python3:
print('\nDEPRECATION WARNING: --python3 flag is ignored and will be removed in v3.5.0 as StackStorm now runs with python3 only\n')
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not use warnings.warn here?

@blag
Copy link
Contributor

blag commented Dec 28, 2020

Rerunning end-to-end tests with this to ensure that StackStorm/st2tests#196 didn't break anything.

@amanda11
Copy link
Contributor Author

amanda11 commented Dec 28, 2020

@blag I fixed the lint problem as it also needed an import of warnings. Output using warnings is as follows:

IInstallation may take a while for packs with many items.
/home/centos/st2/st2client/st2client/commands/pack.py:215: UserWarning: 
DEPRECATION WARNING: --python3 flag is ignored and will be removed in v3.5.0 as StackStorm now runs with python3 only

  warnings.warn('\nDEPRECATION WARNING: --python3 flag is ignored and will be removed '

	[ succeeded ] init_task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines. Requires some effort to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants