important-psychiatrist-39230
10/03/2022, 11:14 PMstructlog
to help generate structured json based logs. However, during development those logs are effectively useless.
In general this is fine because I can vary the configuration to output easy to parse logs when you're in running locally. However, to get some extra high quality formatting in development we need to have an extra library available: rich
To have pants run
work and load up rich into the dev time pex file, I've had to add this to one fo the build files
python_sources(
dependencies=['//:deps#rich']
)
This now works fine when running locally. However, that library has -zero- reason to exist in our hosted environments, but it will continue to be part of the pex file given the above configuration. Is there a lever to manage this that doesn't lead to significant overhead and duplication?bitter-ability-32190
10/04/2022, 12:52 AMimportant-psychiatrist-39230
10/04/2022, 2:58 AMpants run
but when I do pants package
that dependency has no value and just chews up space.enough-analyst-54434
10/04/2022, 3:27 AM!
and !!
" callout box there given his response on another of your threads. In other words, apply transitive excludes to `pex_binary`targets to rid production of things like '//deps#rich' not needed there.important-psychiatrist-39230
10/04/2022, 4:08 PMbitter-ability-32190
10/04/2022, 4:30 PMgotcha. Yeah I guess that'd work but that means my dev run commands couldn't use the same target as prod doesThey already will in a way. In Pants you can run the source file
./pants run path/to/file.py
which is faster than running the pex_binary
. Prod will be using the pex_binary
, whereas devs can chose but usually prefer the speed of running the source. So it's a good natural seam to have the pex_binary
targets transitively exclude the dev dep and add the prod dep.
At least, that;s my experience.pex_binary
. Anything else is a Pants bug IMOimportant-psychiatrist-39230
10/04/2022, 4:37 PMpoe dev
and it starts the dev server, there's no knowledge of how it's running needed.
While that domain expertise isn't a Bad Thing โข๏ธ, it will result in a more weaker development experience. ๐bitter-ability-32190
10/04/2022, 4:39 PMimportant-psychiatrist-39230
10/04/2022, 5:00 PMenough-analyst-54434
10/04/2022, 5:04 PMbitter-ability-32190
10/04/2022, 5:30 PMpoetry
extensively at my last gig. I think in a few dimensions its just a fundamentally different way of doing things ๐
Poetry (and even tox if configured) makes a venv with everything in it, whereas Pants is "nothing more than exactly what is specified (implictly or explicitly)".
That being said, I can see a world where dev_dependencies
exists as a field. I think the logical hurdle is just how to know when it should be considered or ignored.python_source(
...,
dependencies=[...],
dev_dependencies=[...],
)
then:
./pants run/package/etc... path/to/target
represents "prod" (E.g. ignore dev deps) and
./pants --dev-deps run/package/etc... path/to/target
would mix those in.important-psychiatrist-39230
10/04/2022, 5:32 PMdev
goal, which is more in line to how a lot of ecosystems think of it.bitter-ability-32190
10/04/2022, 5:33 PMrun
and package