quaint-telephone-89068
01/30/2023, 6:50 AMmonorepo/
.python-version
service_foo/
.python-version
src/python/...
service_bar
library_xyz
library_baz/
.python-version
For example, with Python 3.7 reaches its EOL, we have to upgrade, but not every team in the monorepo will be ready at the same pace. We have to compile library_baz and service_bar with Python 3.9 first, and push the 3.9-based artifact to internal pypi.
Describe the solution you'd like
Allow the .python-version to be used to override the Python version at sub module level.
If library_baz is used by both service_foo and service_bar yet these 2 services are not upgraded to the new Python at the same time, it might still be a problem, therefore if service_foo has Python 3.9 specified then it will also use 3.9 to build its dependencies including library_baz even if library_baz is still pinned to 3.7
Once all the services & modules in the monorepo have migrated to 3.9, it will be easy to clean up the .python-version file at sub module level.
Describe alternatives you've considered
The other alternative is to use multiple git branches, each one is associated with a specific Python version. Everything (services, modules) in that branch will use the same Python version, and the branch tag will be used to publish artifact.
Yet the artifact publish process can be hard to manage in this case.
Additional context
If there's any best practice and/or advice how to handle major Python version upgrade in a monorepo scenario, that will be great.
pantsbuild/pants