Share your repls and programming experiences

← Back to all posts
Import other repls!
h
21natzil (1176)

Through the power of a new module I made called rimp, you can import your repls and other people's repls in python.

https://storage.googleapis.com/replit/images/1545860515746_202d14fe853df63097cffa34081367ae.pn

  • If you want to see an example of how to use rimp, see below.
  • If you want to see the source or know how to make your repl compatible with importing, click here
Comments
hotnewtop
Scoder12 (834)

@21natzil couldn't you put beautifulsoup4 and requests as dependencies in your pypi module?

21natzil (1176)

@Scoder12 I thought they were... I'll check on that.

Scoder12 (834)

@21natzil Well I mean if they are people dont need to put them in requirements.txt

leonardofalc12 (0)

um it doesn't work, and this is the error I got:

Repl.it: Updating package configuration

--> python3 -m poetry add rimp
Using version ^0.0.4 for rimp

Updating dependencies
Resolving dependencies...

Writing lock file


Package operations: 1 install, 0 updates, 0 removals

  - Installing rimp (0.0.4)

[EnvCommandError]
Command ['/opt/virtualenvs/python3/bin/pip', 'install', '--no-deps', 'rimp==0.0.4'] errored with the following return code 1, and output: 
Collecting rimp==0.0.4
  Downloading https://files.pythonhosted.org/packages/04/58/15b3592785a8bf5b5d19dfb98bf75477860e545d2f6932daba8c0e46e239/rimp-0.0.4.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /opt/virtualenvs/python3/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1g7w40ft/rimp/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1g7w40ft/rimp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-1g7w40ft/rimp/pip-egg-info
         cwd: /tmp/pip-install-1g7w40ft/rimp/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-1g7w40ft/rimp/setup.py", line 7, in <module>
        with open('requirements.txt') as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

exit status 1

I thought maybe I should simply import rimp instead of searching for rimp in the package tab, but it still displayed the same error.

TLD99 (0)

Traceback (most recent call last):
File "main.py", line 2, in <module>
import rimp
File "/home/runner/.local/lib/python3.6/site-packages/rimp/init.py", line 4, in <module>
from rimp.fetcher import collect_files
File "/home/runner/.local/lib/python3.6/site-packages/rimp/fetcher.py", line 4, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

After I import my stuff it raised this error above.
Is it broken?

21natzil (1176)

@TLD99 Go to the package installer on repl.it, and add the following packages, in addition to rimp and the ones you're using: bs4 and requests. That should resolve the issue.

Saibot84 (45)

@21natzil Hmm. I'm also getting an error when I try to use it. Any advice?

Example: https://repl.it/@Saibot84/RIMPTest

Traceback (most recent call last): File "main.py", line 8, in <module> rimp.load_repl("21natzil", "Permissions") File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/__init__.py", line 21, in load_repl for file_path, contents in collect_files(name, project): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/fetcher.py", line 47, in collect_files repl_meta = get_details(name, project) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/fetcher.py", line 20, in get_details script = soup.find_next("script").string.split('\n')[1][26:] IndexError: list index out of range

olafh10 (31)

Nice! I absolutely love it 👍

JerryTheMouse (4)

I feel like you should make the set up more user friendly

HappyFakeboulde (237)

Very good
Have an upvote

Nayoar (563)

This is really cool and definitely very useful, but there isn't really any sort of explanation on how to set it up... pls could you make a tutorial for that, or comment in the Permissions repl?

21natzil (1176)

@minx28 Good idea, however the link I provided in the post might be helpful.

JayBFC (28)

Nice idea! Not tested it but i will do at some point. Sounds awesome!

And let me guess, rimp is short for "repl import"?

JayBFC (28)

@21natzil Lol i knew it. Will try this out soon, maybe not today (27th of December) because I will be busy for the whole day

SamuelLarsen (0)

@JayBFC 27th of December of which year?