I wanted to link this for people that are having i...
# general
r
I wanted to link this for people that are having issues with the development process. One of the things I determined at some point was that for monorepos it's helpful to separate each project into their own workspace. I plan on writing some tools for working with Pants at some point, though the work I have on my plate is a bit intense. I can't do it immediately until certain obligations are met. https://marketplace.visualstudio.com/items?itemName=folke.vscode-monorepo-workspace
đź‘€ 1
@happy-kitchen-89482 So, here's an idea. IDK if you guys have a Pants VSCode extension that you're building, but I would totes would love if you would do it openly.
I want to develop an extension, but I'd prefer to: 1. Not clash with the development you guys are doing. This also extends to doing useless work. 2. Ensure the solutions I come up with are solidified 3. Ensure the solutions are used.
f
This seems to be for the case where you have multiple well-defined projects sharing a single repo and probably a lockfile. I'm not sure my projects break down quite that easily. But I'll give this a try and let you know what I think
h
Hi Kevin, thanks for the link and for offering to come up with solutions!
I don't use VSCode myself, so I'd need to do more learning before expressing opinions...
But @witty-crayon-22786 has had some thoughts about it I think?
r
I already came up with a CLI to manage the pants monorepo. I plan on iterating on it in the near future, though I can foresee having a system in place to make it so the user won't have to think would be hella useful.
h
We would definitely appreciate contributions from a user such as yourself who has actual use-cases in mind.
đź’Ż 1
r
To Pants.build?
Or a plugin?
h
I will say that Pants does support multiple source roots (https://www.pantsbuild.org/docs/source-roots)
Is that what you mean by multiple worksapces?
I prefer to not work that way personally, but each repo can make their own decision.
I guess it would be great if we could come up with a way to support VSCode and other IDEs without requiring a particular repo layout.
r
Yeah ... that was the goal at some point
h
Re core or plugin, everything is a plugin these days, but I can imagine this being in the core repo
Better IDE support is a much-requested feature
We're still figuring out what that means for the various leading IDEs out there
r
For the CLI I've set it up to detect the pants config file in python then I use that config to do things like find the source routes
f
what i understand "better IDE support" to mean for me is a way to convince my IDE to use pants for everything it wants to do with my project
r
PEX file format is godsend for having a CLI tool that can go into the path of any Unix OS.
@enough-analyst-54434 I feel that
f
i think IDEs are often coded with certain assumptions about being the orchestrator of tools within a project (VS Code is pretty flexible with its plugins and all, but it still assumes you can configure everything to work with it), but when you start using pants you start to realize its a superior orchestrator and you want your tooling to work through it, rather than around it
r
The biggest thing I wanted was the capacity to add/remove projects between Rust and Python. Then have autocomplete work with no problem.
Yeah ... there's some thoughts I have around that. Autocomplete and quick commands (macros in VIM) are bae,
f
what do you mean by "add/remove projects between Rust and Python"?
r
To answer your question. I wanted to be able to start a new project inside of the monorepo (think using
poetry new
) or
cargo init
and be able to link the projects I have while developing them so I have autocomplete for them.
I couldn't live without autocomplete honestly. I have a condition that makes it so I have a short-term memory of a goldfish.
When writing python, it's kind of hard to manage cross-project dependencies.
For example:
(Editing for Formatting) 1. I have a bunch of separated util libraries that needed to be consumed by a bigger project. I was struggling with both installing the util projects into my bigger project. 2. I was also having issues with creating build processes and plugins for the code itself. It took me a few times of reading the tutorials to understand what I should be doing there, though I figured the actual steps for going about doing the most common things should be pretty well defined. 3. What I've come to do is rely on the DepHell project to create a
setup.py
then install an editable version of the micro-projects I'm including in a bigger project using their installation method.
Cargo has cargo-workspaces to help with that. Python doesn't
Might as well add some other things too: 1. While I'm trying to isolate the development of projects I want to not have to look at the other folders that are out there. Having some sort of isolation has been beautiful for development itself. It both helps for indexing and gives mental clarity. 2. For the isolation problem I have above, I use VSCode's multi-root workspaces. That surprisingly helps with project specific autocompletion (which is also a problem). I can choose a Python virtualenv per root meaning the completion I have doesn't bleed immediately over from other projects.
f
okay for many of these goals, i think you don't really need to think of these things as "multiple projects" with pants, as you can kinda just let dependency inference and build graph awareness work for you
w
@refined-dusk-58376: i’m just finishing lunch and going into a meeting, but this is a really, really interesting space, and i think that we’d love to support work happening on a workspace concept.
f
(this is how i use pants anyways, and it's really the killer feature for me, but i'm not everyone)
r
VSCode doesn't see it that way
Which was kind of frustrating when I got started
f
i just let vs code see the whole source tree
w
https://docs.google.com/document/d/1sr1O7W9517w8YbdzfE56xvDb72LafK94Fwxm0juIRFc/edit# is related to this, but not identical. a Resolve might be larger than a single “project” or “target”, but smaller than the entire repository.
if you workspace is entirely contained within one Resolve, then it is consistent from a typeahead perspective
e
An idea from long long ago is to integrate pants knowledge of your "projects" and their dependencies with
git sparse-checkout
to implement a (strawman name)
./pants view <files or targets>
f
makes sense, and i could see the desire to have "workspaces" that are aggregations of targets, probably limiting that to trees for simplicity's sake
r
Yeah ... it's kind of strange while developing that way for me. I have a condition that kind of reduces my mental filter. Too much information turns into a problem
e
Perforce + Blaze (Bazel) could do this and it was useful for all the reasons noted here so far.
f
me too, but my coworkers have a condition where they have trouble drawing the lines between "projects" well and end up making bad design decisions about those boundaries that affect us all down the line
r
LOL
f
maybe a better way to express what i mean is that pants allows me to delay the decision to treat some code as "library" code and other code as "application" code until very late in the process
it's all
python_library()
to pants for the most part, until you define a binary target
this does require some discipline with how i do my imports, but it's inspectible with tools like
./pants dependencies
& co
r
I'm going to have to create a practice project where I write a DSL. I might give pants a first run.
w
for the purposes of IDE integration, having separate/independent definitions of “what you load to work on a particular workspace/subset-of-the-repo” is a pretty powerful concept… which seems to be the thrust of https://marketplace.visualstudio.com/items?itemName=folke.vscode-monorepo-workspace
f
it does, but that one also seems limited to a tree-based view of it
r
I have a bunch of problems that need to be standardized, and a DSL is basically the only way I see as a means to solve the problems.
f
if that notion could be expanded to a DAG, i'd see a hell of a lot more utility in it
w
@flat-zoo-31952: right. i think that idea is that you pick and choose the “roots” of the import, and then their dependencies are imported as well?
f
perhaps? it errored on me when i tried it, so i can't really tell though
but that's what i mean for IDE integration being about making the IDE ask pants for things like this
because pants knows how to answer things like "what portions of this codebase do i need for this development task" better than any IDE does
r
Dope. I love that there's discussion about this. I'd say go for a bare minimum, fork the existing plugin (one linked above) and have the people on the team that use VSCode create an extra feature every now and then.
Generally, the
pants.toml
file will tell where the sources. People could select how to interpret how they go underneath those sub folders
When my schedule actually clears up the plan was basically to fork the VSCode extension and try getting it to work with Pants
🔥 1