question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restructure source so that individual functions can be imported w/o importing the entire source

See original GitHub issue

Right now, if you want to import just one function in bip39 you must import the entire bundle. This can add unnecessary code to already large apps, making them larger. I propose that each function be written in their own files so that they can be imported independently of one another.

My specific concerns here are the the unorm dependency and words list files, which are quite large and not required for all of these utility functions.

Note: I plan to PR this repo with this change, but am open to thoughts in the meantime 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dcousenscommented, Jun 4, 2018

ES6 exports/imports, combined with tree shaking would make this irrelevant.

I think I’d sooner recommend that path then splitting up the source code unnecessarily when it nearly fits on 1 page.

2reactions
dcousenscommented, Jun 4, 2018

FWIW, I think it is nice to have each function isolated in the source anyway purely for organizational purposes but that is just me trying to be convincing that this change is worth merging smile

In an ideal world, everything might be a module. But in an ideal world, we might not even need to write code! Alas, I think breaking this file into mini-files of 10 lines hurts maintenance for something so small, therefore, NACK for that change alone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest cannot import module while python can - Stack Overflow
I am a bit puzzled, it looks like this indicates an import error, but Python does it fine so why is there a...
Read more >
Python import: Advanced Techniques and Tips
In Python, you use the import keyword to make code in one module available in another. Imports in Python are important for structuring...
Read more >
Easier Code Organization - Beginning Elm
When we import a module without exposing anything inside it, it's called a qualified import. That means we have to prefix all functions,...
Read more >
Importing Python Functions from Other Scripts | by Katy Hagerty
Compared to the copy-and-paste method, the import method makes it much easier to reuse functions. Lines of code are not accidentally dropped. Additional...
Read more >
Programming FAQ — Python 3.11.1 documentation
Contents: Programming FAQ- General Questions- Is there a source code level debugger with ... How can I have modules that mutually import each...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found