Skip to content

Commit

Permalink
New infra (#212)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
Co-authored-by: Vasek Mlejnsky <vasek.mlejnsky@gmail.com>
  • Loading branch information
3 people authored Nov 6, 2023
1 parent 849e641 commit 3883098
Show file tree
Hide file tree
Showing 343 changed files with 6,726 additions and 10,256 deletions.
8 changes: 8 additions & 0 deletions .changeset/quick-shoes-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@e2b/python-sdk": minor
"@e2b/sdk": minor
"@e2b/cli": minor
---

- Add possibility to use custom sandboxes
- Rename sessions to sandboxes
6 changes: 1 addition & 5 deletions .github/workflows/cli_tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Test CLI

on:
push:
paths:
- packages/cli/**/*
- .github/workflows/cli_tests.yml
workflow_call:

permissions:
Expand All @@ -30,7 +26,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/js_sdk_tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Test JS SDK

on:
push:
# Tests are already running on main before release
branches:
- '**'
- '!main'
paths:
- packages/js-sdk/**/*
- .github/workflows/js_sdk_tests.yml
workflow_call:
secrets:
E2B_API_KEY:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/python_sdk_tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: Test Python SDK

on:
push:
# Tests are already running on main before release
branches:
- '**'
- '!main'
paths:
- packages/python-sdk/**/*
- .github/workflows/python_sdk_tests.yml
workflow_call:
secrets:
E2B_API_KEY:
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ celerybeat.pid
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

Expand Down Expand Up @@ -291,4 +288,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
</h4>

<h4 align="center">
<a href="https://twitter.com/e2b_dev">
<img src="https://img.shields.io/twitter/follow/infisical?label=Follow" alt="e2b Twitter" />
</a>
<a href="https://discord.gg/U7KEcGErtQ">
<img src="https://img.shields.io/badge/chat-on%20Discord-blue" alt="Discord community server" />
</a>
<a href="https://twitter.com/e2b_dev">
<img src="https://img.shields.io/twitter/follow/infisical?label=Follow" alt="e2b Twitter" />
<a href="https://pypi.org/project/e2b/">
<img alt="Last 1 month downloads for the Python SDK" loading="lazy" width="200" height="20" decoding="async" data-nimg="1"
style="color:transparent;width:auto;height:100%" src="https://img.shields.io/pypi/dm/e2b?label=PyPI%20Downloads">
</a>

<a href="https://www.npmjs.com/package/@e2b/sdk">
<img alt="Last 1 month downloads for the Python SDK" loading="lazy" width="200" height="20" decoding="async" data-nimg="1"
style="color:transparent;width:auto;height:100%" src="https://img.shields.io/npm/dm/%40e2b/sdk?label=NPM%20Downloads">
</a>
</h4>

Expand Down
47 changes: 2 additions & 45 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
# Protocol
# E2B Docs

Protocol is a [Tailwind UI](https://tailwindui.com) site template built using [Tailwind CSS](https://tailwindcss.com) and [Next.js](https://nextjs.org).

## Getting started

To get started with this template, first install the npm dependencies:

```bash
npm install
```

Next, run the development server:

```bash
npm run dev
```

Finally, open [http://localhost:3000](http://localhost:3000) in your browser to view the website.

## Customizing

You can start editing this template by modifying the files in the `/src` folder. The site will auto-update as you edit these files.

## Global search

This template includes a global search that's powered by the [FlexSearch](https://github.com/nextapps-de/flexsearch) library. It's available by clicking the search input or by using the `⌘K` shortcut.

This feature requires no configuration, and works out of the box by automatically scanning your documentation pages to build its index. You can adjust the search parameters by editing the `/src/mdx/search.mjs` file.

## License

This site template is a commercial product and is licensed under the [Tailwind UI license](https://tailwindui.com/license).

## Learn more

To learn more about the technologies used in this site template, see the following resources:

- [Tailwind CSS](https://tailwindcss.com/docs) - the official Tailwind CSS documentation
- [Next.js](https://nextjs.org/docs) - the official Next.js documentation
- [Headless UI](https://headlessui.dev) - the official Headless UI documentation
- [Framer Motion](https://www.framer.com/docs/) - the official Framer Motion documentation
- [MDX](https://mdxjs.com/) - the official MDX documentation
- [Algolia Autocomplete](https://www.algolia.com/doc/ui-libraries/autocomplete/introduction/what-is-autocomplete/) - the official Algolia Autocomplete documentation
- [FlexSearch](https://github.com/nextapps-de/flexsearch) - the official FlexSearch documentation
- [Zustand](https://docs.pmnd.rs/zustand/getting-started/introduction) - the official Zustand documentation
The official [E2B documentation](https://e2b.dev/docs).
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"browserslist": "defaults, not ie <= 11",
"dependencies": {
"@algolia/autocomplete-core": "^1.7.3",
"@e2b/sdk": "^0.7.5",
"@e2b/sdk": "0.8.0",
"@headlessui/react": "^1.7.15",
"@headlessui/tailwindcss": "^0.2.0",
"@mdx-js/loader": "^2.1.5",
Expand Down
42 changes: 35 additions & 7 deletions apps/docs/src/app/api/cli/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { DialogAnimated } from '@/components/DialogAnimated'
import { CloudIcon, LaptopIcon, Link2Icon } from 'lucide-react'
import { Button } from '@/components/Button'
import { useSignIn } from '@/utils/useSignIn'
import { usePostHog } from 'posthog-js/react'
import { useEffect } from 'react'

type UserConfig = {
email: string
Expand All @@ -16,16 +18,20 @@ type UserConfig = {

export default function Page() {
const signIn = useSignIn()
const posthog = usePostHog()
const { user, isLoading: userIsLoading } = useUser()
const apiKey = useApiKey()
const searchParams = useSearchParams()
const searchParamsObj = Object.fromEntries(searchParams)
const { next, state } = searchParamsObj

// TODO: Consider sending back onetime code to be used to get access token
function redirectToCli() {
function redirectToCLI() {
if (!next) return
if (!(user?.email && apiKey)) return

posthog?.capture('started CLI authorization', { email: user.email })

const { email, accessToken, defaultTeamId } = user
const newUrl = new URL(next)
const searchParamsObj: UserConfig = {
Expand All @@ -38,13 +44,34 @@ export default function Page() {
window.location.href = newUrl.toString()
}

useEffect(
function sendAuthorizationStartAnalytics() {
posthog?.capture('opened CLI authorization page')
},
[posthog],
)

useEffect(
function sendAuthorizationAnalytics() {
if (state === 'success') {
posthog?.capture('successfully authorized CLI')
} else if (state === 'error') {
posthog?.capture('failed to authorize CLI', {
error: searchParamsObj.error,
})
}
},
[state, posthog, searchParamsObj.error],
)

let content
if (state === 'error') {
content = (
<>
<div className="font-bold text-red-500">Error</div>
<div>Something went wrong, please try again</div>
<pre>{searchParamsObj.error}</pre> {/* TODO: Nicer, but it should never happen */}
<pre>{searchParamsObj.error}</pre>
{/* TODO: Nicer, but it should never happen */}
</>
)
} else if (state === 'success') {
Expand Down Expand Up @@ -74,7 +101,7 @@ export default function Page() {
} else {
content = (
<>
<Button onClick={() => redirectToCli()}>
<Button onClick={() => redirectToCLI()}>
Authorize CLI to use your account
</Button>
</>
Expand All @@ -89,7 +116,8 @@ export default function Page() {
{/* https://github.com/vercel/next.js/issues/50591 */}
<DialogAnimated
open={true}
setOpen={() => {}} // intentionally prevent closing
setOpen={() => {
}} // intentionally prevent closing
>
<div className="py-6 sm:py-12">
<div className="mx-auto px-6 lg:px-8">
Expand All @@ -101,13 +129,13 @@ export default function Page() {
"
>
<span className="text-gray-200">
<LaptopIcon size={60} />
<LaptopIcon size={60}/>
</span>
<span className="text-gray-400">
<Link2Icon size={30} />
<Link2Icon size={30}/>
</span>
<span className="text-gray-200">
<CloudIcon size={60} />
<CloudIcon size={60}/>
</span>
</p>
<h2 className="mt-6 text-base font-semibold leading-7">
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/app/getting-started/api-key/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import APIKey from './APIKey'

## Use API key

To use the API key, you can:
To use the API key, you either:
- **Set the API key as the `E2B_API_KEY` environment variable**
- Or pass it directly to the `Session` constructor like this:
- Or pass it directly to the `Sandbox` constructor like this:
<CodeGroupAutoload path="api_key/api_key" isRunnable={false}/>

9 changes: 5 additions & 4 deletions apps/docs/src/app/getting-started/installation/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Libraries } from '@/components/Libraries'

# Installation

You create and control LLM sandboxes with our SDKs.
We offer SDKs for [JavaScript / TypeScript](https://www.npmjs.com/package/@e2b/sdk), and [Python](https://pypi.org/project/e2b/).

<Libraries/>
Expand All @@ -21,7 +22,7 @@ pip install e2b
## Next steps

1. [Get your API key](/getting-started/api-key)
1. [Follow the "Hello World" example](/guides/)
1. [Check out the official guides](/guides/overview)
1. [Explore the Sandbox API](/sandbox/overview)
1. [Explore integrations with AI frameworks and LLMs](/integrations/overview)
1. [Explore the Sandbox API](/sandbox/api/envs)
{/* 1. [Follow the "Hello World" example](/guides/) */}
{/* 1. [Check out the official guides](/guides/overview) */}
{/* 1. [Explore integrations with AI frameworks and LLMs](/integrations/overview) */}
Loading

1 comment on commit 3883098

@vercel
Copy link

@vercel vercel bot commented on 3883098 Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

e2b-docs – ./apps/docs

e2b-docs-git-main-e2b.vercel.app
e2b-docs.vercel.app
e2b-docs-e2b.vercel.app

Please sign in to comment.