Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
copyright in docstr?
#1
is it safe and appropriate to put a copyright notice and license terms in the docstr after a line describing the basic purpose of the code?

for example...

def int_to_deciplex(value=0):
    """Convert an int value to a string in deciplex notation.

Copyright © 2021, by Phil D. Howard - all other rights reserved

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

The author may be contacted by decoding the number
11054987560151472272755686915985840251291393453694611309
(provu igi la numeron al duuma)
"""

    r = [str(value%1024)]
    for s in 'kmgtpezyxwv'
        value //= 1024
        if not value:
            break
        if value%1024:
            r[:0] = [str(value%1024)+s]
    return ''.join(r)
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
(Apr-26-2021, 10:38 PM)Skaperen Wrote: is it safe and appropriate to put a copyright notice and license terms in the docstr after a line describing the basic purpose of the code?
No,if have licensing or legal disclaimers info,it goes into a separate file at root project level.
People should be able to find LICENSE file without looking for it in source code.
LICENSE.txt, A sample Python project.
Reply
#3
The modern way (SPDX): https://reuse.software/faq/
Gribouillis likes this post
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
everything is in one file for each subproject and many have different licensing. every file gets processed as code. putting the copyright and license in the code solves many issues. i'm trying decide whether to put it in comments or string literals.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
(Apr-27-2021, 02:47 PM)DeaD_EyE Wrote: The modern way (SPDX): https://reuse.software/faq/

that abbreviation makes me think of SPQR Big Grin

SPDX looks good. this project can be published in a way that works (as far as i can see) with SPDX. but it includes a means to transfer a single (per request) source code file. maybe SPDX header is good enough in that case. but the LICENSES/ directory and anything else is not transferred in that request. what is transferred needs to have legal protection entirely within the file.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
The most interesting part of it is the reuse tool to automate the process of keeping a project up to date with respect to licensing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  f-string as a docstr Skaperen 0 1,501 Apr-25-2021, 06:35 PM
Last Post: Skaperen
  Can copyright be applied python scripts? tim777 3 4,880 Sep-04-2019, 12:20 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020