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

initial work to remove py2 from the codebase #3421

Merged
merged 112 commits into from
Nov 26, 2018
Merged

Conversation

mmerickel
Copy link
Member

@mmerickel mmerickel commented Nov 13, 2018

  • remove references to PY2
  • remove conditional imports
  • figure out what to do with pyramid.compat going forward (more on this below)
  • remove api docs for pyramid.compat
  • remove usages of pyramid.compat.native_
  • remove usages of string_types, integer_types, and other foo_types from pyramid.compat
  • replace usages of pyramid.compat in codebase
  • fix starter cookiecutter
  • fix docs for supported versions
  • fix wiki tutorial
  • fix wiki2 tutorial
  • fix quick tutorial
  • fix quick tour docs
  • fix docstrings / api docs for affected methods (track down references to bytes, unicode or python versions)

One note is that it's important to remember to keep using text_ and bytes_ where necessary for apis that may legitimately accept bytes or strings.

what to do about pyramid.compat

pyramid.compat is a public api and addons rely on it for some compatibility features.

If we want to remove it, we should push a bugfix release in pyramid that deprecates the module to help people when upgrading.

closes #2903

@digitalresistor
Copy link
Member

If we want to remove it, we should push a bugfix release in pyramid that deprecates the module to help people when upgrading.

Yes.

@stevepiercy
Copy link
Member

@mmerickel for docs updates, where do you want me to push? I can either create a new PR or push to your branch.

I can do similar work on the cookiecutter as well.

@mmerickel
Copy link
Member Author

mmerickel commented Nov 14, 2018 via email

@mmerickel
Copy link
Member Author

So at this point pyramid.compat is completely removed from this branch and the parts we want to keep are moved into pyramid.util. This is a good starting point for deciding if we want to bring anything back. I'd really appreciate some input!

- `docs/tutorials/wiki/*` was written for Python 2 and supposedly won't run on Python 3.
- `docs/api/compat.rst` because it drops some stuff and moves other bits into `pyramid.util` and should be part of another PR.
- Ignored a couple of times where `env27` and `Python 2.` appear in command output, but they are inconsequential.
@stevepiercy
Copy link
Member

stevepiercy commented Nov 16, 2018

PR submitted for Python 2 removal from docs.

  • The traversal wiki docs/tutorials/wiki/* needs some love. It was written for Python 2 and supposedly won't run on Python 3. I excluded that for now.
  • I excluded docs/api/compat.rst because it drops some stuff and moves other bits into pyramid.util.
  • There are also a couple of times where env27 and Python 2. appear in command output, but they are inconsequential.

@digitalresistor
Copy link
Member

I asked this in private too, but native_ and text_ are not equivalent, have you verified that there was no caller depending on the behaviour of native_ to coerce to a string type?

@russellballestrini
Copy link
Contributor

I almost expected there to be a lot more deletes.

@stevepiercy
Copy link
Member

@mmerickel I noticed there is no docs/api/util.rst. Should there be one?

If so, are there any things that should not be documented?

I started on the task "fix api docs for pyramid.compat" and slammed on the brakes when I realized there was no place to move documented things from compat to util.

@stevepiercy
Copy link
Member

I completed through the authorization step and pushed commits to the branch. I reckon y'all will need significant time to review them and walk through the tutorial.

@mmerickel
Copy link
Member Author

looks like mmerickel#8 is the PR referred to above

@stevepiercy
Copy link
Member

All changes are done for the traversal wiki in mmerickel#8 (comment)

Drop py2 from wiki (traversal and zodb)
@mmerickel mmerickel merged commit 587fe72 into Pylons:master Nov 26, 2018
mmerickel added a commit that referenced this pull request Jan 18, 2020
@slav0nic
Copy link
Contributor

slav0nic commented Apr 16, 2020

@mmerickel why not also replace old-style formatting %s with .format, drop object for new-classes, user super() without params too?
super(QueryStringConstantCacheBuster, self).__init__(param=param) -> super().__init__(param=param)

class FileIter(object): -> class FileIter:
__nonzero__(self) -> __bool__(self)
etc

@mmerickel
Copy link
Member Author

Those would be contributions we could review in another PR but weren’t the focus of this one. The string formatting is the least interesting of the ones you mentioned.

@digitalresistor
Copy link
Member

Using .format() also has additional overhead compared to % based interpolation.

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.

Drop support for Python 2
5 participants