[Solved] Depend on local crate without publishing

Hi there, I have a crate structured like so:
image
and I have updated opengles_graphics and really don't want to re-publish the crate, I just want to include it as part of my crate, but not making it into a module. This works okay locally, but cargo package forces me to use the pre-published one, which is out of data, and I cannot depend on. Is there any way to bypass having to publish the new opengles_graphics and just use local dependencies?

I don't believe so - a crate published on crates.io can only depend on other crates also published on crates.io.

Have you considered renaming the sub-crate before publishing it with a name like optimisticpeach-opengles_graphics? It doesn't have to be advertised - you could even add a README with something like "this is intended as a dependency for xxx, not intended to be used directly". i haven't been in this particular situation, but it's how I would handle it.

2 Likes

Publishing of your crate to crates.io without the dependency it needs would publish a broken crate, so this is not allowed.

The solutions are:

  1. bug the owner of the dependency until they update it with whatever changes you need,
  2. if that doesn't work, fork the dependency, publish the fork, and depend on the fork instead.
1 Like

This isn't currently possible, but there's a postponed RFC about adding what I think you're looking for that welcomes an experimental implementation.

1 Like

Thanks for the help! I have proceeded to do what @daboross mentioned and @kornel's 2nd option, and as far as I can tell, it's working fine.