Zulip Chat Archive
Stream: new members
Topic: Search path for packages?
Martin C. Martin (Oct 26 2023 at 19:30):
In my project, I have a src
directory, then a mypackage
directory, which has two files A.lean
and B.lean
. However, at the start of B.lean
, when I try import mypackage.A
, I get the error unknown package 'mypackage'
.
Is there documentation somewhere of how to add the src
directory to the search path? I would have thought it was added by default. Thanks.
Yaël Dillies (Oct 26 2023 at 19:40):
See the readme of the lake repo.
Shreyas Srinivas (Oct 26 2023 at 19:49):
You are missing a mypackage.lean
file which is at the same level as the mypackage
folder in the directory hierarchy
Shreyas Srinivas (Oct 26 2023 at 19:52):
You will also need an src.lean
file at the same level of src
.
Martin C. Martin (Oct 26 2023 at 20:22):
Is the canonical setup not to have a src
directory, and just put the mypackage
directory in the root, next to lakefile.lean
, lean-toolchain
, etc?
Shreyas Srinivas (Oct 26 2023 at 20:30):
Yes
Shreyas Srinivas (Oct 26 2023 at 20:31):
The build folder is already separate
Shreyas Srinivas (Oct 26 2023 at 20:32):
See the standard template that lake generates for you when you use lake new
Shreyas Srinivas (Oct 26 2023 at 20:34):
You will find a <project_name>.lean file and a <project_name>/Basic.lean file
Shreyas Srinivas (Oct 26 2023 at 20:35):
(deleted)
Shreyas Srinivas (Oct 26 2023 at 20:35):
(deleted)
Shreyas Srinivas (Oct 26 2023 at 20:35):
If you want a separate test directory, you can add a Tests.lean file and a corresponding Tests/ folder
Shreyas Srinivas (Oct 26 2023 at 20:36):
(deleted)
Last updated: Dec 20 2023 at 11:08 UTC