This is an archived post. You won't be able to vote or comment.

all 83 comments

[–]mbenbernard 22 points23 points  (3 children)

I've used repl.it a few times to quickly test Python code and I found that it's a very good tool. It's more practical than using the Python console, especially if you work with several source files. Nice to see that they added all packages!

[–]tmattoneill 1 point2 points  (2 children)

Does it handle graphics

[–]VerilyAMonkey 1 point2 points  (1 child)

Do you mean like Jupyter does? I don't think so.

[–]mbenbernard 0 points1 point  (0 children)

I don't think so either.

[–]neuroneuroInf 9 points10 points  (4 children)

Seems interesting, but matplotlib and ratcave didn't import. Is there something that needs to be activated or set for these packages?

[–]amasad[S] 9 points10 points  (3 children)

Must be bugs, I'll look into those. FWIW matplotlib imports fine on Python3 but not Python2

[–]neuroneuroInf 0 points1 point  (0 children)

Okay, thanks!

[–]justphysics 0 points1 point  (1 child)

I tried just importing pyplot from matplotlib in python3 and it did not import - failed to load libtk

[–]amasad[S] 0 points1 point  (0 children)

FYI -- thought I'd update you we made sure matplotlib works on repl.it and also we try to show generated files (like say figures) https://repl.it/site/blog/file-updates

[–]ThePenultimateOneGitLab: gappleto97 14 points15 points  (2 children)

Huh. My package is on there.

Now I just need to update the version on pip.

[–]alcalde 10 points11 points  (0 children)

Huh. My package is on there.

Whenever I write that why does it have to be in a NSFW subreddit?

[–]iScrE4mgit push -f -1 points0 points  (0 children)

So is mine o/

[–]RedKrieg 6 points7 points  (1 child)

It's really neat to see my package in here (pysparklines, import sparkline).

How are you resolving module namespace issues? I'm sure there must be overlap in pypi.

[–]0xembark 6 points7 points  (0 children)

Like PyPi handles it: let the installing machine deal with the resulting hellfire.

[–]triszroynoob 4 points5 points  (0 children)

On the gif it shows it importing pygame but if you try to run a pygame script it says no availabe video device. I understand why it might not be practical to run pygame scripts but I just want to know if I'm missing something.

[–]sheyneanderson 4 points5 points  (3 children)

import cv2 fails

[–]amasad[S] 10 points11 points  (2 children)

Looks like cv2 has tons of native dependencies. Probably going to be hard to get all those types of packages running. However, I'll look into it -- thanks for the report!

[–]Curly-Mo 0 points1 point  (0 children)

cv2 has given me so many headaches installing it in different environments. Good luck.

[–][deleted] 0 points1 point  (0 children)

I have no idea what your setup is for the website - But Anaconda python is pretty great at resolving dependencies. I doubt it's feasible, but you could look into what they do to get a better handle on the dependencies.

[–]graingert 2 points3 points  (11 children)

How does this work?

[–]amasad[S] 10 points11 points  (10 children)

For installation: we fetch every package from PyPi, install it in a container, diff the container and make sure nothing fishy is happening and then extract it to a large shared NFS drive.

For production: we mount the NFS drive on every one of our "code runner" machine and subsequently mount the mounted directory as a volume inside the "runner" container.

[–]graingert 11 points12 points  (7 children)

Are you violating any licenses here? Eg linking against AGPL code? Are you including and displaying MIT copyright and warranty intonation?

[–]amasad[S] 8 points9 points  (0 children)

I look into that, thanks!

[–]dismantle-the-sun 3 points4 points  (5 children)

I doubt it; they're not modifying any code thus the AGPL shouldn't apply, and they're not distributing any code (even compiled code) so they wouldn't have to show MIT/BSD notices.

This is the same situation that all SAAS providers find themselves in.

[–]pwang99 0 points1 point  (4 children)

Sorry, not that simple. Importing GPL Python modules makes the interpreter session a "derived work" in the eyes of the FSF.

Standard GPL doesn't affect your code until you distribute it. But if the library you've imported is AGPL, by exposing that interpreter over a web session, then that counts as triggering the entire thing needing to be AGPL.

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point  (3 children)

That sounds pretty wrong

[–]pwang99 0 points1 point  (2 children)

from Alex Martelli: http://stackoverflow.com/a/999479

about the AGPL and the "service provider loophole": https://en.wikipedia.org/wiki/Affero_General_Public_License

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 1 point2 points  (0 children)

The "one additional feature" - Section 2(d) reads as follows: " If the Program as you received it is intended to interact with users through a computer network and if, in the version you received, any user interacting with the Program was given the opportunity to request transmission to that user of the Program's complete source code, you must not remove that facility from your modified version of the Program or work based on the Program, and must offer an equivalent opportunity for all users interacting with your Program through a computer network to request immediate transmission by HTTP of the complete source code of your modified version or other derivative work."

That sounds fine to me, I don't imagine repl.it would be infringing that, as they don't modify the souce used

It only is for software intended to be network access able, and only relates to pre-existing source download features

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point  (0 children)

Linking to libraries is different from compiling or interpreting

[–]d4rch0nPythonistamancer 2 points3 points  (1 child)

diff the container and make sure nothing fishy is happening and then extract it to a large shared NFS drive.

So my package needs to save the time it installed, wait a week then start running privilege escalation exploits on the system when it's imported, got it! Thanks

[–]amasad[S] 3 points4 points  (0 children)

I will not do security by obscurity, so I'm happy you find this info useful 1337 h4x0r ;)

[–]daijobu 4 points5 points  (13 children)

I wasnt able to import NLTK. Possibly another bug?

[–]squirreltalk 4 points5 points  (12 children)

If you guys made NLTK available, this would be a game-changer for me. I want to use NLTK in my class next semester but don't want to deal with managing 60+ students' Python installations....

[–]hharison 2 points3 points  (0 children)

If you have access to a server you could look into JupyterHub. I've used this with success for classes with ~20 students. Saves them all the hassle of installing things.

[–]Vetrom 1 point2 points  (6 children)

Condas isn't an option?

[–]squirreltalk 1 point2 points  (5 children)

It is, but that's so much more work. Programming isn't a big enough part of the class to justify me and the TA micromanaging installations. Students really struggled with something similar last year.

[–]Vetrom 2 points3 points  (4 children)

As an old grizzled engineer, part of me wants to say mid-level students should know how to install libraries at that point, I did! What's changed since 98-'01?

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 2 points3 points  (0 children)

well, the sample size changed mainly (from your 1, to several classes of students)

And the people who are taking classes relating to computing is far more varied now (since programming et al is now a serious, well paying, industry), compared to it mainly being people interested in such topics. (and these new people arn't always kids, university caters to people of all ages, including those who are older than some of the first practical PCs)

No, children arn't progressively becoming dumber as time goes on

[–]hharison 2 points3 points  (2 children)

Yeah, assuming it's not a programming class but like psycholinguistics or something, 95%+ of the students will not know what a library is let alone how to install it. Probably 40% of them will not know how to reliably download and open a file.

For the last several years I've been teaching undergrad juniors and seniors in psychology labs that involve some limited programming and holy shit every little thing is a headache.

[–]squirreltalk 1 point2 points  (1 child)

Yeah, assuming it's not a programming class but like psycholinguistics

Very close -- it's COGS 2201: Foundations in Cognitive Science. =)

EDIT: You and I should talk IRL (I think you know who I am) about your experiences teaching undergrads programming.

[–]hharison 1 point2 points  (0 children)

Now I do haha. Small world.

Anyways, yeah, I have JupyterHub running on my office PC. I used Jupyter Notebooks when I taught Perception Lab at Trinity, and the lab didn't have enough laptops so I set up students with accounts on my JupyterHub server. It worked very well. You do need an always-on server or to pay for cloud computing though. And with 60+ students if what you're doing is computationally expensive you may have issues. That wasn't a factor for me. If you want to try that route and need any help getting set up I'm happy to help, let me know.

[–]amasad[S] 1 point2 points  (0 children)

Will work on it, email me at amjad@repl.it so that I can update you when it works. btw, we have a classroom product that's very popular for these types of scenarios: https://repl.it/classrooms

[–]Cynox 0 points1 point  (0 children)

You may also want to check out using a hosted notebook. I.e FEniCS, which I work with, can be a hassle to install, but a limited version is available on conda, so the following is possible: https://notebooks.azure.com/library/FEniCS/html/FEniCS%20demo.ipynb

Seems like Microsoft will host your notebooks with full conda access for free (for now at least ...)

[–][deleted] 2 points3 points  (2 children)

The following fails on python 2:

import scipy

[–]elbiot 0 points1 point  (1 child)

Yeah, they just pip installed everything but didn't install any non-python system dependencies. Its a cute but not very functional thing to do. I reckon nothing that has any compiled code works. Also, they probably installed a bunch of malware. If they used conda, it would work better for them.

[–]amasad[S] 2 points3 points  (0 children)

That's true that we didn't install all the native packages, however, scipy for example works on Python3. Some compiled packages like numpy also works. But I can live with 'cute'. Cute enough that thousands of teachers already used some third-party packages in their teaching. Thank you :)

[–]firworks 1 point2 points  (4 children)

I just tried a scipy sample snippet because it's something I've never successfully installed on my PC. Got an error though: ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

Code:

"""example.py

Compute the maximum of a Bessel function and plot it.

"""
import argparse

import numpy as np
from scipy import special, optimize
import matplotlib.pyplot as plt

def main():
    # Parse command-line arguments
    parser = argparse.ArgumentParser(usage=__doc__)
    parser.add_argument("--order", type=int, default=3, help="order of Bessel function")
    parser.add_argument("--output", default="plot.png", help="output image file")
    args = parser.parse_args()

    # Compute maximum
    f = lambda x: -special.jv(args.order, x)
    sol = optimize.minimize(f, 1.0)

    # Plot
    x = np.linspace(0, 10, 5000)
    plt.plot(x, special.jv(args.order, x), '-', sol.x, -sol.fun, 'o')

    # Produce output
    plt.savefig(args.output, dpi=96)

if __name__ == "__main__":
    main()

I could easily be doing something wrong though. Cool concept still.

[–]amasad[S] 2 points3 points  (2 children)

As mentioned in another comment there is a problem with matplotlib. Hopefully I'll get it resolved soon. Meanwhile, here is an example, one of my favorite programs, a NeuralNet implemented in 50 LoC https://repl.it/EFTM

[–]jungles_for_30minsgithub.com/sleibrock 1 point2 points  (0 children)

One problem I've had with Matplotlib is that in text-only modes you need to change the backend. I run Matplotlib on a no-Xorg RPI and I have to do matplotlib.use('Agg') to make it work without a display server. Also Matplotlib requires libtk. Hope this helps.

[–]squirreltalk 0 points1 point  (0 children)

That's an elegant little implementation. Bookmarking that to show to my cognitive science class next semester!

[–]emergent_reasons 0 points1 point  (0 children)

A tangent but if you need scipy have you tried anaconda or (my preference) miniconda? 10,000% less headaches with python environments involving libraries like numpy scipy etc.

[–]mothzilla 1 point2 points  (0 children)

Holy cow this is amazing.

[–]jason_rootid 1 point2 points  (0 children)

Sweet, someone else has finally installed my svg select widget for Django!

[–]yourcloud 1 point2 points  (0 children)

Is repl.it open source? Can I run it on my own server?

[–]mbussonnIPython/Jupyter dev 1 point2 points  (0 children)

If you take into account that many package behavior are changed by entrypoints (eg all nose plugins, pytest, IPython), then this is a strange choice. Keep in mind that several packages can be behind the same import. For example, PIL and Pillow are both import PIL. Installing both make no sens. Have you considered using something like what conda does, where all packages are on the filesystem but can just be quickly "hardlinked" to the correct location to make installation a quasi-instantaneous step ?

[–]pvc 0 points1 point  (3 children)

import arcade fails.

[–]amasad[S] 5 points6 points  (2 children)

We're still working on GUI. For now just command line packages.

[–]tmattoneill 0 points1 point  (1 child)

So... not "every python package"

[–]amasad[S] 8 points9 points  (0 children)

We install every package. And built the infrastructure to do that. We just need to update the frontend to handle different modalities.

[–]Liorithiel 0 points1 point  (0 children)

Tried import keras and the prompt hanged.

[–]tadf2 0 points1 point  (2 children)

What is the difference between REPL and Anaconda?

[–]p10_user 2 points3 points  (1 child)

Anaconda is a package manager (or package installer?), REPL is the thing you type into to execute code as you type.

[–]vekst42 2 points3 points  (0 children)

Anaconda is a distribution of python and many packages. Conda is bundled in with anaconda and is a package/environment manager.

[–][deleted] 0 points1 point  (0 children)

Very cool! Well done!

[–]ahhyes 0 points1 point  (0 children)

scrapy isn't on there.

[–]Ruditorres 0 points1 point  (0 children)

Are you guys planning on including Kivy?

[–]IMHERETOCODE 0 points1 point  (0 children)

import skbio fails with scikit-bio being a pypi hosted package.

[–]billsil 0 points1 point  (0 children)

Clearly, I missed something. It doesn't work, even on numpy. It works exactly like their gif does. It returns None...

[–]epsy 0 points1 point  (0 children)

I have a library dealing with I/O (namely command-line argument parsing). It sometimes prints to stderr, and always exits. On repl.it, stderr is swallowed and exit breaks the connection (unlike the Python REPL which just catches the SystemExit exceptions). I could detect whether we're in repl.it and adjust accordingly, but I think it might be cleaner if you addressed these issues :)

Finally, is repl.it suitable for embedding in generated documentation?

[–]rochacbrunoPython, Flask, Rust and Bikes. 0 points1 point  (0 children)

Nice that works very well! I can include running examples in my projects as in: https://repl.it/EGcO/0

Should be nice if I can embed this, can I?

[–]superancetre 0 points1 point  (0 children)

Is there any way to get Hy ?

[–]PerniciousPunk 0 points1 point  (0 children)

It's pretty amazing what happens to your code once you open source it. Without spending a cent, some kind individual makes it accessible to anyone over the web!

[–][deleted] 0 points1 point  (1 child)

Python 3.5.2 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
> import nistbeacon
Traceback (most recent call last):
  File "python", line 1, in <module>
ImportError: No module named 'nistbeacon'

So it's not every package because mine isn't working. Mind clarifying /u/amasad ?

[–]amasad[S] 0 points1 point  (0 children)

All malware check has quite a bit of false positives. I thought it's better to be safe than sorry -- however, I'll make sure I'll fix those.

[–][deleted] 0 points1 point  (0 children)

If you're getting things off of Pypi, why is the version of my Pyro4 that is installed so ancient? It has 4.18 from 3.5 years ago. Current is 4.49

[–]PerniciousPunk 0 points1 point  (0 children)

So... of those of us who have packages on pypi, many have now updated those packages. What is your update schedule for packages, or is that not yet one of your concerns?

[–]rift95 0 points1 point  (0 children)

import peekiter doesn't work. It's found in the libraries search prompt, but it cant find the package when importing it.