Zulip Chat Archive

Stream: lean4

Topic: docgen4 not working?


Joseph O (Feb 19 2022 at 16:10):

I tried using docgen4 on my project with \my\path\to\docgen-4 / Itertools. But this is what i get when I run the server:
image.png image.png
I tried again by specifying the directory (Itertools) where all my documentated functions are: \my\path\to\docgen-4 /Itertools Itertools, but i get the same thing

Joseph O (Feb 19 2022 at 16:10):

By the way, here was my build output:

PS C:\Users\[REDACTED]\Desktop\programming\Itertools> C:\clones\doc-gen4\build\bin\doc-gen4.exe /Itertools.lean Itertools
Loading modules from: [c:\users\vatis\desktop\programming\itertools\build\lib]
Processing modules
WARNING: Failed to calculate equational lemmata for Lean.expandExplicitBindersAux.loop: tactic 'simp' failed, nested error:
(deterministic) timeout at 'simp', maximum number of heartbeats (5000) has been reached (use 'set_option maxHeartbeats <num>' to set the limit)
Outputting HTML
uncaught exception: invalid argument (error code: 22, invalid argument)
  file: ./build/doc/\find\Lean.SourceInfo.getPos?

Xubai Wang (Feb 19 2022 at 16:17):

Does \path\to\docgen-4 /Itertools/ Itertoolswork? (notice the trailing slash)

Xubai Wang (Feb 19 2022 at 16:18):

Are there html pages in your build/doc directory?

Joseph O (Feb 19 2022 at 16:23):

Xubai Wang said:

Are there html pages in your build/doc directory?

yes

Joseph O (Feb 19 2022 at 16:26):

Xubai Wang said:

Does \path\to\docgen-4 /Itertools/ Itertoolswork? (notice the trailing slash)

its the same thing

Henrik Böving (Feb 19 2022 at 16:27):

Is your project somewhere so we can try this ourselves?

Joseph O (Feb 19 2022 at 16:28):

Henrik Böving said:

Is your project somewhere so we can try this ourselves?

https://github.com/crabbo-rave/lean4-Itertools

Henrik Böving (Feb 19 2022 at 16:30):

Building with doc-gen4 / Itertools then cd-ing into build/doc and running a python test server with python -m http.server works for me. are you sure you are building and hosting this in the right way?

Joseph O (Feb 19 2022 at 16:33):

I did git pull
Im going to try again

Xubai Wang (Feb 19 2022 at 16:34):

May be a clearer approach:
Run doc-gen4 /build/doc/ Itertools and python3 -m http.server, just in your project root without changing directory. and then visit http://localhost:8000/build/doc/ in your browser.

Joseph O (Feb 19 2022 at 16:35):

Thanks I will try it out

Joseph O (Feb 19 2022 at 16:40):

I get an error

PS C:\Users\rrrrr\Desktop\programming\Itertools> C:\clones\doc-gen4\build\bin\doc-gen4.exe  /build/doc/ Itertool
Loading modules from: [c:\users\vatis\desktop\programming\itertools\build\lib]
uncaught exception: unknown package 'Itertool'

Henrik Böving (Feb 19 2022 at 16:41):

well yes your package is called Itertools

Joseph O (Feb 19 2022 at 16:41):

Yes

Henrik Böving (Feb 19 2022 at 16:43):

So you should give doc-gen that name and not the singular form

Joseph O (Feb 19 2022 at 16:43):

Sorry if im being a bit annoying, but isnt that what I did?

Henrik Böving (Feb 19 2022 at 16:45):

You wrote Itertool not Itertools.

Joseph O (Feb 19 2022 at 16:46):

ah i see lol

Joseph O (Feb 19 2022 at 16:48):

image.png

Xubai Wang (Feb 19 2022 at 16:53):

Can you provide a screen capture (or ls) of your build/doc dir?

Joseph O (Feb 19 2022 at 16:55):

Xubai Wang said:

Can you provide a screen capture (or ls) of your build/doc dir?

(much longer)
image.png

Xubai Wang (Feb 19 2022 at 16:59):

Emmm, so the problem is here: there are only find folder in your build/doc, but a normal one should be like this:

screenshot

Which commit of doc-gen4 do you use?

Joseph O (Feb 19 2022 at 16:59):

I just cloned the one from github, and recently did git pull

Xubai Wang (Feb 19 2022 at 17:00):

Then try lake clean and doc-gen it again?

Joseph O (Feb 19 2022 at 17:03):

i have done that a thousand times already. everytime i build the doc

Xubai Wang (Feb 19 2022 at 17:03):

Joseph O said:

By the way, here was my build output:

PS C:\Users\[REDACTED]\Desktop\programming\Itertools> C:\clones\doc-gen4\build\bin\doc-gen4.exe /Itertools.lean Itertools
Loading modules from: [c:\users\vatis\desktop\programming\itertools\build\lib]
Processing modules
WARNING: Failed to calculate equational lemmata for Lean.expandExplicitBindersAux.loop: tactic 'simp' failed, nested error:
(deterministic) timeout at 'simp', maximum number of heartbeats (5000) has been reached (use 'set_option maxHeartbeats <num>' to set the limit)
Outputting HTML
uncaught exception: invalid argument (error code: 22, invalid argument)
  file: ./build/doc/\find\Lean.SourceInfo.getPos?

At first there is an uncaught exception. Probably it stops doc-gen from generating other parts of the doc. Does this error appears again and again? (Just ignore the heartbeat warning, that's problem from Lean itself)

Joseph O (Feb 19 2022 at 17:04):

yes

Henrik Böving (Feb 19 2022 at 17:05):

That's either an issue with the harcoded build/doc base path or with the fact that windows file system might not like a ? in its file names, can you create a directory with a ? in its name under Windows?

Mauricio Collares (Feb 19 2022 at 17:11):

Also, does your user name contain spaces?

Henrik Böving (Feb 19 2022 at 17:12):

It doesnt, we can see it in the doc-gen log which he forgot to redact.

Mauricio Collares (Feb 19 2022 at 17:14):

Looks like you're right, Windows does not support question marks in file names

Xubai Wang (Feb 19 2022 at 17:14):

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Yes, that would unfortunately be a problem for find.

Xubai Wang (Feb 19 2022 at 17:16):

How much do we rely on a file based find?

Henrik Böving (Feb 19 2022 at 17:16):

docs4#Nat is completely based on it.

Henrik Böving (Feb 19 2022 at 17:16):

(referring to the linking Zulip feature here).

Xubai Wang (Feb 19 2022 at 17:19):

Maybe we can link to a single /find.html page and rely on JavaScript to figure out the right place?

Henrik Böving (Feb 19 2022 at 17:20):

I was about to write that yes^^

Henrik Böving (Feb 19 2022 at 17:20):

Although I'm completely unfamiliar with frontend development so someone else would have to do that

Henrik Böving (Feb 19 2022 at 17:23):

Oh and there is also an open issue for the src# variant here https://github.com/leanprover/doc-gen4/issues/30 which would have to be addressed the same way then.

Xubai Wang (Feb 19 2022 at 17:32):

@Joseph O For temporal workaround, you can remove these lines in DocGen4/Output.lean and rebuild doc-gen to disable the find feature and that will work for your platform.

DocGen4/Output.lean

EDITED: also remove the "searchable_data.bmp" line.

Henrik Böving (Feb 19 2022 at 17:35):

That's not gonna compile the next line uses the json variable still.

Henrik Böving (Feb 19 2022 at 17:36):

But if you comment that one out too it will

Joseph O (Feb 19 2022 at 19:00):

let me try rebuilding docgen4

Joseph O (Feb 19 2022 at 19:01):

first. That could fix it

Joseph O (Feb 19 2022 at 19:16):

Xubai Wang said:

Joseph O For temporal workaround, you can remove these lines in DocGen4/Output.lean and rebuild doc-gen to disable the find feature and that will work for your platform.

DocGen4/Output.lean

EDITED: also remove the "searchable_data.bmp" line.

When i do that it wont build

Joseph O (Feb 19 2022 at 19:19):

I recloned it from github and that version is not building. Should I report this as an issue?

Henrik Böving (Feb 19 2022 at 19:20):

The version very much is building according to both my machine and the CLI, what's your error with a new cloned one?

Joseph O (Feb 19 2022 at 19:29):

Well it worked right now. Let me try generating documentation

Joseph O (Feb 19 2022 at 19:31):

What does this mean?

uncaught exception: invalid argument (error code: 22, invalid argument)
  file: .\build\doc\find\Lean.SourceInfo.getPos?

i always get it

Joseph O (Feb 19 2022 at 19:32):

Why is it working on you machine and not mine? Are you using windows?

Henrik Böving (Feb 19 2022 at 19:33):

No, I'm on Fedora, Xubai is on MacOS (at least his screenshots look like that) and all the CLI and automation runs some Linux flavour as well. I neither have a Windows machine nor has someone with a Windows machine yet tried to run doc-gen4 so this is why it wasnt discovered before.

Joseph O (Feb 19 2022 at 19:34):

No one has tried docgen4 on windows yet? This could be the problem

Joseph O (Feb 19 2022 at 19:35):

Any ideas why it doesnt work on Windows?

Henrik Böving (Feb 19 2022 at 19:35):

Why it doesn't work was already elaborated in detail above.

Henrik Böving (Feb 19 2022 at 19:36):

However it should work if you comment out the lines in the screenshot above as well as the next one that uses the json variable because then these directories are not created anymore.

Joseph O (Feb 19 2022 at 19:36):

Henrik Böving said:

That's either an issue with the harcoded build/doc base path or with the fact that windows file system might not like a ? in its file names, can you create a directory with a ? in its name under Windows?

I can try

Henrik Böving (Feb 19 2022 at 19:37):

Read the discussion fully we know that a ? is illegal already by now.

Joseph O (Feb 19 2022 at 19:37):

yeah Windows doesn't allow it

Joseph O (Feb 19 2022 at 19:38):

I can try what this message says again

Joseph O (Feb 19 2022 at 19:40):

It worked! :+1:

Joseph O (Feb 19 2022 at 19:41):

Are the docstrings supposed to show up somewhere?

Henrik Böving (Feb 19 2022 at 19:42):

Not yet

Xubai Wang (Feb 19 2022 at 19:45):

@Henrik Böving docstring now works perfectly on mathlib4 when i test it locally but when I merge it into main, there are PANIC at Std.HashMap.find! Std.Data.HashMap:177:14: key is not in the map errors.

Henrik Böving (Feb 19 2022 at 19:47):

Aha....it's a little bit annoying panics don't have a backtrace, you could try to git bisect the issue.

Henrik Böving (Feb 19 2022 at 19:49):

I can't reproduce it with the current doc-gen main so it's probably some interaction between a change on main and a change of yours.

Joseph O (Feb 19 2022 at 20:13):

Im aware that right now the lean 4 devs are worried about other things at the moment, but will there be a centralized website for lake packages like crates.io, or is it still not known yet?

Henrik Böving (Feb 19 2022 at 20:22):

Not known.

Xubai Wang (Feb 19 2022 at 20:22):

I can help write a simple unofficial one based on the GitHub search https://github.com/search?q=lakefile.lean+in%3Apath&type=Code, much like that of lib.rs.

Joseph O (Feb 19 2022 at 20:23):

Xubai Wang said:

I can help write a simple unofficial one based on the GitHub search https://github.com/search?q=lakefile.lean+in%3Apath&type=Code.

Wow 625k

Henrik Böving (Feb 19 2022 at 20:23):

Lots of those are false positives by the relatively liberal github search

Joseph O (Feb 19 2022 at 20:23):

If you do end up writing one I would love to help

Henrik Böving (Feb 19 2022 at 20:23):

I would estimate the amount of Lean 4 projects out there is at most in the 100s at the moment.

Joseph O (Feb 19 2022 at 20:25):

Yeah towards the end it is not counting lakefile.lean anymore: image.png


Last updated: Dec 20 2023 at 11:08 UTC