Skip to content

Commit 85b0f2d

Browse files
committed
codex
1 parent 671698d commit 85b0f2d

File tree

5 files changed

+134
-10275
lines changed

5 files changed

+134
-10275
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ ENV HOST 0.0.0.0
1212
# ^ Sets the server host to 0.0.0.0, Required for the server to be accessible outside the container
1313

1414
# Copy required files into container
15+
WORKDIR /app
16+
RUN pip install --no-cache-dir uv
1517
RUN mkdir -p interpreter scripts
1618
COPY interpreter/ interpreter/
1719
COPY scripts/ scripts/
18-
COPY poetry.lock pyproject.toml README.md ./
20+
COPY pyproject.toml README.md ./
1921

2022
# Expose port 8000
2123
EXPOSE 8000
2224

2325
# Install server dependencies
24-
RUN pip install ".[server]"
26+
RUN uv pip install --system ".[server]"
2527

2628
# Start the server
27-
ENTRYPOINT ["interpreter", "--server"]
29+
ENTRYPOINT ["interpreter", "--server"]

docs/CONTRIBUTING.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,26 @@ We will review PRs when possible and work with you to integrate your contributio
2929

3030
## Running Your Local Fork
3131

32-
**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`.**
33-
34-
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:
35-
36-
1. CD into the project folder by running `cd open-interpreter`.
37-
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.
38-
3. Install dependencies by running `poetry install`.
39-
4. Run the program with `poetry run interpreter`. Run tests with `poetry run pytest -s -x`.
32+
**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`.**
33+
34+
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:
35+
36+
1. CD into the project folder by running `cd open-interpreter`.
37+
2. Install `uv` [according to their documentation](https://docs.astral.sh/uv/getting-started/installation/).
38+
3. Install dependencies (including dev tools) with `uv sync --group dev`. Add `--extra <name>` flags if you need optional extras.
39+
4. Run the program with `uv run interpreter`. Run tests with `uv run pytest -s -x`.
4040

4141
**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.
4242

4343
### Installing New Dependencies
4444

45-
If you wish to install new dependencies into the project, please use `poetry add package-name`.
46-
47-
### Installing Developer Dependencies
48-
49-
If you need to install dependencies specific to development, like testing tools, formatting tools, etc. please use `poetry add package-name --group dev`.
50-
51-
### Known Issues
52-
53-
For some, `poetry install` might hang on some dependencies. As a first step, try to run the following command in your terminal:
54-
55-
`export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring`
56-
57-
Then run `poetry install` again. If this doesn't work, please join our [Discord community](https://discord.gg/6p3fD6rBVm) for help.
58-
59-
## Code Formatting and Linting
45+
If you wish to install new dependencies into the project, please use `uv add package-name`.
46+
47+
### Installing Developer Dependencies
48+
49+
If you need to install dependencies specific to development, like testing tools, formatting tools, etc. please use `uv add package-name --group dev`.
50+
51+
## Code Formatting and Linting
6052

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

interpreter/core/utils/system_debug_info.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from importlib.metadata import version, PackageNotFoundError
55
from importlib.metadata import distributions
6+
from packaging.requirements import Requirement
7+
from packaging.version import Version
68
import psutil
79
import toml
810

@@ -53,27 +55,39 @@ def get_ram_info():
5355
def get_package_mismatches(file_path="pyproject.toml"):
5456
with open(file_path, "r") as file:
5557
pyproject = toml.load(file)
56-
dependencies = pyproject["tool"]["poetry"]["dependencies"]
57-
dev_dependencies = pyproject["tool"]["poetry"]["group"]["dev"]["dependencies"]
58-
dependencies.update(dev_dependencies)
58+
59+
project_dependencies = pyproject.get("project", {}).get("dependencies", [])
60+
dev_dependencies = pyproject.get("dependency-groups", {}).get("dev", [])
61+
62+
requirements = []
63+
unparsable = []
64+
for raw_requirement in project_dependencies + dev_dependencies:
65+
try:
66+
requirements.append(Requirement(raw_requirement))
67+
except Exception:
68+
unparsable.append(raw_requirement)
5969

6070
installed_packages = {
6171
dist.metadata["Name"].lower(): dist.version
6272
for dist in distributions()
6373
}
6474
mismatches = []
65-
for package, version_info in dependencies.items():
66-
if isinstance(version_info, dict):
67-
version_info = version_info["version"]
68-
installed_version = installed_packages.get(package)
69-
if installed_version and version_info.startswith("^"):
70-
expected_version = version_info[1:]
71-
if not installed_version.startswith(expected_version):
72-
mismatches.append(
73-
f"\t {package}: Mismatch, pyproject.toml={expected_version}, pip={installed_version}"
74-
)
75-
else:
76-
mismatches.append(f"\t {package}: Not found in pip list")
75+
for requirement in requirements:
76+
installed_version = installed_packages.get(requirement.name.lower())
77+
if not installed_version:
78+
mismatches.append(f"\t {requirement.name}: Not found in pip list")
79+
continue
80+
81+
if requirement.specifier and not requirement.specifier.contains(
82+
Version(installed_version), prereleases=True
83+
):
84+
mismatches.append(
85+
f"\t {requirement.name}: Mismatch, pyproject.toml={requirement.specifier}, pip={installed_version}"
86+
)
87+
88+
mismatches.extend(
89+
[f"\t {requirement}: Unable to parse requirement" for requirement in unparsable]
90+
)
7791

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

0 commit comments

Comments
 (0)