Home > front end >  How to install module from Github repo in pyscript?
How to install module from Github repo in pyscript?

Time:01-13

I want to import module from github repo in my pyscript.

From this command link -

pip install --upgrade --no-cache-dir git https://github.com/StreamAlpha/tvdatafeed.git

So that I can use this code in my pyscript code-

from tvDatafeed import TvDatafeed, Interval

username = 'YourTradingViewUsername'
password = 'YourTradingViewPassword'

tv = TvDatafeed(username, password)

CodePudding user response:

Check first if this is an import case issue, as reported i StreamAlpha/tvdatafeed issue 94:

You can bypass pip by installing via Git using the second command under the installation section.
If you go this route, you’ll need to change your import statement from using tvdatafeed to tvDatafeed

edit:

pip install --upgrade --no-cache-dir git https://github.com/StreamAlpha/tvdatafeed.git 

So in your case:

from tvDatafeed import tvDatafeed, Interval
                       ^^^^^^^^^^

CodePudding user response:

That's a good question. Feel free to track it under pyscript's github. I don't think that's possible because we're currently relying on Pyodide's packaging system and I don't know deep implementation details, but as far as I understand only pure python packages whatever they ported manually currently works... I guess one thing you could do is manually create a package yourself. Can I "fake" a package (or at least a module) in python for testing purposes? But! It's a lot of work unfortunately. You can also reach out to the author and let them know it's not working on pypi and/or offer to maintain the package yourself! Cheers and if still in doubt feel free to join pyscript channels: https://github.com/pyscript/pyscript-collective#resources

  • Related