curved-computer-88379
07/12/2023, 7:22 PMsrc/
and projects/
where src/
contains source code and projects
contain individual projects that may or may not source from src
. I was thinking that each project either builds an image from the Dockerfile within the project directory, or from the root directory base Dockerfile
that will likely be compatible across multiple projects.
What are some steps I should take to integrate python builds / services that are currently deployed in production using docker, but integrating pants so I can source shared code (versioned) across projects.
Example: Say I update the shared code ~/src/utils.py
from version 0.1 to 0.2, but I don’t want to have to worry about maintaining project_1 once it’s been deployed (e.g. if utils
version 0.2 breaks project_1, so project_1 requires utils version 0.1)
For example
project_1:
run.py <- sources from /app/src/utils.py version 0.1
Dockerfile
requirements.txt
...
project_2:
run.py <- requires /app/src/utils.py version 0.2 since utils.py was updated
Dockerfile
requirements.txt
...
high-yak-85899
07/12/2023, 7:27 PMrequirements.txt
) for the entire repo and not try to bifurcate for each project.high-yak-85899
07/12/2023, 7:28 PMhigh-yak-85899
07/12/2023, 7:28 PMsrc/
and projects/
as you've described!high-yak-85899
07/12/2023, 7:29 PMsrc
and specialize/use in projects
curved-computer-88379
07/12/2023, 7:29 PMhigh-yak-85899
07/12/2023, 7:30 PMhigh-yak-85899
07/12/2023, 7:30 PMcurved-computer-88379
07/12/2023, 7:30 PMhigh-yak-85899
07/12/2023, 7:31 PMhigh-yak-85899
07/12/2023, 7:31 PMhigh-yak-85899
07/12/2023, 7:32 PM__defaults__
in the right place at the top level of each projecthigh-yak-85899
07/12/2023, 7:32 PMhigh-yak-85899
07/12/2023, 7:32 PMcurved-computer-88379
07/12/2023, 7:32 PMcurved-computer-88379
07/12/2023, 7:33 PMhigh-yak-85899
07/12/2023, 7:33 PMhigh-yak-85899
07/12/2023, 7:33 PMsrc
high-yak-85899
07/12/2023, 7:34 PMparametrize
functionality to indicate that your source code can be used among one of multiple resolves.high-yak-85899
07/12/2023, 7:34 PMcurved-computer-88379
07/12/2023, 7:35 PMhigh-yak-85899
07/12/2023, 7:35 PMhigh-yak-85899
07/12/2023, 7:37 PMhigh-yak-85899
07/12/2023, 7:38 PMcurved-computer-88379
07/12/2023, 7:39 PMsrc
folder was my initial reason for diving into a monorepo.curved-computer-88379
07/12/2023, 7:39 PMsrc
and it broke project_1. I don’t want to have to worry about maintaining 50+ different projects once they’ve been deployed to productionhigh-yak-85899
07/12/2023, 7:40 PMsrc
would be one repo, project_1
would be another repo, and project_2
would be another still.curved-computer-88379
07/12/2023, 7:40 PMcurved-computer-88379
07/12/2023, 7:40 PMhigh-yak-85899
07/12/2023, 7:40 PMI don’t want to have to worry about maintaining 50+ different projectsThis is why it kind of sounds like a monorepo isn't the right solution for you. This is precisely one of the things a monorepo architecture aims to do; provide immediate visibility when you break compatibility with downstream consumers.
curved-computer-88379
07/12/2023, 7:42 PMpython_binary(
name='project_1',
source='run.py',
dependencies=[
'//src:shared_utils==0.1',
# Add other project-specific dependencies if any.
],
)
curved-computer-88379
07/12/2023, 7:43 PMpython_binary(
name='project_2',
source='run.py',
dependencies=[
'//src:shared_utils==0.2',
# Add other project-specific dependencies if any.
],
)
curved-computer-88379
07/12/2023, 7:45 PMsrc
directory. Once deployed to production doesn’t pants store the version of each py library sort of like git? If utils==0.1 is set then shouldn’t it source the old version of utils?high-yak-85899
07/12/2023, 7:47 PMsrc
to be compatible with what's currently in projects/*
high-yak-85899
07/12/2023, 7:47 PMcurved-computer-88379
07/12/2023, 7:48 PMnumpy
and no the function np.bool
is no longer supported / throws an error. Say a line of code will error out in projects/project_1 because it calls np.bool
. Will pants detect that?curved-computer-88379
07/12/2023, 7:50 PMnp.bool
is no longer supported?high-yak-85899
07/12/2023, 7:51 PMnp.bool
is called, then your pants test
commands would fail.acoustic-library-86413
07/13/2023, 10:16 AMcurved-computer-88379
07/13/2023, 10:13 PMdependencies = [
utils==git+http://<utils url>.git@commit
]