I’m doing some work around making it easier to hav...
# general
f
I’m doing some work around making it easier to have targets that want different runtime platforms. This is some refactoring / consolidation work that moves towards making those changes easier. https://github.com/pantsbuild/pants/pull/8938
h
If you have a little extra time, consider adding type hints to that code for extra validation that this works properly and better readability. Have you used type hints and MyPy before? It could be a can of worms though because we don’t have many type hints for V1 and aren’t planning on investing the time in that. When you add new type hints to untyped code, you often find issues (usually that MyPy needs more information).
f
I have not yet
I don’t mind adding them--should I just look around for examples to crib from elsewhere in the repo?
w
Thanks @fancy-queen-20734!
h
should I just look around for examples to crib from elsewhere in the repo?
Yes that works well 🙂 https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html is a great cheat sheet also
f
@hundreds-father-404 I think it’d be clearer if the type annotations were added as a separate change. I have to move some things around for it to work
👍 1
h
Okay sounds good! Don’t worry about adding them in general, also. Generally, we expect V2 code to be typed, but there’s no expectation for V1
f
Does V2 use subsystems as they are currently defined, or will they be redefined using rules as they are pulled in?
I think I’m only touching v1 code with these changes, but I’m not 100% certain modulo that question
h
Does V2 use subsystems as they are currently defined, or will they be redefined using rules as they are pulled in?
V2 uses
Subsystem
normally, although declares its depedency through a
subsystem_rule
, rather than through
global_subsystems
in a
register.py
. For example: https://github.com/pantsbuild/pants/blob/master/src/python/pants/rules/core/strip_source_root.py#L62
f
I see. I think nothing uses the subsystem I’m modifying from V2 right now, though I expect that to change in the future. It looks like apart from having to move around declarations to make the typer happy, adding type hints should be straightforward though
💯 1
w
thanks! looking.
commented: thank you
...more followup comments, sorry
f
@witty-crayon-22786 I responded to your feedback on the patch
and made changes
w
@fancy-queen-20734: looks good. i think i agree that strictness could/should be a property of the platform.
the general gist of the direction we're headed in is that we should be much more Subsystem centric than Task centric, if possible.
but also, please don't be afraid to deprecate things: if you're interested in moving
strict
, fire away
mind pinging me again when it goes green if i don't see it first?
thanks!
f
sure
Do you mind if I post the next patch in a new PR on top of these changes, or should I wait
h
the general gist of the direction we're headed in is that we should be much more Subsystem centric than Task centric, if possible.
This is because we don’t have tasks in V2. Moving options to subsystems helps a lot for allowing us to migrate things easily to V2
f
makes sense
I think coming up with a good split of responsibilities and relationships between JVM / JvmPlatform / Distribution will be helpful here
One thought I had was making changing Distribution to have a platform, rather than declaring a global platform
The stuff I’m working on also doesn’t really touch on tool jvm requirements, but that probably should be a part of the final subsystem layout too