Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Change nim's nimble files to make it installable

Open yyoncho opened this issue 3 years ago • 7 comments
trafficstars

  • needs #20168 to make the stuff working

I went for this minimal solution because it seems like compiler.nimble and nimsuggest.nimble are not in use

yyoncho avatar Aug 08 '22 13:08 yyoncho

Thank you for pointing this out. I will revisit some decisions to figure out how to proceed from this point. The issue is that all nimble projects refer to nim using "nim", instead of "compiler".

On Tue, 9 Aug 2022 at 07:34, metagn @.***> wrote:

https://nimble.directory/pkg/compiler

— Reply to this email directly, view it on GitHub https://github.com/nim-lang/Nim/pull/20179#issuecomment-1208901364, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFFHFXHJF76J4WA4ZXIRR3VYHNTPANCNFSM555DSFAQ . You are receiving this because you authored the thread.Message ID: @.***>

yyoncho avatar Aug 09 '22 07:08 yyoncho

We can just set up an alias: https://github.com/nim-lang/packages#renaming-packages (so that compiler points to the new nim package).

dom96 avatar Aug 09 '22 12:08 dom96

We can just set up an alias: https://github.com/nim-lang/packages#renaming-packages (so that compiler points to the new nim package).

That is what I am working on.

yyoncho avatar Aug 09 '22 12:08 yyoncho

We can just set up an alias: https://github.com/nim-lang/packages#renaming-packages (so that compiler points to the new nim package).

That is what I am working on.

Actually, I started working on the opposite - add alias nim -> compiler. But having it the way you suggested will make the code simpler and easier to understand on nimble side.

yyoncho avatar Aug 09 '22 12:08 yyoncho

You shouldn't need any changes in Nimble for this afaik. Aliases are already supported.

dom96 avatar Aug 09 '22 12:08 dom96

You shouldn't need any changes in Nimble for this afaik. Aliases are already supported.

Yeah. But I had to redo my nimble PR if we add an alias nim -> compiler because it threats "nim" in a special way. But following your suggestion we should be good to go if renaming compiler compiler package to nim + adding alias is fine for everyone.

yyoncho avatar Aug 09 '22 12:08 yyoncho

Here is the corresponding change in packages repo: https://github.com/nim-lang/packages/pull/2317/

yyoncho avatar Aug 09 '22 13:08 yyoncho

is the "compiler" only the compiler or the compiler and the standard library? if it's the former, "compiler" should be the main package name, if it's the latter, "nim" - in the future, it's quite possible that one would want to have a "nim" package that contains the compiler and std lib as dependencies (specially if the std lib is split up into multiple nimble packages)

arnetheduck avatar Aug 11 '22 07:08 arnetheduck

@arnetheduck compiler ATM has only the sources. I am adding the binaries as well + pretty much the content of the nimlang tar delivery.

yyoncho avatar Aug 11 '22 07:08 yyoncho

Hm, that's a good point. The current "compiler" package is just the compiler sources (and nimsuggest too for some reason?)

The compiler itself also depends on the stdlib though so if we do have a separate stdlib package the compiler will also need to depend on it.

dom96 avatar Aug 11 '22 10:08 dom96

and nimsuggest too for some reason?

presumably because it lives in the same directory? I imagine that one would want a separate nimble package for every (significant) tool. This would require some reorg of the repo, because afaik, nimble requires that each "project" is in its own folder, right?

I guess this is tied to the fact that nimsuggest was developed as a when jungle rather than using a clear and well-defined compiler API - presumably, with the compiler package, one would treat the compiler as any other library, ie with a stable API etc, then nimsuggest would call that API - that would likely require some additional refactoring though, to untangle suggest and other tools from nim-the-compiler itself.

arnetheduck avatar Aug 15 '22 07:08 arnetheduck

presumably because it lives in the same directory?

It is due to this line: https://github.com/nim-lang/Nim/blob/devel/compiler.nimble#L7 There is also nimsuggest.nimble so I suspect that the idea was to have it like a subpackage.

yyoncho avatar Aug 15 '22 07:08 yyoncho

Hey @Araq , can you take a look? Based on our previous conversion I believe that you don't want to structure the repo in a way to make it "nimble compatible" so splitting nim repo into separate components (e. g. stdlib, compiler, nimsuggest, etc) is no go.

If that is the case, then it seems to me if we want to have separate nimble packages(it is not clear to me whether there is such a need) then at some point we could implement support for multiple packages in a single repo.

yyoncho avatar Aug 15 '22 08:08 yyoncho

If that is the case, then it seems to me if we want to have separate nimble packages(it is not clear to me whether there is such a need) then at some point we could implement support for multiple packages in a single repo.

We already support that. See https://github.com/nim-lang/nimble#package-urls

dom96 avatar Aug 15 '22 09:08 dom96

Thanks for your hard work on this PR! The lines below are statistics of the Nim compiler built from fb2773411eb591d652885f6fc63b2a6cf2cb01c9

Hint: mm: orc; threads: on; opt: speed; options: -d:release 163907 lines; 16.961s; 840.906MiB peakmem

github-actions[bot] avatar Aug 31 '22 19:08 github-actions[bot]

Hey @narimiran , can you backport this and https://github.com/nim-lang/Nim/pull/21314 ?

yyoncho avatar Feb 06 '23 14:02 yyoncho

Hey @narimiran , can you backport this and https://github.com/nim-lang/Nim/pull/21314 ?

Both are now backported.

narimiran avatar Feb 09 '23 04:02 narimiran

@yyoncho Hi, this PR seems to break the version-1-6 CI. Could you have a look at when you have some free time?

2023-02-09T05:09:06.4342746Z Test failed: /home/vsts/work/1/s/nimsuggest/tests/tchk1.nim
2023-02-09T05:09:06.4343275Z   Expected:
2023-02-09T05:09:06.4344500Z chk	skUnknown		Hint	???	0	-1	">> (toplevel): import(dirty): tests/tchk1.nim [Processing]"	0
2023-02-09T05:09:06.4345540Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	0	"identifier expected, but got \'keyword template\'"	0
2023-02-09T05:09:06.4346411Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	14	0	"nestable statement requires indentation"	0
2023-02-09T05:09:06.4347411Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	0	"implementation of \'foo\' expected"	0
2023-02-09T05:09:06.4348146Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	17	0	"invalid indentation"	0
2023-02-09T05:09:06.4349138Z chk	skUnknown		Hint	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	9	"\'foo\' is declared but not used [XDeclaredButNotUsed]"	0
2023-02-09T05:09:06.4350217Z chk	skUnknown		Hint	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	14	5	"\'main\' is declared but not used [XDeclaredButNotUsed]"	0
2023-02-09T05:09:06.4350707Z 
2023-02-09T05:09:06.4351112Z   But got:
2023-02-09T05:09:06.4351903Z chk	skUnknown		Hint	???	0	-1	">> (toplevel): import(dirty): nimsuggest/tests/tchk1.nim [Processing]"	0
2023-02-09T05:09:06.4352918Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	0	"identifier expected, but got \'keyword template\'"	0
2023-02-09T05:09:06.4353723Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	14	0	"nestable statement requires indentation"	0
2023-02-09T05:09:06.4354699Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	0	"implementation of \'foo\' expected"	0
2023-02-09T05:09:06.4355425Z chk	skUnknown		Error	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	17	0	"invalid indentation"	0
2023-02-09T05:09:06.4356707Z chk	skUnknown		Hint	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	12	9	"\'foo\' is declared but not used [XDeclaredButNotUsed]"	0
2023-02-09T05:09:06.4357775Z chk	skUnknown		Hint	/home/vsts/work/1/s/nimsuggest/tests/tchk1.nim	14	5	"\'main\' is declared but not used [XDeclaredButNotUsed]"	0

ref https://dev.azure.com/nim-lang/Nim/_build/results?buildId=25957&view=logs&jobId=c6054849-8341-5e23-b888-79fd7ec95d3a&j=ba7bbfa4-f55c-5c34-6d52-1b6b4edd3f37&t=01b6eca1-ed82-5532-a6ed-8d9a0cd0188a

ringabout avatar Mar 01 '23 15:03 ringabout

@ringabout I am back from a vacation, I will take a look if it is still relevant.

yyoncho avatar Mar 07 '23 10:03 yyoncho

Nope, it has been fixed.

ringabout avatar Mar 07 '23 12:03 ringabout