473,414 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Python programs always open source?

Hi,

I was wondering if Python programs always need to include the source code
with the program itself. I'm asking this because I don't want my program to
be open-source and so far all the Python programs I've seen included the
source code.

Is it possible to make an executable with only bytecode?

Thanks in advance!

GF

--
Posted via a free Usenet account from http://www.teranews.com

Sep 17 '06 #1
20 2241
Guy Fawkes wrote:
I was wondering if Python programs always need to include the source code
with the program itself. I'm asking this because I don't want my program to
be open-source and so far all the Python programs I've seen included the
source code.
You can include the source code but still not be open source; it's not
unusual for python programs to have licenses prohibiting the
modification or redistribution of the source code.
Is it possible to make an executable with only bytecode?
You can import and use the .pyc files with a few caveats. They're
pretty trivial to disassemble though, so it's rarely worth it; just
make clear what's allowed (and what's not allowed) in your license.

Sep 17 '06 #2
"Guy Fawkes" <sp***********@spoilthechild.comwrites:
I was wondering if Python programs always need to include the source
code with the program itself. I'm asking this because I don't want
my program to be open-source and so far all the Python programs I've
seen included the source code.
You can license your own work to anyone you like, under any terms you
choose. The source code to a work is necessary for users to exercise a
free software license, but that doesn't mean that distributing source
code necessarily grants a free software license.

You're right that there is a great amount of Python code available
under free software licenses. No-one can force you to join us, but
you're welcome to.

--
\ "My girlfriend has a queen sized bed; I have a court jester |
`\ sized bed. It's red and green and has bells on it, and the ends |
_o__) curl up." -- Steven Wright |
Ben Finney

Sep 17 '06 #3
Jay
Speaking of the bytecode, how does one create it?
Ben Finney wrote:
"Guy Fawkes" <sp***********@spoilthechild.comwrites:
I was wondering if Python programs always need to include the source
code with the program itself. I'm asking this because I don't want
my program to be open-source and so far all the Python programs I've
seen included the source code.

You can license your own work to anyone you like, under any terms you
choose. The source code to a work is necessary for users to exercise a
free software license, but that doesn't mean that distributing source
code necessarily grants a free software license.

You're right that there is a great amount of Python code available
under free software licenses. No-one can force you to join us, but
you're welcome to.

--
\ "My girlfriend has a queen sized bed; I have a court jester |
`\ sized bed. It's red and green and has bells on it, and the ends |
_o__) curl up." -- Steven Wright |
Ben Finney
Sep 17 '06 #4
"Jay" <ja*******@gmail.comwrote:
Speaking of the bytecode, how does one create it?
http://effbot.org/zone/python-compil...python-modules

</F>

Sep 17 '06 #5
Guy Fawkes schrieb:
Is it possible to make an executable?
Hi GF!

http://www.python.net/crew/atuining/cx_Freeze/

Regards,
Gerold
:-)

--
__________________________________________________ ______________________
Gerold Penz - bcom - Programmierung
ge*********@tirol.utanet.at | http://gerold.bcom.at | http://sw3.at
Ehrliche, herzliche Begeisterung ist einer der
wirksamsten Erfolgsfaktoren. Dale Carnegie
Sep 18 '06 #6
Guy Fawkes schrieb:
I don't want my program to
be open-source and so far all the Python programs I've seen included the
source code.
That's one of the great freedoms of Python and its licence: You are
free to chose the licence for your product. No GPLish "you must be as
free as we", more BSDish: "Do what you want, do not come crying"
Is it possible to make an executable with only bytecode?
I use py2exe with its "new" (~1 year) single file feature with great
success. I even succeeded in including a virtual static directory for a
webserver within that file.

To be exact, it is not really 1 file, but 2, as you often have to
distribute msvcr71.dll with it - except for those computers having
i.e. MS Office 11 installed, there it is allready present.

Combining py2exe's single file distributable and upx compression I
achieve fairly compact "just drop and use" applications without a real
need for installation. I do not care about people decompiling
(customers get the source code on request, if they are interested).
It would be possible - but those who have the time and knowledge to
dissect and decompile those upxed py2exed files and still make a profit
would probably not see a reason to buy my software anyway :)

Harald

Sep 18 '06 #7
"GHUM" <ha**************@gmail.comwrites:
That's one of the great freedoms of Python and its licence: You are
free to chose the licence for your product. No GPLish "you must be
as free as we", more BSDish: "Do what you want, do not come crying"
This has nothing to do with the license of Python. Whether Python was
distributed under the GPL, BSD or Jack's Own Oddball License, the
copyright holder of Python has no say over what license you choose for
your own work.

So long as you're not distributing some or all of Python itself, or a
derivative work, the license for Python has no legal effect on what
license you choose for your own work.

--
\ "He that would make his own liberty secure must guard even his |
`\ enemy from oppression." -- Thomas Paine |
_o__) |
Ben Finney

Sep 18 '06 #8
Ben Finney wrote:
So long as you're not distributing some or all of Python itself, or a
derivative work, the license for Python has no legal effect on what
license you choose for your own work.
How many Python programs use nothing from the standard library?
Sep 18 '06 #9
Leif K-Brooks wrote:
Ben Finney wrote:
>>So long as you're not distributing some or all of Python itself, or a
derivative work, the license for Python has no legal effect on what
license you choose for your own work.


How many Python programs use nothing from the standard library?
That doesn't matter either. The required copyright statements are
included in the Python interpreter. There is no reason to fear
distributing Python as a part of either open source or proprietary
works, and Guido framed the original license to allow precisely such
uses. Later versions have retained the same spirit.

The official license doesn't take a lot of understanding or legalese.
Try it:

http://www.python.org/download/releases/2.4.2/license/

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 18 '06 #10
Steve Holden wrote:
Leif K-Brooks wrote:
>Ben Finney wrote:
>>So long as you're not distributing some or all of Python itself, or a
derivative work, the license for Python has no legal effect on what
license you choose for your own work.


How many Python programs use nothing from the standard library?

That doesn't matter either. The required copyright statements are
included in the Python interpreter. There is no reason to fear
distributing Python as a part of either open source or proprietary
works, and Guido framed the original license to allow precisely such
uses. Later versions have retained the same spirit.
Yes, I know that. I was replying to Ben Finney's claim that in a
hypothetical world where Python was licensed under the GPL, there would
still be no restriction on distributing Python programs under a
closed-source license.
Sep 18 '06 #11
Leif K-Brooks <eu*****@ecritters.bizwrites:
Ben Finney wrote:
So long as you're not distributing some or all of Python itself,
or a derivative work, the license for Python has no legal effect
on what license you choose for your own work.
I was replying to Ben Finney's claim that in a hypothetical world
where Python was licensed under the GPL, there would still be no
restriction on distributing Python programs under a closed-source
license.
My claim (and IANAL) is that it doesn't matter *what* license Python
is distributed under; unless you do something with Python that is a
right of the copyright holder, such as distributing part or all of
Python, the copyright license terms of Python have no legal effect on
what license you choose for your own work.

--
\ "People are very open-minded about new things, as long as |
`\ they're exactly like the old ones." -- Charles F. Kettering |
_o__) |
Ben Finney

Sep 19 '06 #12
Ben Finney schrieb:
Leif K-Brooks <eu*****@ecritters.bizwrites:
>>>Ben Finney wrote:
So long as you're not distributing some or all of Python itself,
or a derivative work, the license for Python has no legal effect
on what license you choose for your own work.
>I was replying to Ben Finney's claim that in a hypothetical world
where Python was licensed under the GPL, there would still be no
restriction on distributing Python programs under a closed-source
license.

My claim (and IANAL) is that it doesn't matter *what* license Python
is distributed under; unless you do something with Python that is a
right of the copyright holder, such as distributing part or all of
Python, the copyright license terms of Python have no legal effect on
what license you choose for your own work.
IANAL - having said that:

Not true for the GPL. Part of python is the library, which you either
use explicit (I can't imagine a program that doesn't, beyond print
"hello world"), or implicit (sys and os are AFAIX used internally to
bootstrap the interpreter)

And the GPL exactly requires that when a library licensed under it is
used, that makes the using program GPL-licensed, too.

And the LGPL (L for lesser or library) remedies that.

If I recall correctly, the LGPL stats that you might use the headers and
link against a LGPL-lib as long as you don't change it, and you are ok.

So - I would certainly be very cautious when using GPL-based products if
I wanted to build some closed-source-application on top of it.

Diez
Sep 19 '06 #13
Diez B. Roggisch wrote:
Ben Finney schrieb:
>>Ben Finney wrote:
So long as you're not distributing some or all of Python itself,
or a derivative work, the license for Python has no legal effect
on what license you choose for your own work.
[SNIP]
My claim (and IANAL) is that it doesn't matter *what* license Python
is distributed under; unless you do something with Python that is a
right of the copyright holder, such as distributing part or all of
Python, the copyright license terms of Python have no legal effect on
what license you choose for your own work.

IANAL - having said that:

Not true for the GPL.
[Re: the hypothetical situation where Python were GPL'd]

It doesn't matter what the GPL says, if your work is not a derivative
work of Python then you have no obligation to follow _any_ terms in
Python's license to distribute your own work. The GPL could make all
the claims it wants[1], it doesn't matter since you aren't legally
required to follow any of them for your own (non-derived) work.

In particular, if your program ran on PyPy or Jython, it'd be pretty
much impossible to argue that it's a derivative work of CPython. Now,
if Jython/PyPy both required CPython libraries (which your code used)
then there could be a case that your code is derivative of those
libraries and bound by their license terms--it's not obvious that
argument would fly, but it's also not obvious it wouldn't.

[1] in reality the GPL recognizes this--see clause 5

Sep 19 '06 #14
"Diez B. Roggisch" <de***@nospam.web.dewrites:
Ben Finney schrieb:
My claim (and IANAL) is that it doesn't matter *what* license
Python is distributed under; unless you do something with Python
that is a right of the copyright holder, such as distributing part
or all of Python, the copyright license terms of Python have no
legal effect on what license you choose for your own work.

Not true for the GPL. Part of python is the library, which you
either use explicit (I can't imagine a program that doesn't, beyond
print "hello world"), or implicit (sys and os are AFAIX used
internally to bootstrap the interpreter)
And just about every program on a GNU/Linux system uses the libc
library, which is distributed under the GPL. That license *only*
affects works that are *derivative* of the libc library.
And the GPL exactly requires that when a library licensed under it
is used, that makes the using program GPL-licensed, too.
No, only when a new work *derives from* the existing work does
copyright on the existing work take effect.

You may be thinking of the "linking" clause, which depends on the
*inclusion of* existing header files from the library code, supplied
under the GPL. There's no such concept in an interpreted language like
Python: you write your program in the Python language without
including a single piece of the original in your work.

The GPL itself is clear on the fact that its terms cannot claim
anything that is not granted to the copyright holder -- and
*execution* of a library is not a right over which the library author
has any rights.

Even if execution (or "use") of a program library, without including
*any* of its code in your own work, were a right the library author
could restrict, no free software program can place any restriction on
execution (otherwise it's trivially non-free). If Python's license
were ever to have such a restrictive term, it would likely be
unenforcible, but would certainly disqualify it from inclusion in any
free operating system.

Copyright is currently weighted greatly in favour of copyright
holders, but please don't buy into the absolute-power rhetoric more
than necessary.

--
\ "Yesterday I told a chicken to cross the road. It said, 'What |
`\ for?'" -- Steven Wright |
_o__) |
Ben Finney

Sep 19 '06 #15
On Tue, Sep 19, 2006 at 09:46:13PM +1000, Ben Finney wrote:
"Diez B. Roggisch" <de***@nospam.web.dewrites:
Ben Finney schrieb:
My claim (and IANAL) is that it doesn't matter *what* license
Python is distributed under; unless you do something with Python
that is a right of the copyright holder, such as distributing part
or all of Python, the copyright license terms of Python have no
legal effect on what license you choose for your own work.
Not true for the GPL. Part of python is the library, which you
either use explicit (I can't imagine a program that doesn't, beyond
print "hello world"), or implicit (sys and os are AFAIX used
internally to bootstrap the interpreter)

And just about every program on a GNU/Linux system uses the libc
library, which is distributed under the GPL. That license *only*
affects works that are *derivative* of the libc library.
Hmmm... The copyright file I have for GNU C Library looks to be LGPL:
"""
Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,2001,2002,2003 Free Software
Foundation, Inc.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
"""

The difference between the GPL and the LGPL is the linking thing. Whether or
not it would hold up in court the FSF believes that GPL libraries mean only
GPL or GPL compatible licences are allowed to link, while anything can link
(dynamically not statically) to LGPL libraries.
http://www.gnu.org/licenses/why-not-lgpl.html:
"""
Proprietary software developers have the advantage of money; free software
developers need to make advantages for each other. Using the ordinary GPL for
a library gives free software developers an advantage over proprietary
developers: a library that they can use, while proprietary developers cannot
use it.

Using the ordinary GPL is not advantageous for every library. There are
reasons that can make it better to use the Library GPL in certain cases. The
most common case is when a free library's features are readily available for
proprietary software through other alternative libraries. In that case, the
library cannot give free software any particular advantage, so it is better to
use the Library GPL for that library.
"""
>
And the GPL exactly requires that when a library licensed under it
is used, that makes the using program GPL-licensed, too.

No, only when a new work *derives from* the existing work does
copyright on the existing work take effect.

You may be thinking of the "linking" clause, which depends on the
*inclusion of* existing header files from the library code, supplied
under the GPL. There's no such concept in an interpreted language like
Python: you write your program in the Python language without
including a single piece of the original in your work.

The GPL itself is clear on the fact that its terms cannot claim
anything that is not granted to the copyright holder -- and
*execution* of a library is not a right over which the library author
has any rights.

Even if execution (or "use") of a program library, without including
*any* of its code in your own work, were a right the library author
could restrict, no free software program can place any restriction on
execution (otherwise it's trivially non-free). If Python's license
were ever to have such a restrictive term, it would likely be
unenforcible, but would certainly disqualify it from inclusion in any
free operating system.

Copyright is currently weighted greatly in favour of copyright
holders, but please don't buy into the absolute-power rhetoric more
than necessary.

--
\ "Yesterday I told a chicken to cross the road. It said, 'What |
`\ for?'" -- Steven Wright |
_o__) |
Ben Finney

--
http://mail.python.org/mailman/listinfo/python-list
Sep 19 '06 #16
Chris Lambacher <ch***@kateandchris.netwrites:
On Tue, Sep 19, 2006 at 09:46:13PM +1000, Ben Finney wrote:
"Diez B. Roggisch" <de***@nospam.web.dewrites:
Ben Finney schrieb:
My claim (and IANAL) is that it doesn't matter *what* license
Python is distributed under; unless you do something with Python
that is a right of the copyright holder, such as distributing part
or all of Python, the copyright license terms of Python have no
legal effect on what license you choose for your own work.
>
Not true for the GPL. Part of python is the library, which you
either use explicit (I can't imagine a program that doesn't, beyond
print "hello world"), or implicit (sys and os are AFAIX used
internally to bootstrap the interpreter)
And just about every program on a GNU/Linux system uses the libc
library, which is distributed under the GPL. That license *only*
affects works that are *derivative* of the libc library.
Hmmm... The copyright file I have for GNU C Library looks to be LGPL:
True, that was a poorly chosen example.

There are many programs and libraries on a GNU/Linux system that are
licensed under the GPL. Programs that *derive from* them (by, for
instance, using their C header files as part of the program source)
must comply with the terms of the GPL. Programs that merely *use* that
functionality during execution are not affected by the GPL.

That latter case is the only one for most interpreted Python programs:
no part of the library is in the source code of the Python program, so
the license of that library doesn't affect the licensing of the
program.

Write your program in Python, and you can ignore the Python license
when you distribute your own work. We'd love to see you distribute it
under a free software license, but the license of Python has no legal
effect on your decision.

--
\ "Time flies like an arrow. Fruit flies like a banana." -- |
`\ Groucho Marx |
_o__) |
Ben Finney

Sep 19 '06 #17
Ben Finney wrote:
[...]
That latter case is the only one for most interpreted Python programs:
no part of the library is in the source code of the Python program, so
the license of that library doesn't affect the licensing of the
program.

Write your program in Python, and you can ignore the Python license
when you distribute your own work. We'd love to see you distribute it
under a free software license, but the license of Python has no legal
effect on your decision.
Given that many people distribute (enough of) the interpreter with their
Python programs I wouldn't like the above to be regarded as a blanket
statement that the Python license doesn't have to be considered when
distributing the interpreter with program source.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 20 '06 #18
Steve Holden <st***@holdenweb.comwrites:
Ben Finney wrote:
Write your program in Python, and you can ignore the Python
license when you distribute your own work. We'd love to see you
distribute it under a free software license, but the license of
Python has no legal effect on your decision.

Given that many people distribute (enough of) the interpreter with
their Python programs I wouldn't like the above to be regarded as a
blanket statement that the Python license doesn't have to be
considered when distributing the interpreter with program source.
Yes, this is true; I was deliberately omitting the case where parts of
Python *are* being redistributed. How about this:

Write your program in Python, distribute it without including any part
of Python itself, and you can ignore the Python license. We'd love to
see you distribute your work under a free software license, but the
license of Python has no legal effect on your decision in that case.

--
\ "Nature abhors a moron." -- Henry L. Mencken |
`\ |
_o__) |
Ben Finney

Sep 20 '06 #19
Ben Finney wrote:
Leif K-Brooks <eu*****@ecritters.bizwrites:
>>>Ben Finney wrote:
So long as you're not distributing some or all of Python itself,
or a derivative work, the license for Python has no legal effect
on what license you choose for your own work.
>I was replying to Ben Finney's claim that in a hypothetical world
where Python was licensed under the GPL, there would still be no
restriction on distributing Python programs under a closed-source
license.

My claim (and IANAL) is that it doesn't matter *what* license Python
is distributed under; unless you do something with Python that is a
right of the copyright holder, such as distributing part or all of
Python, the copyright license terms of Python have no legal effect on
what license you choose for your own work.
As I read the GPL, you should be ok if you don't copy, distribute or
modify Python (if Python was GPL). Those are the activities covered
by the GPL license. Using py2exe to make a binary with both Python
and your own code would be a different matter. Even distributing a CD
with a GPL Python and your python modules would be a problem, since
you would be distributing GPL software with non-GPL software which will
be combined into a program as you run it.

If you just distribute your .py files, it probably doesn't matter if
someone else will run the unholy combination of GPL Python and
nongpl.py. I don't think a judge would consider executing
"gplpython nonglp.py" being copying, distribution or modification.

On the other hand, I think your "doesn't matter *what* license
Python is distributed under"-claim holds. If we are allowed to think
up other evil licenses, they could make claims on all files ever used
with their evil software, and I doubt that you could develop non-
trivial software without ever invoking it.

Still, the important thing is that Python uses a license which is
convenient for both proprietary software development and open source.
Sep 22 '06 #20
Magnus Lycka wrote:
Ben Finney wrote:
>>Leif K-Brooks <eu*****@ecritters.bizwrites:

>>>>>Ben Finney wrote:
>
>>So long as you're not distributing some or all of Python itself,
>>or a derivative work, the license for Python has no legal effect
>>on what license you choose for your own work.
>>>I was replying to Ben Finney's claim that in a hypothetical world
where Python was licensed under the GPL, there would still be no
restriction on distributing Python programs under a closed-source
license.

My claim (and IANAL) is that it doesn't matter *what* license Python
is distributed under; unless you do something with Python that is a
right of the copyright holder, such as distributing part or all of
Python, the copyright license terms of Python have no legal effect on
what license you choose for your own work.


As I read the GPL, you should be ok if you don't copy, distribute or
modify Python (if Python was GPL).
Since Python *isn't* GPL, can we please move this discussion to
universe.hypothetical.discuss?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 22 '06 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Catalin | last post by:
How can I make executables with python? I found some utilities that claim they can do something like that like Installer and py2exe but they actualy pack the code in a huge arhive! This solves the...
0
by: Emile van Sebille | last post by:
QOTW: "Oddly enough it is in Python that I have had the most fun programming. It is in Python that I find myself not only the most expressive but the most elegant in my programming. In Python my...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
31
by: poisondart | last post by:
Hi, I'm not sure if this is the right group to post this. If not, then I would appreciate if somebody could point me to the correct group. This is my first time releasing software to the...
0
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.