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

potential linter to assist in maintaining py 2/3 compat #6157

Closed
cosmicexplorer opened this issue Jul 17, 2018 · 3 comments
Closed

potential linter to assist in maintaining py 2/3 compat #6157

cosmicexplorer opened this issue Jul 17, 2018 · 3 comments

Comments

@cosmicexplorer
Copy link
Contributor

cosmicexplorer commented Jul 17, 2018

See this comment from @Eric-Arellano describing what a useful linter might be to help maintain our changes for py 2/3 compat. We should be able to add a new CheckstylePlugin subclass in contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/ to implement the linting described in that comment. Once we move entirely to python 3, this linter could be split off into its own pypi package if it could be useful to other projects, or simply removed (or updated for any py3 linting we may want to do, if other linters don't satisfy all the cases we want to catch).

@Eric-Arellano
Copy link
Contributor

To follow up on this, here is a list of the imports the linter would require. Anytime one of those builtins is used, the corresponding import must be added to the file.

@Eric-Arellano
Copy link
Contributor

This issue ties into the overarching Python 3 port, #6062.

cosmicexplorer added a commit that referenced this issue Jul 19, 2018
### Problem

`pkill -f "pantsd \[" pantsd-runner && ./pants --enable-pantsd help` fails on master when run within a tty because we incorrectly try to pass an `int` directly to a `bytes`. This was introduced during #6159.

### Solution

- Wrap the `bytes()` argument in a list in `NailgunProtocol.isatty_to_env()`.
- Add unit testing which mocks out the tty querying to ensure the environment we return is valid.

### Result

No more crashing when trying to create a pantsd in a tty.

#### Thoughts

This may be another argument for something like #6157. There may also be room for an integration test which opens up a "real" pty to catch issues like these in the future, but it's not clear to me how to do that right now.
@Eric-Arellano
Copy link
Contributor

Stale. We're now entirely on Py3 :) We put some tips for end users migrating to Py3 in the new docs at https://pants.readme.io/docs/python-interpreter-compatibility#using-multiple-python-versions-in-the-same-project.

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

No branches or pull requests

2 participants