Hi all, does anyone know if there’s already a Pant...
# general
l
Hi all, does anyone know if there’s already a Pants plugin for Python’s futurize? I’m working on moving some Python2 into my brand new monorepo and I’m missing that piece. Otherwise I will try to create one
e
I don't think so. @hundreds-father-404 did almost all of the Pants futurization work (I.E.: futurize the Pants codebase itself) in the Pants v1 days:
Copy code
$ git grep futurize
src/python/pants/notes/1.10.x.rst:* futurize confluence (#6115)
src/python/pants/notes/1.9.x.rst:* Run `futurize --stage1` to make safe changes for python 3 compatibility. (#6063)
I thought there were blogs or docs about this general task of migrating 2 to 3 and how to do it but failed to find them. You can start with an in-repo plugin. I'm not sure how the community would feel about migrating that into core Pants since it will require setting up Python 2.7 in CI at the very least to test and skip on Pants developer machines that do not have 2.7.
l
thanks @enough-analyst-54434
h
If the repo is small enough, then I don't think futurize is very necessary. But for both Pantsbuild and Foursquare, the repos were way too big to be able to safely migrate in a few PRs. So I found futurize incredibly helpful to make incremental progress
l
I’ll take a look @hundreds-father-404
❤️ 1
h
(wrong Eric hah)
l
oops fixed! 😅
Yes my repo is medium size
h
Also check out this blog: https://blog.pantsbuild.org/python-3-migrations. Although, it's somewhat out of date in that we changed the semantics of interpreter constraints: now, when you set interpreter constraints for a file, it needs to consider the compatibility of all of its dependees. Before, you could claim a file was Python 3 even if it's dependency was Python 2 only. Most of the blog is still relevant, though
l
Thanks @hundreds-father-404! will do
❤️ 1