fresh-xylophone-16214
07/27/2022, 12:02 AMhundreds-father-404
07/27/2022, 12:04 AMhundreds-father-404
07/27/2022, 12:04 AMfresh-xylophone-16214
07/27/2022, 12:07 AMfresh-xylophone-16214
07/27/2022, 12:11 AMhundreds-father-404
07/27/2022, 12:15 AMhundreds-father-404
07/27/2022, 12:16 AMfresh-xylophone-16214
07/27/2022, 12:19 AMhundreds-father-404
07/27/2022, 12:21 AM/bin/path/to/pyright
as the first value in argv
. It will allow you to get everything else working
Then, we can generalize it. For example, in your org, it may be sufficient to assume everyone has the binary installed in the same place. Or, Pants has code to discover the pre-installed binary; or we have code to install it for you, e.g. via the pip packagefresh-xylophone-16214
07/27/2022, 12:22 AMhundreds-father-404
07/27/2022, 12:23 AMfresh-xylophone-16214
07/27/2022, 12:23 AMwide-midnight-78598
07/27/2022, 12:35 AMhundreds-father-404
07/27/2022, 12:36 AMBut I'd never really thought about cases where you have one backend's system lint/check another's. I don't see why it wouldn't workIt should! The rules API is designed specifically to make this type of integration possible, where things are highly pluggable
wide-midnight-78598
07/27/2022, 12:37 AM@dataclass(frozen=True)
class PrettierFmtFieldSet(FieldSet):
required_fields = (JSSourceField,)
sources: JSSourceField
If that changed to the pyfields?hundreds-father-404
07/27/2022, 12:37 AMwide-midnight-78598
07/27/2022, 12:38 AMdo you think it would be useful to land your generic NPX support in Pants to help out plugin authorsYeah, but I don't think it's there yet and I'm hesitant for people to build off of an incomplete work. There is some caching work that is slightly over my head, and then I'd like API reviews to make sure it's sane (since we're using NPX calls directly)
fresh-xylophone-16214
07/27/2022, 12:38 AMhundreds-father-404
07/27/2022, 12:38 AMOh like via the field_sets?The idea is we'd have generic rules like
NpxProcess
, very similar to how we have the `Pex`/`PexRequest` and PexProcess
types. Any rule is free to use those how they want
So then the Pyright plugin would indeed use a CheckFieldSet
on Python targets. But inside its rules, it would use NpxProcess
wide-midnight-78598
07/27/2022, 12:39 AMhundreds-father-404
07/27/2022, 12:39 AMThere is some caching work that is slightly over my head, and then I'd like API reviews to make sure it's sane (since we're using NPX calls directly)I think we'd be able to help with this. Having
NpxProcess
landed as a generic "building block" would be great. Helps out plugin authors, and gives a good foundation for folks to build out a JavaScript/TS backendbusy-vase-39202
07/27/2022, 12:40 AMhundreds-father-404
07/27/2022, 12:41 AMNpxProcess
exists alreadywide-midnight-78598
07/27/2022, 12:41 AMbusy-vase-39202
07/27/2022, 12:42 AMwide-midnight-78598
07/27/2022, 12:42 AMfresh-xylophone-16214
07/27/2022, 12:42 AMhundreds-father-404
07/27/2022, 12:45 AMI wasn't sure if there was another "landing" process where it gets moved into a generic backend, instead of dedicated.It's fine for a backend to use rules defined in another backend, so long as its
register.py
activates everything necessary. For example, you can activate the Black backend without activating the Python backend, and it works! (Only, no target definitions)
So no need to move it somewhere elsewide-midnight-78598
07/27/2022, 12:48 AMbitter-ability-32190
07/27/2022, 12:00 PMwide-midnight-78598
07/27/2022, 12:27 PMlemon-oxygen-72498
10/07/2022, 3:06 PMpyright
support since this discussion? (I couldn't find any in this Slack or in GH issues). Similarly to @fresh-xylophone-16214 I'm evaluating pants
to help scale our python monorepo, but we use pyright
so far, not mypy
.bitter-ability-32190
10/07/2022, 3:07 PMlemon-oxygen-72498
10/07/2022, 3:08 PMlemon-oxygen-72498
10/07/2022, 3:13 PMwide-midnight-78598
10/07/2022, 3:21 PMbitter-ability-32190
10/07/2022, 3:21 PMpyright
woulnd't be a linter 😤bitter-ability-32190
10/07/2022, 3:22 PMnpm
tool distributed by PyPI, so even weirder 😛bitter-ability-32190
10/07/2022, 3:23 PMpyright
. I find it is better than mypy
. Which is hilarious, because mypy
should be the shining example, but when you have corporation $$$ you can do anything)wide-midnight-78598
10/07/2022, 3:23 PMmeta checker
bitter-ability-32190
10/07/2022, 3:28 PMwide-midnight-78598
10/07/2022, 3:28 PMhappy-kitchen-89482
10/07/2022, 3:30 PMlemon-oxygen-72498
10/07/2022, 3:41 PMpyright
inference capabilities. It infers pretty good types, even on datascience libraries that are notoriously hard to typecheck, with lots of union types. User experience has been really good so far with `pyright`: it's fast, silent when it should be, and when it outputs an error it's on point.
In addition there is feedback as you type in vscode
which I believe mypy
doesn't support (although I'm no mypy
expert, so may miss something).bitter-ability-32190
10/07/2022, 3:43 PMpyright
comes embedded with a LSP for Python.
Also the turnaround time on issues for that tool is insane. Eric Traut is a beastwide-midnight-78598
10/07/2022, 3:56 PM11:55:34.61 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Run Pyright on 8 files.' failed with exit code 1.
stdout:
No configuration file found.
No pyproject.toml file found.
Assuming Python platform Darwin
Searching for source files
Found 8 source files
pyright 1.1.274
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/greet/greeting.py
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/greet/greeting.py:9:8 - warning: Import "pkg_resources" could not be resolved from source (reportMissingModuleSource)
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/main.py
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/main.py:4:6 - error: Import "colors" could not be resolved (reportMissingImports)
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/translator/translator_test.py
/private/var/folders/18/q1r7phps28nc9rx5j_0t3jmm0000gp/T/pants-sandbox-G31wI5/helloworld/translator/translator_test.py:4:8 - error: Import "pytest" could not be resolved (reportMissingImports)
2 errors, 1 warning, 0 informations
bitter-ability-32190
10/07/2022, 3:56 PMwide-midnight-78598
10/07/2022, 3:57 PMlemon-oxygen-72498
10/07/2022, 4:01 PMpyright
support makes it soon to pants
, it'll make a net difference regarding possible acceptance of pants
in my team 🙏wide-midnight-78598
10/08/2022, 1:37 AMpyright
to any degree to help me setting it up (or, even better, takeover my PR to add config)
I have it running on input sources, naively - but I've never used pyright
outside of VS Code before, so I'm not a great person to be handling the config aspectslemon-oxygen-72498
10/10/2022, 8:50 AMwide-midnight-78598
10/10/2022, 4:20 PMpyright
out of VSCode, so I'm clueless about argslemon-oxygen-72498
10/11/2022, 8:59 AMwide-midnight-78598
10/11/2022, 12:33 PMbitter-ability-32190
10/11/2022, 1:04 PMexport
bitter-ability-32190
10/11/2022, 1:04 PMbusy-vase-39202
10/11/2022, 3:10 PMbitter-ability-32190
10/11/2022, 3:25 PMbitter-ability-32190
10/12/2022, 10:40 AM