Publishing code without a license

In npm, you can set the license field to "UNLICENSED" if you haven't decided on a license yet, or if you're posting code you don't want people to use, &c.

What is the equivalent for Cargo.toml?

I don't know, but you shouldn't publish it to crates.io if you don't want others to use it.

9 Likes

If you don't want to provide license you can skip the field entirely. Note that to publish on crates.io it's necessary to either provide a license or a license-file.

I think choosing the term "UNLICENSED" was a bad decision as it can easily be confused with the Unlicense which has mostly opposite meaning.

Similar to the more recommended way by npm as the page mentioned, cargo also supports publish = false field.

https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field

5 Likes

That is the problem. I want to publish, but without granting a license. This is art, not technology. It's along the same lines as totally-safe-transmute. :slight_smile:

I agree that UNLICENSED is not the best keyword. But at least it exists.

Things like totally-safe-transmute should definitely not be without a license.

What exactly do you mean by publish but not granting a license? If you really do not want someone else to use your code, surely there is a license out there that forbids using code under that license without consent of the license owner?

No license means no one has the right to do anything with it, even copy the code; which means even downloading it to look at it...ergo it is an abuse of the crates.io platform to do that, IMHO. Don't do that.

Publish it somewhere else and make it clear no one can use it for any purpose.

...or, give it a decent open source license and contribute something meaningful to the ecosystem.

13 Likes

Why not? IANAL, but in the US at least, code is copyrighted by default and nobody can do anything with it, except look at it if it was published by the copyright holder. Adding a license only grants additional rights, so it can only make things worse.

There definitely is, but that license isn't on the SPDX list of free and open-source licenses that cargo limits you to.

I admit that's a fair take. I think I'll just not publish.

2 Likes

Nobody should ever look at code which doesn't offer a license that would let them use it. You can get sued for copyright infringement even without proof of copying if there's similarity and you accessed it.

So ideally crates.io would hide all crates with unknown licenses by default.

4 Likes

Creative Commons licenses are adapted for art. Using CC BY-NC-ND (non commercial, no derivative) would almost do the same as no license AFAIK, except it solves the access/share problem. But please consider free licenses such as CC BY-SA.

4 Likes

Oh, i didn't know cargo limits the crates to open source licences. Makes sense I guess from the view of a dependency management/package repository.

I can think of at least one situation where this would make sense: being hired to do some review. But then again the code would not need to be published on a public package repository to achieve that.

I would regard using crates.io as communication between partners of a business relationship as unethical. It's hacking a service that is provided for free for other purposes.

If one does not want share then do not publish on a platform designed for sharing.

6 Likes

That limits the license field, not license-file (also similar to NPM).

2 Likes

Is the XY problem you want to setup your own private crates.io to host crates meant to be shared among a private group of collaborators ?

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.