Skip to content

slimPatterns with botocore #453

@revmischa

Description

@revmischa

I'm trying to tell SLSPR to not package up parts of botocore because I don't need to make calls to the services. I tried:

  pythonRequirements:
    dockerizePip: false
    slim: true
    slimPatterns:
      # we don't need to call these services so let's not include the botocore metadata
      # it takes up a lot of space
      - "**/botocore/data/ec2/**"
      - "data/cloudfront/**"
      - "**/data/rds/**"

But ec2, cloudfront, and rds are all present in the package. What am I doing wrong?
Using latest plugin/serverless.

Activity

bsamuel-ui

bsamuel-ui commented on Feb 18, 2020

@bsamuel-ui
Contributor

Yeah, unfortunately, file globs in SPR are as horribly broken as every other tool I've seen that uses globs. I always have to hunt down the code running the glob and put print statements in.

Looking at my slim patterns file... You should drop the trailing /** because it will match directories correctly.

You shouldn't need to match **/botocore either, botocore should be at the root of your package. My slim patterns simply have entires like:

    - botocore/data/ec2

**/*.ext works, though, as does path/*/dir.

(FWIW, I stuck them in a separate file because I banned a ton of crap. A lot of python modules carry tests with them, for instance.)

revmischa

revmischa commented on Feb 19, 2020

@revmischa
Author

I have exactly this

  pythonRequirements:
    dockerizePip: false
    slim: true
    slimPatterns:
      - botocore/data/ec2
      - botocore/data/cloudfront
      - botocore/data/rds
      - botocore/data/iam
      - botocore/data/s3

but I still see all of them except ec2 in the package :(

added and removed
waiting-on-responseIf an issue goes without response for a while, close it.
on Feb 20, 2020
chehodgins

chehodgins commented on Nov 4, 2021

@chehodgins

This also wasn't working for me until I added useStaticCache: false so that the dependencies could be rebuilt:

pythonRequirements:
    useStaticCache: false
    dockerizePip: true
    slim: true
    slimPatterns:
      - botocore/data/ec2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chehodgins@revmischa@miketheman@bsamuel-ui

        Issue actions

          slimPatterns with botocore · Issue #453 · serverless/serverless-python-requirements