Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
llama.log
uv.lock

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ ENV HOST 0.0.0.0
# ^ Sets the server host to 0.0.0.0, Required for the server to be accessible outside the container

# Copy required files into container
WORKDIR /app
RUN pip install --no-cache-dir uv
RUN mkdir -p interpreter scripts
COPY interpreter/ interpreter/
COPY scripts/ scripts/
COPY poetry.lock pyproject.toml README.md ./
COPY pyproject.toml README.md ./

# Expose port 8000
EXPOSE 8000

# Install server dependencies
RUN pip install ".[server]"
RUN uv pip install --system ".[server]"

# Start the server
ENTRYPOINT ["interpreter", "--server"]
ENTRYPOINT ["interpreter", "--server"]
38 changes: 15 additions & 23 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,26 @@ We will review PRs when possible and work with you to integrate your contributio

## Running Your Local Fork

**Note: for anyone testing the new `--local`, `--os`, and `--local --os` modes: When you run `poetry install` you aren't installing the optional dependencies and it'll throw errors. To test `--local` mode, run `poetry install -E local`. To test `--os` mode, run `poetry install -E os`. To test `--local --os` mode, run `poetry install -E local -E os`. You can edit the system messages for these modes in `interpreter/terminal_interface/profiles/defaults`.**
Once you've forked the code and created a new branch for your work, you can run the fork in CLI mode by following these steps:
1. CD into the project folder by running `cd open-interpreter`.
2. Install `poetry` [according to their documentation](https://python-poetry.org/docs/#installing-with-pipx), which will create a virtual environment for development + handle dependencies.
3. Install dependencies by running `poetry install`.
4. Run the program with `poetry run interpreter`. Run tests with `poetry run pytest -s -x`.
**Note: optional dependencies for the `--local`, `--os`, and `--local --os` modes are not installed by default. Use `uv sync --extra local`, `uv sync --extra os`, or `uv sync --extra local --extra os` to include them. You can edit the system messages for these modes in `interpreter/terminal_interface/profiles/defaults`.**

Once you've forked the code and created a new branch for your work, you can run the fork in CLI mode by following these steps:

1. CD into the project folder by running `cd open-interpreter`.
2. Install `uv` [according to their documentation](https://docs.astral.sh/uv/getting-started/installation/).
3. Install dependencies (including dev tools) with `uv sync --group dev`. Add `--extra <name>` flags if you need optional extras.
4. Run the program with `uv run interpreter`. Run tests with `uv run pytest -s -x`.

**Note**: This project uses [`black`](https://black.readthedocs.io/en/stable/index.html) and [`isort`](https://pypi.org/project/isort/) via a [`pre-commit`](https://pre-commit.com/) hook to ensure consistent code style. If you need to bypass it for some reason, you can `git commit` with the `--no-verify` flag.

### Installing New Dependencies

If you wish to install new dependencies into the project, please use `poetry add package-name`.

### Installing Developer Dependencies

If you need to install dependencies specific to development, like testing tools, formatting tools, etc. please use `poetry add package-name --group dev`.

### Known Issues

For some, `poetry install` might hang on some dependencies. As a first step, try to run the following command in your terminal:

`export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring`

Then run `poetry install` again. If this doesn't work, please join our [Discord community](https://discord.gg/6p3fD6rBVm) for help.

## Code Formatting and Linting
If you wish to install new dependencies into the project, please use `uv add package-name`.

### Installing Developer Dependencies

If you need to install dependencies specific to development, like testing tools, formatting tools, etc. please use `uv add package-name --group dev`.

## Code Formatting and Linting

Our project uses `black` for code formatting and `isort` for import sorting. To ensure consistency across contributions, please adhere to the following guidelines:

Expand Down
44 changes: 29 additions & 15 deletions interpreter/core/utils/system_debug_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from importlib.metadata import version, PackageNotFoundError
from importlib.metadata import distributions
from packaging.requirements import Requirement
from packaging.version import Version
import psutil
import toml

Expand Down Expand Up @@ -53,27 +55,39 @@ def get_ram_info():
def get_package_mismatches(file_path="pyproject.toml"):
with open(file_path, "r") as file:
pyproject = toml.load(file)
dependencies = pyproject["tool"]["poetry"]["dependencies"]
dev_dependencies = pyproject["tool"]["poetry"]["group"]["dev"]["dependencies"]
dependencies.update(dev_dependencies)

project_dependencies = pyproject.get("project", {}).get("dependencies", [])
dev_dependencies = pyproject.get("dependency-groups", {}).get("dev", [])

requirements = []
unparsable = []
for raw_requirement in project_dependencies + dev_dependencies:
try:
requirements.append(Requirement(raw_requirement))
except Exception:
unparsable.append(raw_requirement)

installed_packages = {
dist.metadata["Name"].lower(): dist.version
for dist in distributions()
}
mismatches = []
for package, version_info in dependencies.items():
if isinstance(version_info, dict):
version_info = version_info["version"]
installed_version = installed_packages.get(package)
if installed_version and version_info.startswith("^"):
expected_version = version_info[1:]
if not installed_version.startswith(expected_version):
mismatches.append(
f"\t {package}: Mismatch, pyproject.toml={expected_version}, pip={installed_version}"
)
else:
mismatches.append(f"\t {package}: Not found in pip list")
for requirement in requirements:
installed_version = installed_packages.get(requirement.name.lower())
if not installed_version:
mismatches.append(f"\t {requirement.name}: Not found in pip list")
continue

if requirement.specifier and not requirement.specifier.contains(
Version(installed_version), prereleases=True
):
mismatches.append(
f"\t {requirement.name}: Mismatch, pyproject.toml={requirement.specifier}, pip={installed_version}"
)

mismatches.extend(
[f"\t {requirement}: Unable to parse requirement" for requirement in unparsable]
)

return "\n" + "\n".join(mismatches)

Expand Down
Loading
Loading