Skip to content

Consider minifying json shipped in package #1967

@SimonSchick

Description

@SimonSchick

tl;dr we are deploying the SDK to aws lambdas and ran into a scenario where our primary layer became too large, initially we just stripped individual json files from discovery_cache/documents since this is by far the largest culprit (according to ncdu).

I also noticed that all of these definitions are actually pretty printed json.

I'm suggesting 2 things:

  1. Ship a utility to select (and delete other) json definitions that the user wants to use in a deployment.
  2. Minify all json contents (see trivial script below), this reduced the package size (on disk) by approximately 20mb (and probably also improves load times although I did not test for that).
fs.readdirSync('.').forEach(f => {
  const data = JSON.parse(fs.readFileSync(f, 'utf8'));
  fs.writeFileSync(f, JSON.stringify(data));
  console.log('processed', f);
});

Environment details

  • OS type and version: irrelevant
  • Python version: 3.9
  • pip version: 22.2.2
  • google-api-python-client version: 2.64.0

Steps to reproduce

  1. Install package
  2. 72mb via ncdu

Code example

n/a

Stack trace

n/a

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close