How to package python3 modules for google app engine











up vote
3
down vote

favorite












I'm trying to figure out how to add a internal package to a Google App Engine deployment with Python 3 (standard).



For Python 2 the way to package modules was using a local lib/ folder and appengine_config.py. This seems not to work anymore for Python 3? At least my app cannot find modules which are in the lib/ folder.



For Python 3 it's possible to just pip3 install -t . the package. But this gets really messy as all packages are just installed in the app root and will also be added to the git repository of our app.



We cannot use requirements.txt as the module is internal and will not be available on PyPI.



Is there another way to package modules for Google App Engine using Python 3?










share|improve this question
























  • Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
    – Dan Cornilescu
    Nov 19 at 18:12

















up vote
3
down vote

favorite












I'm trying to figure out how to add a internal package to a Google App Engine deployment with Python 3 (standard).



For Python 2 the way to package modules was using a local lib/ folder and appengine_config.py. This seems not to work anymore for Python 3? At least my app cannot find modules which are in the lib/ folder.



For Python 3 it's possible to just pip3 install -t . the package. But this gets really messy as all packages are just installed in the app root and will also be added to the git repository of our app.



We cannot use requirements.txt as the module is internal and will not be available on PyPI.



Is there another way to package modules for Google App Engine using Python 3?










share|improve this question
























  • Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
    – Dan Cornilescu
    Nov 19 at 18:12















up vote
3
down vote

favorite









up vote
3
down vote

favorite











I'm trying to figure out how to add a internal package to a Google App Engine deployment with Python 3 (standard).



For Python 2 the way to package modules was using a local lib/ folder and appengine_config.py. This seems not to work anymore for Python 3? At least my app cannot find modules which are in the lib/ folder.



For Python 3 it's possible to just pip3 install -t . the package. But this gets really messy as all packages are just installed in the app root and will also be added to the git repository of our app.



We cannot use requirements.txt as the module is internal and will not be available on PyPI.



Is there another way to package modules for Google App Engine using Python 3?










share|improve this question















I'm trying to figure out how to add a internal package to a Google App Engine deployment with Python 3 (standard).



For Python 2 the way to package modules was using a local lib/ folder and appengine_config.py. This seems not to work anymore for Python 3? At least my app cannot find modules which are in the lib/ folder.



For Python 3 it's possible to just pip3 install -t . the package. But this gets really messy as all packages are just installed in the app root and will also be added to the git repository of our app.



We cannot use requirements.txt as the module is internal and will not be available on PyPI.



Is there another way to package modules for Google App Engine using Python 3?







python-3.x google-app-engine google-app-engine-python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 16:59









Dustin

2,3941124




2,3941124










asked Nov 19 at 15:12









Carsten Rietz

334




334












  • Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
    – Dan Cornilescu
    Nov 19 at 18:12




















  • Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
    – Dan Cornilescu
    Nov 19 at 18:12


















Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
– Dan Cornilescu
Nov 19 at 18:12






Try placing the package's directory right under the top level service directory rather than under lib, side-by-side with with the app.yaml file. From GAE's perspective this should appear just like another package of your app code. Not sure if just symlinking the directory from somewhere else would work like in the 1st generation (python 2.7) standard environment (see stackoverflow.com/a/34291789/4495081) to avoid copying the package
– Dan Cornilescu
Nov 19 at 18:12














1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










The Python 3.7 Standard runtime is an "idiomatic" Python runtime, which means it doesn't automatically add the special lib directory to the search path for modules.



You should continue "vendoring" your private modules into a lib directory, but you'll need to make a change to how you import them.



If your private package is foobar, and you've done pip install -t lib foobar, then in your project, instead of:



import foobar


you do:



import lib.foobar


(You'll also need to add an empty __init__.py file to your lib directory, to make it a module.)






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377560%2fhow-to-package-python3-modules-for-google-app-engine%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    The Python 3.7 Standard runtime is an "idiomatic" Python runtime, which means it doesn't automatically add the special lib directory to the search path for modules.



    You should continue "vendoring" your private modules into a lib directory, but you'll need to make a change to how you import them.



    If your private package is foobar, and you've done pip install -t lib foobar, then in your project, instead of:



    import foobar


    you do:



    import lib.foobar


    (You'll also need to add an empty __init__.py file to your lib directory, to make it a module.)






    share|improve this answer



























      up vote
      3
      down vote



      accepted










      The Python 3.7 Standard runtime is an "idiomatic" Python runtime, which means it doesn't automatically add the special lib directory to the search path for modules.



      You should continue "vendoring" your private modules into a lib directory, but you'll need to make a change to how you import them.



      If your private package is foobar, and you've done pip install -t lib foobar, then in your project, instead of:



      import foobar


      you do:



      import lib.foobar


      (You'll also need to add an empty __init__.py file to your lib directory, to make it a module.)






      share|improve this answer

























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        The Python 3.7 Standard runtime is an "idiomatic" Python runtime, which means it doesn't automatically add the special lib directory to the search path for modules.



        You should continue "vendoring" your private modules into a lib directory, but you'll need to make a change to how you import them.



        If your private package is foobar, and you've done pip install -t lib foobar, then in your project, instead of:



        import foobar


        you do:



        import lib.foobar


        (You'll also need to add an empty __init__.py file to your lib directory, to make it a module.)






        share|improve this answer














        The Python 3.7 Standard runtime is an "idiomatic" Python runtime, which means it doesn't automatically add the special lib directory to the search path for modules.



        You should continue "vendoring" your private modules into a lib directory, but you'll need to make a change to how you import them.



        If your private package is foobar, and you've done pip install -t lib foobar, then in your project, instead of:



        import foobar


        you do:



        import lib.foobar


        (You'll also need to add an empty __init__.py file to your lib directory, to make it a module.)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 20 at 13:32

























        answered Nov 19 at 17:27









        Dustin

        2,3941124




        2,3941124






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377560%2fhow-to-package-python3-modules-for-google-app-engine%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen