Skip to content

Adds files.getInfo / files.get_info methods to retrieve information about directory/files #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mishushakov
Copy link
Member

@mishushakov mishushakov commented May 13, 2025

Changelog

  • Adds files.getInfo, files.get_info methods to the SDKs.
  • Adds tests for the new methods
  • Adds documentation for the above.

Examples

JavaScript

import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()

// Create a new file
await sandbox.files.write('test_file.txt', 'Hello, world!')

// Get information about the file
const info = await sandbox.files.getInfo('test_file.txt')

console.log(info)
// {
//   name: 'test_file.txt',
//   type: 'file',
//   path: '/home/user/test_file.txt'
// }

Python

from e2b_code_interpreter import Sandbox

sandbox = Sandbox()

# Create a new file
sandbox.files.write('test_file', 'Hello, world!')

# Get information about the file
info = sandbox.files.get_info('test_file')

print(info)
# EntryInfo(name='test_file.txt', type=<FileType.FILE: 'file'>, path='/home/user/test_file.txt')

@mishushakov mishushakov self-assigned this May 13, 2025
@mishushakov mishushakov added the sdk Improvements or additions to SDKs label May 13, 2025
Copy link

linear bot commented May 13, 2025

Copy link

changeset-bot bot commented May 13, 2025

🦋 Changeset detected

Latest commit: b6a7fca

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/python-sdk Patch
e2b Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

Can we add more info about the file/directory?

@mishushakov
Copy link
Member Author

I'll be pushing more tests, waiting for e2b-dev/infra#655

Makefile Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

this was not working on my machine, I have my go tools installed in GOPATH

@@ -8,7 +8,7 @@ plugins:
- pyi_out=../../packages/python-sdk/e2b/envd
- name: connect-python
out: ../../packages/python-sdk/e2b/envd
path: /go/bin/protoc-gen-connect-python
path: protoc-gen-connect-python
Copy link
Member Author

Choose a reason for hiding this comment

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

I have it in my go path

@mishushakov mishushakov disabled auto-merge May 16, 2025 14:55
Copy link
Member

Wasn't there a script using container for generating this? Or that was only for SDKs?

@mishushakov
Copy link
Member Author

Was it ever merged though? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request sdk Improvements or additions to SDKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants