You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a project should only run nimble commands, and never nim commands?
project must manually add some paths in a project config file?
The same error also breaks e.g. nimble test, if you redefine the test task for performance like:
task test, "Run all the tests":
exec"nim r tests/all_tests.nim"
NIMBLE_DIR is not set.
Nim version
Nim Compiler Version 2.0.0 [Linux: amd64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: a488067a4130f029000be4550a0fb1b39e0e9e7c
active boot switches: -d:release
Long example
nimble lock produces an error if the project is not under version control. So please excuse the boilerplate below - I've tried to make a clear, robust reproduction.
#!/usr/bin/env bashset -ex
# Create nimble projectcd /tmp
rm -rf /tmp/foo
mkdir -p foo
cd foo
nimble --silent -y init
git init
# Make `git commit` work even if there's no global git user.name or user.email
git config user.name "Foo"# Does not alter global settings
git config user.email "[email protected]"# Does not alter global settings
git add .
git commit --quiet -m 'initial commit'# Add jsony dependency
rm src/foo.nim
echo'import jsony'> src/foo.nim
nimble install jsony
nim c src/foo.nim # Success, before running `nimble lock`echo'requires "jsony"'>> foo.nimble
nimble path jsony # Prints the absolute path of the installed jsony# Add lock file
nimble lock
git add .
git commit --quiet -m 'another commit'# Show that committing the lock file doesn't prevent the error
nim c src/foo.nim # Error
So we have the foo.nimble file:
# Package
version ="0.1.0"
author ="Anonymous"
description ="A new awesome nimble package"
license ="MIT"
srcDir ="src"# Dependenciesrequires"nim >= 2.0.0"requires"jsony"
in general, locking means that you want some particular dependencies and only those dependencies - otherwise, random stuff from random nimble PATH:s can interfere with import.
Short example
Current output
Expected output
No error. I thought that Nim would just ensure that it uses the package versions from the
nimble.lock
file.Discussion
Is this intended? I am aware of 7c6dcfd and nim-lang/nimble#1004.
Is the intention that after running
nimble lock
:nimble
commands, and nevernim
commands?The same error also breaks e.g.
nimble test
, if you redefine thetest
task for performance like:NIMBLE_DIR
is not set.Nim version
Long example
nimble lock
produces an error if the project is not under version control. So please excuse the boilerplate below - I've tried to make a clear, robust reproduction.So we have the
foo.nimble
file:and the
nimble.lock
file:Current output
Expected output
No error at the end.
The text was updated successfully, but these errors were encountered: