• Re: Windows installer from python source code without access to source

    From Chris Angelico@21:1/5 to Jim Schwartz on Fri Mar 31 23:08:39 2023
    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has the source code available. So does pyinstaller. I think gcc does, too.



    Does anyone know of a way to do this?


    Fundamentally no, it's not. Python code will always be distributed as
    some form of bytecode. The only way to make it available without
    revealing anything is to put it on a server and let people access it
    without running it themselves.

    But why is that a problem? Copyright law protects you from people
    stealing your code and making unauthorized changes to it, and if
    you're not worried about them making changes, there's no reason to
    hide the source code (whatever you distribute would be just as
    copiable). Are you concerned that people will see your bugs? We all
    have them.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jkn@21:1/5 to Chris Angelico on Fri Mar 31 07:14:42 2023
    On Friday, March 31, 2023 at 1:09:12 PM UTC+1, Chris Angelico wrote:
    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jsc...@sbcglobal.net> wrote:

    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has the source code available. So does pyinstaller. I think gcc does, too.



    Does anyone know of a way to do this?

    Fundamentally no, it's not. Python code will always be distributed as
    some form of bytecode. The only way to make it available without
    revealing anything is to put it on a server and let people access it
    without running it themselves.

    But why is that a problem? Copyright law protects you from people
    stealing your code and making unauthorized changes to it, and if
    you're not worried about them making changes, there's no reason to
    hide the source code (whatever you distribute would be just as
    copiable). Are you concerned that people will see your bugs? We all
    have them.

    ChrisA

    The OP is asking for source code not to be available, not bytecode.
    There are obfuscating tools like PyArmor you might want to have a look at.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to jkn on Fri Mar 31 10:53:16 2023
    On 3/31/2023 10:14 AM, jkn wrote:
    On Friday, March 31, 2023 at 1:09:12 PM UTC+1, Chris Angelico wrote:
    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jsc...@sbcglobal.net> wrote:

    I want a windows installer to install my application that's written in
    python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has the
    source code available. So does pyinstaller. I think gcc does, too.



    Does anyone know of a way to do this?

    Fundamentally no, it's not. Python code will always be distributed as
    some form of bytecode. The only way to make it available without
    revealing anything is to put it on a server and let people access it
    without running it themselves.

    But why is that a problem? Copyright law protects you from people
    stealing your code and making unauthorized changes to it, and if
    you're not worried about them making changes, there's no reason to
    hide the source code (whatever you distribute would be just as
    copiable). Are you concerned that people will see your bugs? We all
    have them.

    ChrisA

    The OP is asking for source code not to be available, not bytecode.
    There are obfuscating tools like PyArmor you might want to have a look at.

    The byte code can be decompiled, though, so the attempt to hide the code
    won't be completely successful if someone wants to make the effort. The
    same is true, e.g., about Java. The class files don't include the
    source, but they can be decompiled.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alan Gauld@21:1/5 to Jim Schwartz on Fri Mar 31 17:31:40 2023
    On 31/03/2023 13:00, Jim Schwartz wrote:
    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.

    Others have commented that at some level it will always be thre but on a
    more pragmatic level tools like py2exe bundle up a Python app as an exe
    file which might be all you need?

    I'm sure if a user dug deep enough they could still find the source (or something close) but to deter casual browsing it might be what you want.

    Caveat: I've never used py2exe in anger and my experiements were before
    Python3 so ive no idea what it does today! But a quick check suggests it
    still exists and works with python3 code - last major release was in Nov
    2022.

    --
    Alan G
    Author of the Learn to Program web site
    http://www.alan-g.me.uk/
    http://www.amazon.com/author/alan_gauld
    Follow my photo-blog on Flickr at:
    http://www.flickr.com/photos/alangauldphotos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Jim Schwartz on Fri Mar 31 12:54:42 2023
    On 3/31/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.

    Cython can compile a script to C source code for a module or
    executable (--embed). The source can be compiled and linked normally.
    For example, the following builds a "hello.exe" executable based on a "hello.py" script.

    > cython -3 --embed hello.py
    > set "PYI=C:\Program Files\Python311\include"
    > set "PYL=C:\Program Files\Python311\libs"
    > cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    > copy hello.exe embed
    > embed\hello.exe
    Hello, World!

    I extracted the complete embeddable distribution of Python 3.11 into
    the "embed" directory. You can reduce the size of the installation, if
    needed, by minimizing the zipped standard library and removing pyd
    extensions and DLLs that your application doesn't use.

    The generated "hello.c" is large and not particularly easy to read,
    but here are some snippets [...]:

    [...]
    /* Implementation of 'hello' */
    static PyObject *__pyx_builtin_print;
    static const char __pyx_k_main[] = "__main__";
    static const char __pyx_k_name[] = "__name__";
    static const char __pyx_k_test[] = "__test__";
    static const char __pyx_k_print[] = "print";
    static const char __pyx_k_Hello_World[] = "Hello, World!";
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_,
    NULL);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    int wmain(int argc, wchar_t **argv) {
    [...]
    if (argc && argv)
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    if (argc && argv)
    PySys_SetArgv(argc, argv);
    [...]
    m = PyInit_hello();
    [...]
    if (Py_FinalizeEx() < 0)
    return 2;
    [...]
    return 0;
    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to Jim Schwartz on Fri Mar 31 16:16:54 2023
    What license do I have to choose so people can't use my code? I don't know this stuff.

    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On Behalf Of Chris Angelico
    Sent: Friday, March 31, 2023 7:09 AM
    To: python-list@python.org
    Subject: Re: Windows installer from python source code without access to
    source code

    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has
    the source code available. So does pyinstaller. I think gcc does, too.



    Does anyone know of a way to do this?


    Fundamentally no, it's not. Python code will always be distributed as some
    form of bytecode. The only way to make it available without revealing
    anything is to put it on a server and let people access it without running
    it themselves.

    But why is that a problem? Copyright law protects you from people stealing
    your code and making unauthorized changes to it, and if you're not worried about them making changes, there's no reason to hide the source code
    (whatever you distribute would be just as copiable). Are you concerned that people will see your bugs? We all have them.

    ChrisA
    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to Jim Schwartz on Fri Mar 31 18:01:24 2023
    On 3/31/2023 5:16 PM, Jim Schwartz wrote:
    What license do I have to choose so people can't use my code? I don't know this stuff.

    It would help if you would explain what you want to accomplish and why.
    Do you expect to make money off your software? If not, why do want so
    badly to protect it?

    The most basic answer is that your code is automatically protected by
    copyright law unless you say differently. But it is still a good idea
    to state outright what actions would be allowed and what would be forbidden.

    If you do expect to make money, you could look at what phone apps
    developers include with their apps. And it would be good to consult a
    lawyer who practices in this field.


    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On Behalf Of Chris Angelico
    Sent: Friday, March 31, 2023 7:09 AM
    To: python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code

    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    I want a windows installer to install my application that's written in
    python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has
    the source code available. So does pyinstaller. I think gcc does, too.



    Does anyone know of a way to do this?


    Fundamentally no, it's not. Python code will always be distributed as some form of bytecode. The only way to make it available without revealing anything is to put it on a server and let people access it without running
    it themselves.

    But why is that a problem? Copyright law protects you from people stealing your code and making unauthorized changes to it, and if you're not worried about them making changes, there's no reason to hide the source code (whatever you distribute would be just as copiable). Are you concerned that people will see your bugs? We all have them.

    ChrisA
    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Jim Schwartz on Sat Apr 1 10:49:18 2023
    On Sat, 1 Apr 2023 at 10:34, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    Yea. You’re right. I probably need a lawyer someday. Thanks.


    If your needs are basic, you shouldn't need a lawyer. Copyright law
    and treaties DO protect you. But it's important to be aware that no
    amount of legal protection - whether you hire a lawyer or not, and
    whether you identify copyright and license or not - will stop people
    from copying your code. NOTHING will stop people from copying your
    code if they have access to it. All you can do is discourage them.

    So that brings us back to the original question: Why protect your
    *source code* specifically? There are two extremes available to
    everyone:

    1) Distribute the source code. Let everyone see it. Stick a license on
    it that permits them to use it, modify it, distribute modified
    versions. Set your code free and let it be used.

    2) Don't distribute the program *at all*. Don't distribute the source
    OR the binary. Instead, permit people to *access* the program - which,
    in today's world, usually means a web service.

    Both of these are very popular and work well. I don't have access to
    the Gmail source code but I'm using the service. I don't have access
    to the Twitch.tv source code but I'm using the service. Meanwhile, I
    have Python programs running on a Debian system using the Linux
    kernel, invoked using bash, served from an ext4 mass storage device,
    etc, etc. I have the binary code for all of these, and I'm legally
    guaranteed access to the source if I want it, so there's no incentive
    to steal it.

    The middle ground of "distribute binaries but stop people from
    accessing the source" is a much narrower use-case, and I would say
    that it's not actually a single use-case but a family of them, each
    with different needs and requirements. So it's essential to know what
    you're actually trying to protect, and why.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Fri Mar 31 18:32:18 2023
    Yea. You’re right. I probably need a lawyer someday. Thanks.

    Sent from my iPhone

    On Mar 31, 2023, at 5:12 PM, Thomas Passin <list1@tompassin.net> wrote:

    On 3/31/2023 5:16 PM, Jim Schwartz wrote:
    What license do I have to choose so people can't use my code? I don't know >> this stuff.

    It would help if you would explain what you want to accomplish and why. Do you expect to make money off your software? If not, why do want so badly to protect it?

    The most basic answer is that your code is automatically protected by copyright law unless you say differently. But it is still a good idea to state outright what actions would be allowed and what would be forbidden.

    If you do expect to make money, you could look at what phone apps developers include with their apps. And it would be good to consult a lawyer who practices in this field.


    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On >> Behalf Of Chris Angelico
    Sent: Friday, March 31, 2023 7:09 AM
    To: python-list@python.org
    Subject: Re: Windows installer from python source code without access to
    source code
    On Fri, 31 Mar 2023 at 23:01, Jim Schwartz <jschwar@sbcglobal.net> wrote: >>>
    I want a windows installer to install my application that's written in
    python, but I don't want the end user to have access to my source code.



    Is that possible using python? I was using cx-freeze, but that has
    the source code available. So does pyinstaller. I think gcc does, too. >>>


    Does anyone know of a way to do this?

    Fundamentally no, it's not. Python code will always be distributed as some >> form of bytecode. The only way to make it available without revealing
    anything is to put it on a server and let people access it without running >> it themselves.
    But why is that a problem? Copyright law protects you from people stealing >> your code and making unauthorized changes to it, and if you're not worried >> about them making changes, there's no reason to hide the source code
    (whatever you distribute would be just as copiable). Are you concerned that >> people will see your bugs? We all have them.
    ChrisA
    --
    https://mail.python.org/mailman/listinfo/python-list

    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 2QdxY4RzWzUUiLuE@potatochowder.com@21:1/5 to Chris Angelico on Fri Mar 31 22:14:34 2023
    On 2023-04-01 at 10:49:18 +1100,
    Chris Angelico <rosuav@gmail.com> wrote:

    [...] I don't have access to the Gmail source code but I'm using the
    service [...]

    You have access to Gmail's front end source code. Your web browser runs
    it every time you use the service (and probably while you aren't using
    the service, too). My educated guess is that Google expended some
    effort to hinder you from looking at and/or analyzing (or do you say analysing?) that code, and that their lawyers will come knocking at your metaphorical door if they so much as think you are using that code in
    some way other than running it inside your web browser. If only this
    situation were a cruel April Fool's Day joke.

    You don't have access to Gmail's back end source code.

    Many/Most web apps follow this pattern to varying degrees. I do not
    know whether this setup meets the OP's requirements.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to 2QdxY4RzWzUUiLuE@potatochowder.com on Sat Apr 1 18:50:36 2023
    On Sat, 1 Apr 2023 at 13:16, <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:

    On 2023-04-01 at 10:49:18 +1100,
    Chris Angelico <rosuav@gmail.com> wrote:

    [...] I don't have access to the Gmail source code but I'm using the service [...]

    You have access to Gmail's front end source code. Your web browser runs
    it every time you use the service (and probably while you aren't using
    the service, too).

    Yes, and I'm talking about their back end source code, which I most
    definitely do NOT have access to, and therefore cannot copy.

    My educated guess is that Google expended some
    effort to hinder you from looking at and/or analyzing (or do you say analysing?) that code, and that their lawyers will come knocking at your metaphorical door if they so much as think you are using that code in
    some way other than running it inside your web browser. If only this situation were a cruel April Fool's Day joke.

    They haven't done very much, I happen to know this relating to other
    services. From what I can tell, Google's front ends aren't very well
    protected, for the simple reason that they're quite useless without
    the corresponding back ends.

    You don't have access to Gmail's back end source code.

    Many/Most web apps follow this pattern to varying degrees. I do not
    know whether this setup meets the OP's requirements.

    Exactly. That's why I pointed it out. This is the only way to truly
    protect your source code: Don't give it out.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Sat Apr 1 04:24:44 2023
    I am writing an app but I’m not sure I’ll sell it yet. I have it in a private GitHub location and GitHub prompts me for a license. I don’t really understand licenses so I just picked Apache 2.0. Maybe I’m going too far with my worry about which
    license I pick. I’m not selling it now so it doesn’t matter. I have to do a lot more work before I get to that point

    Sent from my iPhone

    On Mar 31, 2023, at 6:52 PM, Chris Angelico <rosuav@gmail.com> wrote:

    On Sat, 1 Apr 2023 at 10:34, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    Yea. You’re right. I probably need a lawyer someday. Thanks.


    If your needs are basic, you shouldn't need a lawyer. Copyright law
    and treaties DO protect you. But it's important to be aware that no
    amount of legal protection - whether you hire a lawyer or not, and
    whether you identify copyright and license or not - will stop people
    from copying your code. NOTHING will stop people from copying your
    code if they have access to it. All you can do is discourage them.

    So that brings us back to the original question: Why protect your
    *source code* specifically? There are two extremes available to
    everyone:

    1) Distribute the source code. Let everyone see it. Stick a license on
    it that permits them to use it, modify it, distribute modified
    versions. Set your code free and let it be used.

    2) Don't distribute the program *at all*. Don't distribute the source
    OR the binary. Instead, permit people to *access* the program - which,
    in today's world, usually means a web service.

    Both of these are very popular and work well. I don't have access to
    the Gmail source code but I'm using the service. I don't have access
    to the Twitch.tv source code but I'm using the service. Meanwhile, I
    have Python programs running on a Debian system using the Linux
    kernel, invoked using bash, served from an ext4 mass storage device,
    etc, etc. I have the binary code for all of these, and I'm legally
    guaranteed access to the source if I want it, so there's no incentive
    to steal it.

    The middle ground of "distribute binaries but stop people from
    accessing the source" is a much narrower use-case, and I would say
    that it's not actually a single use-case but a family of them, each
    with different needs and requirements. So it's essential to know what
    you're actually trying to protect, and why.

    ChrisA
    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Jim Schwartz on Sat Apr 1 21:26:20 2023
    On Sat, 1 Apr 2023 at 20:24, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    I am writing an app but I’m not sure I’ll sell it yet. I have it in a private GitHub location and GitHub prompts me for a license. I don’t really understand licenses so I just picked Apache 2.0. Maybe I’m going too far with my worry about which
    license I pick. I’m not selling it now so it doesn’t matter. I have to do a lot more work before I get to that point


    When you put license terms on something, that is a *legal statement*.
    Read the license you're applying and don't just pick for the sake of
    picking. By applying this license, you are granting legal permission
    for anyone to redistribute your code in source or object form.

    On the plus side, you've just made all questions of obfuscating your
    source code completely irrelevant :)

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to Jim Schwartz on Sat Apr 1 08:51:43 2023
    On 4/1/2023 5:24 AM, Jim Schwartz wrote:
    I am writing an app but I’m not sure I’ll sell it yet. I have it in a private GitHub location and GitHub prompts me for a license. I don’t really understand licenses so I just picked Apache 2.0. Maybe I’m going too far with my worry about which
    license I pick. I’m not selling it now so it doesn’t matter. I have to do a lot more work before I get to that point

    You can dual-license it - one license for free uses, one for commercial
    users. But read GitHub's terms of service to make sure your repo is
    going to continue to qualify - you might need to start paying them if
    your code goes commercial.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to Jim Schwartz on Tue Apr 4 10:25:34 2023
    Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true?

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Friday, March 31, 2023 12:55 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code

    On 3/31/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    I want a windows installer to install my application that's written in python, but I don't want the end user to have access to my source code.

    Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally.
    For example, the following builds a "hello.exe" executable based on a "hello.py" script.

    > cython -3 --embed hello.py
    > set "PYI=C:\Program Files\Python311\include"
    > set "PYL=C:\Program Files\Python311\libs"
    > cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    > copy hello.exe embed
    > embed\hello.exe
    Hello, World!

    I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application doesn'
    t use.

    The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]:

    [...]
    /* Implementation of 'hello' */
    static PyObject *__pyx_builtin_print;
    static const char __pyx_k_main[] = "__main__";
    static const char __pyx_k_name[] = "__name__";
    static const char __pyx_k_test[] = "__test__";
    static const char __pyx_k_print[] = "print";
    static const char __pyx_k_Hello_World[] = "Hello, World!";
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_,
    NULL);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    int wmain(int argc, wchar_t **argv) {
    [...]
    if (argc && argv)
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    if (argc && argv)
    PySys_SetArgv(argc, argv);
    [...]
    m = PyInit_hello();
    [...]
    if (Py_FinalizeEx() < 0)
    return 2;
    [...]
    return 0;
    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Tue Apr 4 19:25:24 2023
    On 4 Apr 2023, at 16:28, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true?

    It is part of visual studio C++.
    Once you have that installed there are bat files that setup environment in the terminal.
    Then you can use cl, nmake etc

    Barry

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Friday, March 31, 2023 12:55 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code

    On 3/31/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    I want a windows installer to install my application that's written in
    python, but I don't want the end user to have access to my source code.

    Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally.
    For example, the following builds a "hello.exe" executable based on a "hello.py" script.

    cython -3 --embed hello.py
    set "PYI=C:\Program Files\Python311\include"
    set "PYL=C:\Program Files\Python311\libs"
    cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    copy hello.exe embed
    embed\hello.exe
    Hello, World!

    I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application
    doesn't use.

    The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]:

    [...]
    /* Implementation of 'hello' */
    static PyObject *__pyx_builtin_print;
    static const char __pyx_k_main[] = "__main__";
    static const char __pyx_k_name[] = "__name__";
    static const char __pyx_k_test[] = "__test__";
    static const char __pyx_k_print[] = "print";
    static const char __pyx_k_Hello_World[] = "Hello, World!";
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_,
    NULL);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    int wmain(int argc, wchar_t **argv) {
    [...]
    if (argc && argv)
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    if (argc && argv)
    PySys_SetArgv(argc, argv);
    [...]
    m = PyInit_hello();
    [...]
    if (Py_FinalizeEx() < 0)
    return 2;
    [...]
    return 0;
    [...]

    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Thu Apr 6 14:49:50 2023
    I downloaded VS community 2022 and I know how to access the developer command prompt. I'm using the one called x64 Native Tools Command Prompt for VS 2022

    I ran a command to compile my python code that was converted to c with the following command:

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl /O2 /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\" aws_pc_backup.c C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
    Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    aws_pc_backup.c
    Microsoft (R) Incremental Linker Version 14.35.32216.1
    Copyright (C) Microsoft Corporation. All rights reserved.

    /out:aws_pc_backup.exe
    aws_pc_backup.obj C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
    Creating library aws_pc_backup.lib and object aws_pc_backup.exp

    When I ran the program, I got this, though. Obviously, it doesn't know about the requests package. Do I have to link something in with the executable?

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe -m:lb
    Traceback (most recent call last):
    File "src\\python\\aws_pc_backup_main.py", line 7, in init python.aws_pc_backup_main
    ModuleNotFoundError: No module named 'requests'





    -----Original Message-----
    From: Barry <barry@barrys-emacs.org>
    Sent: Tuesday, April 4, 2023 1:25 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: Eryk Sun <eryksun@gmail.com>; python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code



    On 4 Apr 2023, at 16:28, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true?

    It is part of visual studio C++.
    Once you have that installed there are bat files that setup environment in the terminal.
    Then you can use cl, nmake etc

    Barry

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Friday, March 31, 2023 12:55 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access
    to source code

    On 3/31/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    I want a windows installer to install my application that's written
    in python, but I don't want the end user to have access to my source code.

    Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally.
    For example, the following builds a "hello.exe" executable based on a "hello.py" script.

    cython -3 --embed hello.py
    set "PYI=C:\Program Files\Python311\include"
    set "PYL=C:\Program Files\Python311\libs"
    cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    copy hello.exe embed
    embed\hello.exe
    Hello, World!

    I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application
    doesn't use.

    The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]:

    [...]
    /* Implementation of 'hello' */
    static PyObject *__pyx_builtin_print;
    static const char __pyx_k_main[] = "__main__";
    static const char __pyx_k_name[] = "__name__";
    static const char __pyx_k_test[] = "__test__";
    static const char __pyx_k_print[] = "print";
    static const char __pyx_k_Hello_World[] = "Hello, World!";
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_,
    NULL);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    int wmain(int argc, wchar_t **argv) {
    [...]
    if (argc && argv)
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    if (argc && argv)
    PySys_SetArgv(argc, argv);
    [...]
    m = PyInit_hello();
    [...]
    if (Py_FinalizeEx() < 0)
    return 2;
    [...]
    return 0;
    [...]

    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From MRAB@21:1/5 to Jim Schwartz on Thu Apr 6 23:49:37 2023
    On 2023-04-06 23:14, Jim Schwartz wrote:
    Could someone please help Carlos?  I’m not sure how to answer his
    question

    Sent from my iPhone

    On Apr 6, 2023, at 3:53 PM, Carlos Fulqueris <cafulque@gmail.com> wrote:

    
    Hello Jim,
    How can I unsubscribe to this email list?
    I'm waiting for your response.
    Thanks
    Carlos
    [snip]
    At the bottom of the post is a link to the page that explains how to unsubscribe. It's the link:

    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Thu Apr 6 17:14:41 2023
    Could someone please help Carlos?  I’m not sure how to answer his
    question 

    Sent from my iPhone

    On Apr 6, 2023, at 3:53 PM, Carlos Fulqueris <cafulque@gmail.com> wrote:

    
    Hello Jim,
    How can I unsubscribe to this email list?
    I'm waiting for your response.
    Thanks
    Carlos
    El jue, 6 abr 2023 a las 16:52, Jim Schwartz
    (<[1]jschwar@sbcglobal.net>) escribió:

    I downloaded VS community 2022 and I know how to access the developer
    command prompt.  I'm using the one called x64 Native Tools Command
    Prompt for VS 2022

    I ran a command to compile my python code that was converted to c with
    the following command:

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl
    /O2
    /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\"
    aws_pc_backup.c
    C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
    Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.

    aws_pc_backup.c
    Microsoft (R) Incremental Linker Version 14.35.32216.1
    Copyright (C) Microsoft Corporation.  All rights reserved.

    /out:aws_pc_backup.exe
    aws_pc_backup.obj
    C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
       Creating library aws_pc_backup.lib and object aws_pc_backup.exp

    When I ran the program, I got this, though.  Obviously, it doesn't
    know about the requests package.  Do I have to link something in with
    the executable?

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe
    -m:lb
    Traceback (most recent call last):
      File "src\\python\\aws_pc_backup_main.py", line 7, in init
    python.aws_pc_backup_main
    ModuleNotFoundError: No module named 'requests'

    -----Original Message-----
    From: Barry <[2]barry@barrys-emacs.org>
    Sent: Tuesday, April 4, 2023 1:25 PM
    To: Jim Schwartz <[3]jschwar@sbcglobal.net>
    Cc: Eryk Sun <[4]eryksun@gmail.com>; [5]python-list@python.org
    Subject: Re: Windows installer from python source code without access
    to source code

    > On 4 Apr 2023, at 16:28, Jim Schwartz <[6]jschwar@sbcglobal.net>
    wrote:
    >
    > Where can I download that cl program?  I've used gcc before, but I
    hear that cl can use a setup.py program to run the compile and link
    and create a windows .msi installer.  Is that true? 

    It is part of visual studio C++.
    Once you have that installed there are bat files that setup
    environment in the terminal.
    Then you can use cl, nmake etc

    Barry
    >
    > -----Original Message-----
    > From: Eryk Sun <[7]eryksun@gmail.com>
    > Sent: Friday, March 31, 2023 12:55 PM
    > To: Jim Schwartz <[8]jschwar@sbcglobal.net>
    > Cc: [9]python-list@python.org
    > Subject: Re: Windows installer from python source code without
    access
    > to source code
    >
    >> On 3/31/23, Jim Schwartz <[10]jschwar@sbcglobal.net> wrote:
    >> I want a windows installer to install my application that's written
    >> in python, but I don't want the end user to have access to my
    source code.
    >
    > Cython can compile a script to C source code for a module or
    executable (--embed). The source can be compiled and linked normally.
    > For example, the following builds a "hello.exe" executable based on
    a "hello.py" script.
    >
    >> cython -3 --embed hello.py
    >> set "PYI=C:\Program Files\Python311\include"
    >> set "PYL=C:\Program Files\Python311\libs"
    >> cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    >> copy hello.exe embed
    >> embed\hello.exe
    >    Hello, World!
    >
    > I extracted the complete embeddable distribution of Python 3.11 into
    the "embed" directory. You can reduce the size of the installation, if
    needed, by minimizing the zipped standard library and removing pyd
    extensions and DLLs that your application doesn't use.
    >
    > The generated "hello.c" is large and not particularly easy to read,
    but here are some snippets [...]:
    >
    >    [...]
    >    /* Implementation of 'hello' */
    >    static PyObject *__pyx_builtin_print;
    >    static const char __pyx_k_main[] = "__main__";
    >    static const char __pyx_k_name[] = "__name__";
    >    static const char __pyx_k_test[] = "__test__";
    >    static const char __pyx_k_print[] = "print";
    >    static const char __pyx_k_Hello_World[] = "Hello, World!";
    >    [...]
    >      /* "hello.py":1
    >     * print("Hello, World!")             # <<<<<<<<<<<<<<
    >     */
    >      __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    >            if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1,
    __pyx_L1_error)
    >    [...]
    >      /* "hello.py":1
    >     * print("Hello, World!")             # <<<<<<<<<<<<<<
    >     */
    >      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print,
    __pyx_tuple_,
    >                                      NULL);
    >            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    >    [...]
    >    int wmain(int argc, wchar_t **argv) {
    >    [...]
    >        if (argc && argv)
    >            Py_SetProgramName(argv[0]);
    >        Py_Initialize();
    >        if (argc && argv)
    >            PySys_SetArgv(argc, argv);
    >    [...]
    >              m = PyInit_hello();
    >    [...]
    >        if (Py_FinalizeEx() < 0)
    >            return 2;
    >    [...]
    >        return 0;
    >    [...]
    >
    > --
    > [11]https://mail.python.org/mailman/listinfo/python-list
    >

    --
    [12]https://mail.python.org/mailman/listinfo/python-list

    References

    Visible links
    1. mailto:jschwar@sbcglobal.net
    2. mailto:barry@barrys-emacs.org
    3. mailto:jschwar@sbcglobal.net
    4. mailto:eryksun@gmail.com
    5. mailto:python-list@python.org
    6. mailto:jschwar@sbcglobal.net
    7. mailto:eryksun@gmail.com
    8. mailto:jschwar@sbcglobal.net
    9. mailto:python-list@python.org
    10. mailto:jschwar@sbcglobal.net
    11. https://mail.python.org/mailman/listinfo/python-list
    12. https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Thu Apr 6 18:47:55 2023
    Never mind. I found it on the web. I needed to point my PYTHONPATH to sitepackages: https://stackoverflow.com/questions/56857449/importerror-after-cython-embed


    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On Behalf Of Jim Schwartz
    Sent: Thursday, April 6, 2023 2:50 PM
    To: 'Barry' <barry@barrys-emacs.org>
    Cc: python-list@python.org
    Subject: RE: Windows installer from python source code without access to source code

    I downloaded VS community 2022 and I know how to access the developer command prompt. I'm using the one called x64 Native Tools Command Prompt for VS 2022

    I ran a command to compile my python code that was converted to c with the following command:

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>cl /O2 /I"C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\include\\" aws_pc_backup.c C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
    Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32216.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

    aws_pc_backup.c
    Microsoft (R) Incremental Linker Version 14.35.32216.1 Copyright (C) Microsoft Corporation. All rights reserved.

    /out:aws_pc_backup.exe
    aws_pc_backup.obj C:\\Users\\jschw\\AppData\\Local\\Programs\\Python\\Python3112\\libs\\python311.lib
    Creating library aws_pc_backup.lib and object aws_pc_backup.exp

    When I ran the program, I got this, though. Obviously, it doesn't know about the requests package. Do I have to link something in with the executable?

    H:\Users\LindaJim\Documents\SourceCode\Software\aws_pc_backup\src\c>aws_pc_backup.exe -m:lb Traceback (most recent call last):
    File "src\\python\\aws_pc_backup_main.py", line 7, in init python.aws_pc_backup_main
    ModuleNotFoundError: No module named 'requests'





    -----Original Message-----
    From: Barry <barry@barrys-emacs.org>
    Sent: Tuesday, April 4, 2023 1:25 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: Eryk Sun <eryksun@gmail.com>; python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code



    On 4 Apr 2023, at 16:28, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    Where can I download that cl program? I've used gcc before, but I hear that cl can use a setup.py program to run the compile and link and create a windows .msi installer. Is that true?

    It is part of visual studio C++.
    Once you have that installed there are bat files that setup environment in the terminal.
    Then you can use cl, nmake etc

    Barry

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Friday, March 31, 2023 12:55 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access
    to source code

    On 3/31/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    I want a windows installer to install my application that's written
    in python, but I don't want the end user to have access to my source code.

    Cython can compile a script to C source code for a module or executable (--embed). The source can be compiled and linked normally.
    For example, the following builds a "hello.exe" executable based on a "hello.py" script.

    cython -3 --embed hello.py
    set "PYI=C:\Program Files\Python311\include"
    set "PYL=C:\Program Files\Python311\libs"
    cl /I"%PYI%" hello.c /link /libpath:"%PYL%"
    copy hello.exe embed
    embed\hello.exe
    Hello, World!

    I extracted the complete embeddable distribution of Python 3.11 into the "embed" directory. You can reduce the size of the installation, if needed, by minimizing the zipped standard library and removing pyd extensions and DLLs that your application
    doesn't use.

    The generated "hello.c" is large and not particularly easy to read, but here are some snippets [...]:

    [...]
    /* Implementation of 'hello' */
    static PyObject *__pyx_builtin_print;
    static const char __pyx_k_main[] = "__main__";
    static const char __pyx_k_name[] = "__name__";
    static const char __pyx_k_test[] = "__test__";
    static const char __pyx_k_print[] = "print";
    static const char __pyx_k_Hello_World[] = "Hello, World!";
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Hello_World);
    if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    /* "hello.py":1
    * print("Hello, World!") # <<<<<<<<<<<<<<
    */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_,
    NULL);
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
    [...]
    int wmain(int argc, wchar_t **argv) {
    [...]
    if (argc && argv)
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    if (argc && argv)
    PySys_SetArgv(argc, argv);
    [...]
    m = PyInit_hello();
    [...]
    if (Py_FinalizeEx() < 0)
    return 2;
    [...]
    return 0;
    [...]

    --
    https://mail.python.org/mailman/listinfo/python-list


    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Jim Schwartz on Thu Apr 6 20:05:40 2023
    On 4/6/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    Never mind. I found it on the web. I needed to point my PYTHONPATH to sitepackages:

    In most cases an application should be isolated from PYTHON*
    environment variables. If you're creating a Python application or
    embedding Python in an application, use the embeddable distribution,
    and add any additional required sys.path directories to the included
    "._pth" file (e.g. "python311._pth").

    https://docs.python.org/3/library/sys_path_init.html#pth-files

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to Jim Schwartz on Fri Apr 7 05:33:25 2023
    Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment
    variable.

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Thursday, April 6, 2023 8:06 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code

    On 4/6/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    Never mind. I found it on the web. I needed to point my PYTHONPATH
    to
    sitepackages:

    In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional required sys.path directories to
    the included "._pth" file (e.g. "python311._pth").

    https://docs.python.org/3/library/sys_path_init.html#pth-files

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mark Bourne@21:1/5 to MRAB on Fri Apr 7 12:16:07 2023
    MRAB wrote:
    On 2023-04-06 23:14, Jim Schwartz wrote:
        Could someone please help Carlos?  I’m not sure how to answer his >>     question

        Sent from my iPhone

          On Apr 6, 2023, at 3:53 PM, Carlos Fulqueris
    <cafulque@gmail.com> wrote:

          
          Hello Jim,
          How can I unsubscribe to this email list?
          I'm waiting for your response.
          Thanks
          Carlos
    [snip]
    At the bottom of the post is a link to the page that explains how to unsubscribe. It's the link:

            https://mail.python.org/mailman/listinfo/python-list

    I read this list via the newsgroup, so don't see those links. However,
    I've always thought those Mailman pages are confusing for anyone not
    already familiar when it comes to subscribing. The option to
    unsubscribe is right at the bottom of the page under the "Python-list Subscribers" section, which looks like it's only for list
    administrators! Ignore the admin address and password boxes, just fill
    in your email address in the box below those and click "Unsubscribe or
    edit options".

    --
    Mark.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to Jim Schwartz on Fri Apr 7 07:28:20 2023
    Is this what you'd recommend doing when distributing a cython-generated code compiled with cl. I want to distribute this in a windows or other operating system installer. I'll start with windows first. I don't think I can use cx_freeze to create the
    installer, unless I know which files to include in the package and list them.

    https://stackoverflow.com/questions/62390978/minimal-set-of-files-required-to-distribute-an-embed-cython-compiled-code-and-ma


    -----Original Message-----
    From: Jim Schwartz <jschwar@sbcglobal.net>
    Sent: Friday, April 7, 2023 5:33 AM
    To: 'Eryk Sun' <eryksun@gmail.com>
    Cc: 'python-list@python.org' <python-list@python.org>
    Subject: RE: Windows installer from python source code without access to source code

    Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment
    variable.

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Thursday, April 6, 2023 8:06 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access to source code

    On 4/6/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    Never mind. I found it on the web. I needed to point my PYTHONPATH
    to
    sitepackages:

    In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional required sys.path directories to
    the included "._pth" file (e.g. "python311._pth").

    https://docs.python.org/3/library/sys_path_init.html#pth-files

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to Jim Schwartz on Sun Apr 9 06:22:13 2023
    Thanks everyone for the help. I got my app working with using cython to generate the c code, cl to compile, and visual studio to create the
    setup.exe and the msi installer. I appreciate the help.

    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On Behalf Of Jim Schwartz
    Sent: Friday, April 7, 2023 7:28 AM
    To: 'Eryk Sun' <eryksun@gmail.com>
    Cc: python-list@python.org
    Subject: RE: Windows installer from python source code without access to
    source code

    Is this what you'd recommend doing when distributing a cython-generated code compiled with cl. I want to distribute this in a windows or other operating system installer. I'll start with windows first. I don't think I can use cx_freeze to create the installer, unless I know which files to include in
    the package and list them.

    https://stackoverflow.com/questions/62390978/minimal-set-of-files-required-t o-distribute-an-embed-cython-compiled-code-and-ma


    -----Original Message-----
    From: Jim Schwartz <jschwar@sbcglobal.net>
    Sent: Friday, April 7, 2023 5:33 AM
    To: 'Eryk Sun' <eryksun@gmail.com>
    Cc: 'python-list@python.org' <python-list@python.org>
    Subject: RE: Windows installer from python source code without access to
    source code

    Yea, thanks a lot. That makes sense. I was testing it on my development environment and got it to work that way, but I need to package it and test
    it on my dual boot "user" environment. Thanks again for the help. I've deleted that environment variable.

    -----Original Message-----
    From: Eryk Sun <eryksun@gmail.com>
    Sent: Thursday, April 6, 2023 8:06 PM
    To: Jim Schwartz <jschwar@sbcglobal.net>
    Cc: python-list@python.org
    Subject: Re: Windows installer from python source code without access to
    source code

    On 4/6/23, Jim Schwartz <jschwar@sbcglobal.net> wrote:
    Never mind. I found it on the web. I needed to point my PYTHONPATH
    to
    sitepackages:

    In most cases an application should be isolated from PYTHON* environment variables. If you're creating a Python application or embedding Python in an application, use the embeddable distribution, and add any additional
    required sys.path directories to the included "._pth" file (e.g. "python311._pth").

    https://docs.python.org/3/library/sys_path_init.html#pth-files

    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)