Open totaln opened 2 months ago
Hey there! It looks like --in-place
is applied inline as part of the docformatter backend.
Some work may be needed to allow running docformatter in both check and format modes through Pants. If you'd like to contribute it, that'd be most welcome! You can find a similar PR for Ruff here.
Presumably we add --in-place
so we can capture the outputs easily.
Yeah, running as a checker would require a little work, but probably not much, if you'd like to take it on!
hi @benjyw , @krishnan-chandra! Is there any happy path (except docs) to run pants locally on the MacOS (M-chip)? I've been trying for a few days but facing multiple errors with libiconv, tokio, and other libs repeatedly...
It should just work and indeed works fine on my M1 by cloning the repo and running pants
.
It will be difficult to provide further help without a lot more detail on what you're doing and the exact errors you're seeing...
I understand.
So I just follow the pants local development guide (installed python3.9, nix-shell, rustup, updated openssl, etc., so it's not just to clone repo and run pants), then under nix-shell running pants, and after some time of compiling it throws different errors:
1. the first error
error[E0432]: unresolved import `tokio::task::Id`
--> task_executor/src/lib.rs:14:19
|
14 | use tokio::task::{Id, JoinError, JoinHandle, JoinSet};
| ^^ no `Id` in `task`
|
note: found an item that was configured out
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/task/mod.rs:321:40
|
321 | pub use crate::runtime::task::{Id, id, try_id};
| ^^
error[E0599]: no method named `join_next_with_id` found for struct `JoinSet` in the current scope
--> task_executor/src/lib.rs:324:44
|
324 | next_result = inner.task_set.join_next_with_id() => {
| ^^^^^^^^^^^^^^^^^
|
help: there is a method `join_next` with a similar name
|
324 | next_result = inner.task_set.join_next() => {
| ~~~~~~~~~
error[E0599]: no method named `id` found for struct `tokio::task::AbortHandle` in the current scope
--> task_executor/src/lib.rs:291:35
|
291 | inner.id_to_name.insert(h.id(), name.to_string());
| ^^ method not found in `AbortHandle`
error: unused import: `itertools::Itertools`
--> task_executor/src/lib.rs:11:5
|
11 | use itertools::Itertools;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `-D unused-imports` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_imports)]`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `task_executor` (lib) due to 4 previous errors
2. I tried to change lib.rs to fix it, then this error appeared:
error: linking with `cc` failed: exit status: 1
= note: ld: warning: directory not found for option '-L/usr/local/opt/libiconv/lib'
ld: framework not found DiskArbitration
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `sysinfo` (lib) due to 1 previous error
I tried to run pants both from my terminal and from nix-shell I have the following paths in my zshrc, but not sure they are correct
export HOMEBREW_PREFIX=$(brew --prefix)
export LIBICONV_PREFIX="$HOMEBREW_PREFIX/opt/libiconv"
export LIBRARY_PATH="$LIBICONV_PREFIX/lib:$LIBRARY_PATH"
export LDFLAGS="-L$LIBICONV_PREFIX/lib $LDFLAGS"
export CPPFLAGS="-I$LIBICONV_PREFIX/include $CPPFLAGS"
export RUSTFLAGS="-L $LIBICONV_PREFIX/lib $RUSTFLAGS"
export SDKROOT=$(xcrun --show-sdk-path)
export PATH="/opt/homebrew/opt/libiconv/bin:$PATH"
so for me, this doesn't seem to be straightforward...sorry if I missed something.
thanks!
Ah, it wasn't clear to me that you are trying to build Pants itself, rather than using a released version.
You shouldn't need nix-shell
, and in fact I have no idea if that would cause problems.
But I guess you've run this in terminal and it still fails. That rust compilation error is very suspicious. The Pants rust code should definitely compile without error...
tokio-1.32.0
seems like the correct version though.
This comment seems relevant: https://github.com/pantsbuild/pants/blob/20abefbc23811295f76de50681b3bdbada2c3982/src/rust/engine/Cargo.toml#L8
Describe the bug When using Pants with docformatter, there's a conflict between the
--check
and--in-place
options. Even though only--check
is specified in the configuration, the error message suggests that--in-place
is being added somewhere in the process. This prevents docformatter from running correctly through Pants. Specifically, when running:pants --docformatter-args="--check --diff" lint test.py
The following error is encountered:Pants version 2.2.1
OS MacOS
Additional info
pants.toml
:[docformatter] args = ["--check", "--diff"]