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.

Advised way of importing libraries

See original GitHub issue

I was wondering how you can import libraries other than the ones imported by default by Belay. I’ve made a @device.task def setup(): function which works well, but is that the intended way? As a side note I’m awaiting Micropython v1.20 which includes mip (so you should be able to install using mip install <package> if I’ve understood correctly). Maybe it would be a nice addition to have a “installing and importing libraries” section in the documentation?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
roaldarbolcommented, Nov 17, 2022

The package manager is already dawning on me. I really really like it! However, I’m a bit confused by:

Belay assumes your project contains a python-package with the same name as tool.belay.name located in the root of your project.

Does that mean you cannot have just a pyproject.toml file, the python script and nothing else in a repo? (except for the autogenerated .belay-lib).

Edit: I’ll make a separate issue for discussion of the package manager.

0reactions
BrianPughcommented, Nov 29, 2022

@roaldarbol checkout #54 and provide feedback in the PR. I’m going to close this issue for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python import: Advanced Techniques and Tips
While it's a good idea to separate scripts and libraries, all Python files can be both executed and imported.
Read more >
How to import a library in Python – with example - CodeBerry
In this article, you'll learn how to import a library in Python. ... There are a number of ways we can install various...
Read more >
Importing modules in Python - best practice - Stack Overflow
Imports should usually be on separate lines, e.g.: · Imports are always put at the top of the file, just after any module...
Read more >
How to Import All Python Libraries With One Line of Code
You import libraries, use some of them, and start working. ... These options should work the same way, but you know, Python can...
Read more >
How to import modules, packages, functions, etc. in Python
In Python, you can import the standard library, packages installed with pip, your own packages, and so on, with the import statement.5.
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