Skip to content

commiterate/test-nbb-ns

Repository files navigation

test-nbb-ns

Testing nbb with different namespace names.

Namespace symbols with * don't seem to work.

$ bb repl-clj
Clojure 1.12.0

user=> (require '[test-nbb-ns.test-cljc :as test-cljc])
nil

user=> (test-cljc/hello)
"Hello from test-nbb-ns.test-cljc!"
nil

user=> (require '[test-nbb-ns.*test-cljc* :as *test-cljc*])
nil

user=> (*test-cljc*/hello)
"Hello from test-nbb-ns.*test-cljc*!"
nil
$ bb repl-cljs
Welcome to nbb v1.3.196!

user=> (require '[test-nbb-ns.test-cljc :as test-cljc])
nil

user=> (test-cljc/hello)
"Hello from test-nbb-ns.test-cljc!"
nil

user=> (require '[test-nbb-ns.*test-cljc* :as *test-cljc*])
"Error: Could not find namespace: test-nbb-ns.*test-cljc*"

user=> (require '[test-nbb-ns.test-cljs :as test-cljs])
nil

user=> (test-cljs/hello)
"Hello from test-nbb-ns.test-cljs!"
nil

user=> (require '[test-nbb-ns.*test-cljs* :as *test-cljs*])
"Error: Could not find namespace: test-nbb-ns.*test-cljs*"

This is using :local/root "." in nbb.edn to defer to deps.edn.

The generated .nbb has files for all the namespaces.

.nbb
└── .cache
    └── 234d643b78573b567a783af269377ad0cd729227
        ├── deps.edn
        ├── nbb-deps
        │   ├── META-INF
        │   │   └── MANIFEST.MF
        │   └── test_nbb_ns
        │       ├── *test_cljc*.cljc
        │       ├── *test_cljs*.cljs
        │       ├── test_cljc.cljc
        │       └── test_cljs.cljs
        └── nbb-deps.jar

Tools

Nix

Nix is a package manager and build system centered around reproducibility.

For us, Nix's most useful feature is its ability to create reproducible + isolated CLI shells on the same machine which use different versions of the same package (e.g. Java 17 and 21). Shell configurations can be encapsulated in Nix configurations which can be shared across multiple computers.

The best way to install Nix is with the Determinate Nix Installer (guide).

Once installed, running nix develop in a directory with a flake.nix will create a nested Bash shell defined by the flake.

direnv

direnv (🍺) is a shell extension which can automatically load and unload environment variables when you enter or leave a specific directory.

It can automatically load and unload a Nix environment when we enter and leave a project directory.

Unlike nix develop which drops you in a nested Bash shell, direnv extracts the environment variables from the nested Bash shell into your current shell (e.g. Bash, Zsh, Fish).

Follow the installation instructions on its website.

It also has editor integration. Note that some integrations won't automatically reload the environment after Nix flake changes unlike direnv itself so manual reloads may be needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published