Zulip Chat Archive

Stream: general

Topic: leanproject pull


Johan Commelin (Apr 08 2021 at 07:52):

Should there be a leanproject pull that does git pull and leanproject get-mathlib-cache?
I see people getting confused by changed tomls and lots of breaking code because they use leanproject up.

Yakov Pechersky (Apr 08 2021 at 07:55):

What happens if it pulls, but the oleans haven't been uploaded yet?

Johan Commelin (Apr 08 2021 at 07:59):

I think that's unlikely to happen. If people only use leanproject up to bump mathlib, and then push. Then others can lp pull to see the results.

Eric Wieser (Apr 08 2021 at 08:02):

Isn't this what the git hooks that leanproject provides were meant to be for?

Eric Wieser (Apr 08 2021 at 08:02):

So that git pull gets the cache

Eric Wieser (Apr 08 2021 at 08:03):

But also so does git checkout some_old_branch_with_an_older_mathlib

Kevin Buzzard (Apr 08 2021 at 08:26):

I never use leanproject up because I don't really understand what it does. For the liquid project I always do git pull, leanproject get-m, leanproject build.

Johan Commelin (Apr 08 2021 at 08:28):

Eric Wieser said:

Isn't this what the git hooks that leanproject provides were meant to be for?

Probably, but maybe lp pull could still do the same thing?

Patrick Massot (Sep 18 2021 at 12:01):

I just added a pull command to leanproject because the combination git pull && leanproject get-mathlib-cache (orgit pull && leanproject get-cache when working on mathlib) is so common and requires some additional care when upstream bumps mathlib. Please upgrade your leanproject using pip install -U mathlibtools and report any issue.

Johan Commelin (Sep 18 2021 at 18:09):

I just tried this on LTE, and it seems to work flawlessly

$ lp pull
Pulling from origin
Looking for lean-liquid oleans for a80e1d714
  locally...
  Found local lean-liquid oleans
Located matching cache
Applying cache
  files extracted: 1721 [00:07, 244.17/s]

Filippo A. E. Nuccio (Sep 20 2021 at 07:19):

Works perfectly for me as well.

Johan Commelin (Sep 20 2021 at 11:43):

Hmm, I'm having trouble with this in LTE:

lean-liquid$ leanproject get-mathlib-cache
SHA b'fbc9e5e306b8cd0a8ecccdb759ca09f16c44af86' could not be resolved, git returned: b'fbc9e5e306b8cd0a8ecccdb759ca09f16c44af86 missing'

Eric Wieser (Sep 20 2021 at 11:45):

Hmm, I think there's a missing git fetch that I might have removed by accident

Eric Wieser (Sep 20 2021 at 11:46):

Probably because I thought it made no sense for get-cache. Clearly it makes sense for get-mathlib-cache

Eric Wieser (Sep 20 2021 at 11:50):

Can you run with --debug to get the full traceback?

Johan Commelin (Sep 20 2021 at 11:53):

@Eric Wieser sorry, I already did a cd _target/deps/mathlib and leanproject get-cache. Now the problem is no longer reproducible.

Johan Commelin (Sep 20 2021 at 11:53):

Probably after another mathlib bump I can post the debug trace.

Johan Commelin (Sep 25 2021 at 14:39):

@Eric Wieser This is not the output I am looking for, right?

lp get-mathlib-cache
Looking for lean-liquid oleans for 6ea816834
  locally...
  Found local lean-liquid oleans
Located matching cache
Applying cache
  files extracted: 1752 [00:07, 235.14/s]

I think it did what I intended: extracting 1752 files looks like it was working with mathlib oleans. But the output is talking about lean-liquid oleans. Is that a bug?

Eric Wieser (Sep 25 2021 at 15:02):

Oh whoops, that's a bug for sure!

Eric Wieser (Sep 25 2021 at 15:02):

I guess the project name is populated wrongly in get-mathlib-cache

Eric Wieser (Sep 25 2021 at 15:04):

https://github.com/leanprover-community/mathlib-tools/blob/89426c098138f2c1270f05eca59360354863fd25/mathlibtools/lib.py#L583 is the wrong line

Eric Wieser (Sep 25 2021 at 15:05):

self.name should be "mathlib"

Floris van Doorn (Oct 11 2021 at 12:37):

I just had the same error (ping)

Eric Wieser (Oct 11 2021 at 12:45):

https://github.com/leanprover-community/mathlib-tools/pull/119 fixes the bug in the message

Eric Wieser (Oct 11 2021 at 12:49):

CI fails on that PR, but it fails on master too (due to updates to mypy)

Patrick Massot (Oct 11 2021 at 19:51):

@Eric Wieser Do you know what changed in mypy?

Eric Wieser (Oct 11 2021 at 19:52):

No idea, it looks like it was already broken in the last commit you pushed. Presumably it just got cleverer and looks for things it didn't look for before

Patrick Massot (Oct 11 2021 at 19:52):

Too bad, it sounded like you had something precise in mind

Patrick Massot (Oct 11 2021 at 19:52):

I'll investigate

Eric Wieser (Oct 11 2021 at 19:53):

I had a quick look; maybe it's an upstream bug in GitPython?

Eric Wieser (Oct 11 2021 at 19:53):

https://github.com/gitpython-developers/GitPython/issues/1095

Eric Wieser (Oct 11 2021 at 19:53):

Previously it had no type information, now it seems to have incomplete ones

Eric Wieser (Oct 11 2021 at 19:55):

A better issue link is https://github.com/gitpython-developers/GitPython/issues/1349

Eric Wieser (Oct 11 2021 at 19:55):

At any rate, the fix is probably just to tell mypy to be quiet somehow

Eric Wieser (Oct 11 2021 at 19:59):

From the error log:

mathlibtools/git_helpers.py:5: error: Name "git.Commit" is not defined
mathlibtools/git_helpers.py:10: error: Name "git.Commit" is not defined
mathlibtools/git_helpers.py:58: error: Name "git.Commit" is not defined
mathlibtools/git_helpers.py:63: error: Module has no attribute "Commit"
mathlibtools/lib.py:429: error: Incompatible types in assignment (expression has type "None", variable has type "Repo")
mathlibtools/lib.py:673: error: Argument 1 to "Path" has incompatible type "Union[str, PathLike[Any], None]"; expected "Union[str, PathLike[str]]"
mathlibtools/lib.py:954: error: Unsupported right operand type for in ("Callable[[], IterableList[Head]]")

The first four and the last one are probably a bug in the upstream mypy stubs, the 5th is mypy being annoying because it now knows how to ask what type something is and can't deduce Optional[T] from if x then: y = z else y = None, the 6th looks like a mixture of an actual possible crash in a corner case we don't care about and some str/bytes stupidity, and the last one also looks like a bug

Patrick Massot (Oct 11 2021 at 20:16):

I can confirm I locally managed to go from zero error to errors with updating GitPython (without updating mypy)

Eric Wieser (Oct 11 2021 at 20:19):

Maybe we just pin gitpython for now?

Patrick Massot (Oct 11 2021 at 20:21):

No, I think I can fix things anyway.

Patrick Massot (Oct 11 2021 at 20:28):

There was one remaining weird failure, I gave up on that one.


Last updated: Dec 20 2023 at 11:08 UTC