Remove a package from dependencies

I made a package that has Mamba in its dependencies and now i want to delete it, because whenever i use this package it shows me warnings about Mamba but the thing is that i don’t really know how can i remove Mamba from the dependencies of my package

Activate your package and use the rm command in Pkg ] mode to remove the dependency.

3 Likes

i didn’t understand when you said activate my package!!

First, you should remove the using Mamba from your code files. When someone loads your package, they will not load Mamba from their environment if they do not come across the using Mamba statement.

Second, your package may come with its own Project.toml/Manifest.toml flies that define an environment. So the structure of your package should look like

.
..
MyPackage.jl
Project.toml
Manifest.toml

where the Project.toml file has an entry defining your mamba dependency. So cd into your folder, launch Julia, and type in ] activate . meaning activate the environment defined by the Project/Manifest files in the current folder. You should see the prompt change from (@v1.4) pkg> to (MyPackage) pkg>. Once your environment is activated, type in rm Mamba to remove the package.

The whole environments concept is very confusing and I still have a hard time figuring it out.

5 Likes

if i’m putting the package in Github couldn’t i just remove using Mamba from the code and remove the entry defining the mamba dependenciy and update the package directly? i guess it should work too.

Yeah, you could manually remove the dependency from Project.toml file, after all it’s a simple text file. But I don’t think thats a good idea. The Manifest.toml file includes entries that Mamba depends on too, so its better to let the package manager do its thing to get clean files without dangling dependencies.

4 Likes

Yes, you are right but in case f i’m using another machine where i don’t have the code but i can only find it in Github, the way i said in the previous comment it is the only way i guess. Because this package that i made after all it is a standard registered package that you can find in Github anyways.

If the package is on GitHub you can dev it from there, then do your changes to the environment using Pkg, and push those changes back up to GitHub. Manually tinkering with the Manifest.toml is not recommended as per the Pkg docs.

3 Likes