/Repl from Repo

Repl from Repo


When I think of GitHub I imagine a vast network of people and code; a
superorganism that changed how we make software. When I was getting into
programming, starting a new project was daunting — you had to imagine and
build everything nearly from scratch. My version of code-sharing was calling my
older cousin who was going to college for CS and getting code dictated to me
over the phone. When the Internet arrived in my home town, it made hacking on new
projects so much more fun. Starting a new project, at least initially, became
about discovery:

  • I would walk to the Internet cafe and Yahoo search “vb code online”
  • There were a number of pseudo-GitHub sites that hosted Visual Basic projects
  • I’d download projects related to what I wanted to build, burn them on a CD and head back home
  • I’d run these projects, change & tinker with them, and get inspired on how to build my own

This mirrors the experience of many developers today, except, thanks to GitHub,
they have many more options and a lot smoother UX. However, one thing that has
remained the same: You still have to download projects you discover on GitHub
and figure out how to run them just to start tinkering. While easier than
walking to the Internet cafe, it’s enough friction that many people will give up.

That’s why today we’re making it easier to run repos on Repl.it. Now you can
instantly run code from a GitHub repository without the hassle of configuring a
local development environment. Simply click the import button on Repl.it or
click a run on repl.it badge, which will be coming to README files near you.

Here’s how it works

After cloning a GitHub repo into a repl we detect the run command, and
if we’re unable to do so we help the user configure a .replit file that includes
the run command information. We then help the user create a Pull Request back to
GitHub so that other users won’t have to search for the run command in the
future.

How is it possible?

At Repl.it we built multiple layers of abstractions in pursuit of minimum
configuration instant programming environments:

  1. Polygott: This is our base monster
    docker image that we hope includes most of the native dependencies necessary
    to run most projects (we’re also aiming to make this image swappable with your
    own in the future)

  2. UPM is our universal package manager that
    knows how to install packages in a number of different programming languages we
    support.

  3. Window manager: Our novel approach to window
    management allows us to reconfigure the IDE on the fly to create any number of
    environments: from web apps to command line or even data science environments.

  4. Collaborative Development Protocol
    (crosis)
    : Makes it possible for us to operate Git
    from the browser. It’s as simple as opening an exec channel and streaming
    git commands to the server.

  5. Distributed filesystem: A snapshot-based filesystem with atomic writes is
    necessary when dealing with large-scale file changes which happens when
    running git.

This is all work in progress and doesn’t give us anywhere near 100% coverage on
all GitHub repos, however, all the essential components are there and it’s a
matter of improving our infrastructure to cover more and more projects that can
be instantly run in the browser.

As much as possible, we’re building our infrastructure in the open, and with
participation from our community. If we don’t support your favorite language or
runtime, please consider contributing to Polygott and UPM.

Try it out

This feature was silently earlier this week to our community, and since then we’ve seen a lot
of excitement from both our users and repo authors when they receive a
pull-request. Here are some of our favorites so far. Just go to the repo and
click “run on repl.it” to see it in action.

  • ascii_racer is a python race game in the terminal; it’s super fun.
  • Minesweeper is a Minesweeper in C++
  • ddgr: search DuckDuckGo from your terminal
  • pycraft: 2D minecraft in Python!
  • legit: Human-friendly git utility
  • progress-bot: a discord/slack bot to
    report your anime progress on the web.
  • water.css: a super simple CSS framework.
  • snake-go: a snake implementation
    in go.

If you’d like to add it to your repo, simply import a repo and follow the
prompts. I also wrote a quick guide here.

If you have any trouble getting your repo to work, consider asking a question on our
community, or visit the #developers channel on our Discord
server
.


github + repl.it

Original Source