Unsure how to develop a package in v1.8

I am trying to create a module called BindingInference that ultimately I would like to use as a Package. I store all the files in a directory structured like

BindingInference/
    Project.toml
    license, readme, and git stuff...
    src/
        BindingInference.jl
        other files...
    tests/
        tests...
    examples/
        example usage/

I would like to be able to use BindingInference as a package as I develop and debug it. To do that I have a script I call main.jl in the same directory as BindingInference/. In main.jl I call BindingInference with

using Pkg
using Revise
Pkg.develop(path="./BindingInference/")
Pkg.instantiate()
Pkg.resolve()
using BindingInference

But I get this error:

ERROR: LoadError: ArgumentError: Package BindingInference does not have Random in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have BindingInference checked out for development and have
  added Random as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.

Im not sure why I am getting this issue, especially considering that the two suggestions it makes (“Pkg.resolve()” and “Pkg.instantiate()”) are already in my script. Aside from manually entering in the uuid for Random I am not sure how to fix this issue. I want to add that this exact same block of code worked in Julia v1.7, but gives me an error in Julia v1.8. Im not sure why this is.

Backing up, I am not sure that my workflow for developing this package is very good so I want some suggestions. If I want to make a package in Julia is this the right work flow? I just want to be able to import my module and then iterate with editing it and running my scripts without restarting the repl each time.

ERROR: LoadError: ArgumentError: Package BindingInference does not have Random in its dependencies:

It might be enough to go to the root BindingInference/ directory where the Project.toml resides,
then in the julia session hit ] to go to package mode and add Random.

This should add that entry to the Project.toml.

1 Like

This worked for Random, but one of BindingInference’s dependencies is actually another package I am creating called SimpleNamespaces. I tried to add SimpleNamespaces to BindingInference’s dependencies using

] acvtivate BindingInference/
] add Random
] add SimpleNamespaces

But I got this error:

ERROR: The following package names could not be resolved:
 * SimpleNamespaces (not found in project, manifest or registry)

Is it not good practive to develop 2 packages at once? How should I resolve this?

I’m not fluent with this, but do not see anything wrong with ]dev ../SimpleNamespaces
(provided there are no cyclic dependencies)
When things are ready, release the dependency first, ]free ../SimpleNamespaces (to remove the dev status), then release the main package ?