lambda-action icon indicating copy to clipboard operation
lambda-action copied to clipboard

Does this Action update the python environment from requirements.txt?

Open jgwinner opened this issue 4 years ago • 4 comments

Hello:

The best of the Lambda's updaters, the only one I've seen that request python version.

A question though - will this install a virtual environment from requirements.txt and upload that inside the .zip file?

It wasn't clear from the docs.

jgwinner avatar Aug 24 '21 22:08 jgwinner

Ah, after running it, it looks like although the key python3.6 can be loaded, it's really just uploading whatever .zip file is in the artifact, not making it, itself.

jgwinner avatar Aug 24 '21 23:08 jgwinner

@jgwinner what are you using then to process the requirements?

w0rldart avatar Sep 30 '21 11:09 w0rldart

I basically took a shell script we used before to do the deploy, and hacked it up to work inside the runner.

This was more work than it sounds like. It took me a while to find out the location of "site packages".

          run: python -m venv venv && source venv/bin/activate &&
              pip3 install -r requirements.txt

        # activate the venv
        - name: Activate venv 
          run: . venv/bin/activate 
          # TODO would run tests here; 
          ## create zipfile


        # add our venv / dependencies to the zip
        - name: Add Dependencies to Zip file
          run: |
            mkdir -v to_deploy
            find . -name "*.py" -maxdepth 1 -exec cp {} to_deploy \;
            ls -l to_deploy
            cp -r ./venv/lib/python3.8/site-packages/* to_deploy

I don't know if this is the 'right' way, but it worked.

    == John ==

jgwinner avatar Oct 20 '21 17:10 jgwinner

Oh - we also updated to 3.8 instead of 3.6 (whew)

jgwinner avatar Oct 20 '21 17:10 jgwinner