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

Drop python3.6 support #681

Merged
merged 5 commits into from
Feb 9, 2023
Merged

Drop python3.6 support #681

merged 5 commits into from
Feb 9, 2023

Conversation

sirosen
Copy link
Member

@sirosen sirosen commented Feb 8, 2023

Remove it from all CI and configurations, docs, etc.
Then, do some rewrite magic (my fingers are sore from my macros!) to get __future__ style annotations in place.

Nothing is changing other than the removal of 3.6 support and the future possibility of 3.6 support on this branch.
I am ready to get this list[Changes] merged. Are you?

CI config, tox, and setuptools config are all updated.
pyupgrade is intentionally exempted so that it can be updated in a
dedicated commit.

The changelog fragment is included.
This applies some rewrites.
This was always going to be a multi-step process to add `__future__`
imports, rewrite, and iterate. However, there's an additional
wrinkle: unfortunately, `pyupgrade` does not support rewrites on
`import typing as t`-style annotations.
Therefore, the following procedure includes rewrites away from and
back to this style.

1. Set future annotations in all files

Run a script to inject `from __future__ import annotations` in all
non-`__init__.py` python files in the src tree.

2. Convert `import typing as t` style to `import typing` style

This was done with a combination of scripts and macros.

3. Run `pre-commit run -a` to converge

Converge, converge, converge. `black`, `isort`, `pyupgrade`, until
they get along.

4. Convert `import typing` style back to `import typing as t` style

Again, scripts and editor macros. Converge again, as the rewrites may
fold out and fold in with `black`, especially.

5. Update _generate_init.py to not check python version

The TYPE_CHECKING branch was combined with the py3.6 branch. Remove
that logic for better clarity.
- A tox environment list in the Makefile (aside: maybe remove in the
  future?)
- A bit of documentation text in `_testing`
kurtmckee
kurtmckee previously approved these changes Feb 8, 2023
Copy link
Member

@kurtmckee kurtmckee left a comment

Choose a reason for hiding this comment

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

Thanks for keeping the pyupgrade modifications in a separate commit! I basically glossed over that as "tools doing what tools do...nothing to see here".

@kurtmckee kurtmckee self-requested a review February 8, 2023 19:13
@kurtmckee kurtmckee dismissed their stale review February 8, 2023 19:14

pylint is unhappy

@sirosen
Copy link
Member Author

sirosen commented Feb 9, 2023

I was really surprised when I got back to this to see the pylint failure.
My first reaction was "why didn't pylint see this before?"

But the diff to fix it is

+        type: None  # pylint: disable=redefined-builtin
+        | (Literal["file", "dir"]) = None,
-        type: None
-        | (Literal["file", "dir"]) = None,  # pylint: disable=redefined-builtin

So I think we can see what happened here, at some level.

@sirosen sirosen merged commit b01ee53 into globus:main Feb 9, 2023
@sirosen sirosen deleted the drop-python3.6 branch February 9, 2023 19:10
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.

2 participants