Giter VIP home page Giter VIP logo

Comments (6)

ryanking13 avatar ryanking13 commented on June 12, 2024

when loading a package even for packages that don't need to be downloaded.

The package numpy is a part of the default distribution.

No. This is not true. NumPy is not included in the default distribution. Actually, we don't include any wheels in the npm package to reduce the size of the npm Pyodide package. Check the node_modules/pyodide directory.

Instead, we download packages on the fly in Node.js and store them in the node_modules directory (Code Pointer). So I guess that's why Deno is requesting a write access.

This is not an ideal situation, but we don't want to host hundreds of megabytes of packages in a single npm package.

from pyodide.

JanPokorny avatar JanPokorny commented on June 12, 2024

@ryanking13 Oh, right, don't know why I thought numpy was included, it's indeed cached in the node_modules folder.

But the point still stands -- even when no changes are needed, write access is requested, which does not make sense.

image

I think the culprit is some needless mkdir, given that the request is for Deno.mkdir. Most likely there's some code that creates a folder in order to ensure that the folder exists, which prompts for the write permission.

Eg. something like this:

create_folder(folder)
do_something_with_folder(folder)

...should be changed into this

if not exists(folder):
  create_folder(folder)
do_something_with_folder(folder)

from pyodide.

JanPokorny avatar JanPokorny commented on June 12, 2024

@ryanking13 I found the offending line:

await nodeFsPromisesMod.mkdir(API.config.packageCacheDir, {

Patching it out fixes the problem:
image

Adding a check here if the folder exists would prevent Deno from needlessly asking for permission. Sorry for not sending a full PR, I'm not very proficient with Node.js

from pyodide.

ryanking13 avatar ryanking13 commented on June 12, 2024

Oh, I see. That makes sense. Thanks for the detailed information @JanPokorny! I'll see if I can fix it by checking the existence of the path first.

from pyodide.

ryanking13 avatar ryanking13 commented on June 12, 2024

Fixed by @whitphx #4738.

from pyodide.

JanPokorny avatar JanPokorny commented on June 12, 2024

That's great, thank you @whitphx !

from pyodide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.