-
Notifications
You must be signed in to change notification settings - Fork 817
Add optional dependencies with extras for selective instrumentation #3427
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis PR establishes a Python virtual environment (myenv) with shell activation scripts for PowerShell, Bash, C shell, and Fish; creates console entry point wrappers for multiple Python packages (pip, distro, opentelemetry, httpx, tqdm, etc.); adds virtual environment configuration; and includes a setup.py for packaging dependencies. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Changes requested ❌
Reviewed everything up to 58172f5 in 2 minutes and 59 seconds. Click for details.
- Reviewed
701lines of code in21files - Skipped
0files when reviewing. - Skipped posting
8draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. myenv/bin/Activate.ps1:174
- Draft comment:
Verbose output lines for VenvExecDir Fullname/Name are missing a closing single quote, which may lead to formatting issues. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a new file being added (the diff shows it's a new file), so the comment is definitely about changes in the diff. The comment identifies what appears to be a genuine syntax error - missing closing single quotes on lines 174 and 175. In PowerShell, strings need to be properly quoted, and the pattern'$($VenvExecDir.FullName)"is missing the closing single quote before the double quote. The correct syntax should be'$($VenvExecDir.FullName)'". This is actionable, clear, and identifies a real bug. However, I need to consider if this would be caught by the build - PowerShell syntax errors would likely be caught when the script is executed, but this is a virtual environment activation script that's typically auto-generated, so it might not be tested in the build process. This appears to be a standard Python virtual environment activation script (likely auto-generated by Python's venv module). If this is an auto-generated file, commenting on it might not be useful since it would be regenerated. Also, while this looks like a syntax error, I should verify if PowerShell would actually accept this syntax or if it would fail at runtime. Even if this is auto-generated, the file is being committed to the repository in this PR, so if there's a bug in it, it should be fixed. However, looking more carefully at the syntax, PowerShell string interpolation with"$($var)"uses double quotes, and the pattern here'$($VenvExecDir.FullName)"mixes single and double quotes incorrectly. This would likely cause a syntax error. But wait - this is in a myenv/bin directory, which strongly suggests this is a virtual environment directory that shouldn't be committed to version control at all. This file appears to be part of a Python virtual environment (myenv/) which typically should not be committed to version control. The comment identifies a real syntax error, but commenting on files that shouldn't be in the repository in the first place is not useful. The proper action would be to not commit the virtual environment at all, not to fix syntax errors in it.
2. myenv/bin/Activate.ps1:206
- Draft comment:
Variable naming inconsistency: '$venvDir' is used instead of the already defined '$VenvDir'. Although PowerShell is case‐insensitive, consistent casing improves code readability. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. myenv/bin/hf:1
- Draft comment:
Hardcoded absolute shebang path reduces portability. Consider using '/usr/bin/env python3' to make the script more portable. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This file is inmyenv/bin/, which is a virtual environment directory. Virtual environment scripts are typically auto-generated by tools like pip when installing packages, and they intentionally use absolute paths to ensure they use the correct Python interpreter from that specific virtual environment. The hardcoded path is by design, not a mistake. Additionally, the rules state "Do NOT comment on dependency changes, library versions that you don't recognize, or anything else related to dependencies" - this appears to be an auto-generated script from installing the huggingface_hub package. The comment also doesn't suggest a clear code change that the author should make, since modifying auto-generated files is not a good practice. Virtual environment directories should typically not be committed to version control at all. Could this be a legitimate case where the author intentionally created this script and it should use/usr/bin/env python3? Maybe the file isn't auto-generated and the portability concern is valid? Even if the author created this manually, the file is in a virtual environment directory (myenv/), which should not be committed to version control. This is a standard practice - virtual environments are recreated on each machine. The comment doesn't address the real issue (committing virtual environment files) and suggests a change that would break the virtual environment's isolation. The hardcoded path is intentional for virtual environments. This comment should be deleted. The file is in a virtual environment directory where hardcoded absolute paths are intentional and necessary. Virtual environment files are auto-generated and should not be modified or committed to version control. The comment doesn't provide actionable advice for the actual issue.
4. setup.py:12
- Draft comment:
Strict version pinning in 'extras_require' (e.g. opentelemetry-instrumentation packages) may lead to dependency conflicts; consider using looser version constraints if appropriate. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. myenv/bin/Activate.ps1:175
- Draft comment:
Typographical issue: The verbose message for 'VenvExecDir Name' is missing a closing single quote. Please update it to properly enclose the value. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment suggests adding a closing single quote after$($VenvExecDir.Name)to make it'$($VenvExecDir.Name)'. However, this is incorrect. In PowerShell, when you have a double-quoted string like"text '$variable'", the single quotes are just literal characters. The current code"VenvExecDir Name: '$($VenvExecDir.Name)"is perfectly valid - it will output something likeVenvExecDir Name: 'bin(with an opening single quote but no closing one). Looking at line 174, it has the exact same pattern and also doesn't have a closing single quote. This appears to be intentional formatting, not an error. The comment is incorrect - there is no syntax error here. Wait, let me reconsider. Looking at other Write-Verbose statements in the file, line 173 has'$VenvExecPath'with both opening and closing quotes, line 196 has'$Prompt'with both quotes. Maybe the inconsistency is intentional, or maybe it really is a typo. Line 174 and 175 both have the same pattern of opening quote without closing. This could be a copy-paste error affecting both lines. While there is an inconsistency in formatting between different Write-Verbose statements, this is not a syntax error - the code will run fine. The comment is about a stylistic/formatting issue in a verbose logging statement. According to the rules, I should not keep comments about minor stylistic issues unless they are clearly important. This is a trivial formatting inconsistency in debug output that doesn't affect functionality. Additionally, this is an auto-generated virtual environment activation script (standard Python venv output), so the author likely didn't write this code themselves. This comment should be deleted. While there may be a minor formatting inconsistency, it's not a functional issue, and this appears to be a standard auto-generated Python virtual environment activation script. The comment is about a trivial stylistic issue in verbose logging output that doesn't warrant a code review comment.
6. myenv/bin/activate.csh:15
- Draft comment:
There's a potential typo in the PATH setting: the line readssetenv PATH "$VIRTUAL_ENV/"bin":$PATH", which appears to have incorrect quoting. Likely intended to besetenv PATH "$VIRTUAL_ENV/bin:$PATH". - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% This is a newly added file (the entire file is new based on the diff showing "new file mode"). The comment identifies what appears to be a legitimate syntax error in the quoting on line 15. The linesetenv PATH "$VIRTUAL_ENV/"bin":$PATH"has mismatched quotes - it closes the quote after the slash, then has "bin" in quotes separately. This would likely cause a shell syntax error or incorrect PATH setting. The correct syntax should besetenv PATH "$VIRTUAL_ENV/bin:$PATH"with the entire path expression inside one set of quotes. This is actionable, clear, and identifies a real bug. This is a virtual environment activation script that was likely auto-generated by Python's venv module. If it was auto-generated, the "typo" might actually be intentional or the correct output from the tool. I should consider whether this is actually user-written code or generated code that shouldn't be modified. While virtual environment files are often auto-generated, they are being added to the repository in this PR. If there's a syntax error, it should still be caught and fixed regardless of how it was generated. However, looking at standard venv activation scripts, they typically don't have this quoting issue, which suggests this might indeed be a corruption or error during generation. The comment identifies what appears to be a legitimate syntax error in the quoting. However, this is a virtual environment directory being added to the repository, which violates best practices (venv directories should be in .gitignore). The file itself shouldn't be in the repo at all. Given the rule about not commenting on files that shouldn't exist in the first place, and that this appears to be generated code, I should delete this comment.
7. myenv/bin/activate.fish:62
- Draft comment:
The lineecho "exit $old_status" | .appears to be a typographical error. The purpose of piping to.is unclear and it likely does not restore the status as intended. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 15% vs. threshold = 50% The comment suggests this is a typo, but I need to consider: 1) This is an auto-generated virtual environment activation script from Python's venv module, which is well-tested code. 2) The syntaxecho "exit $old_status" | .is actually valid Fish shell - it sources the string "exit $old_status" which sets the exit status. 3) This is a standard pattern in Fish shell activation scripts. 4) The file is entirely new (not modified), so this is generated code, not something the PR author wrote. 5) According to the rules, I should not comment on generated/moved files or things that are obviously correct in their context. However, I might be wrong about this being standard - maybe this IS actually a bug in the generated code. The syntax does look unusual and the automated tool might have caught a real issue. Without being able to test this or see Fish shell documentation, I can't be 100% certain this is correct. While I have some uncertainty, the key factors are: 1) This is a newly added file that appears to be auto-generated by Python's venv, 2) These activation scripts are widely used and tested, 3) The rules say not to comment on new files or generated code, and 4) The rules say I need STRONG EVIDENCE the comment is correct to keep it. The automated tool's speculation about a typo is not strong evidence when dealing with generated code from a mature project. This comment should be deleted. It's commenting on a newly added, auto-generated virtual environment activation script. Without strong evidence that this standard Python venv-generated code contains a bug, and given that these scripts are widely used, the comment appears to be a false positive about unfamiliar Fish shell syntax.
8. myenv/bin/opentelemetry-bootstrap:1
- Draft comment:
The shebang path contains 'openllmetry', which might be a typo. If the intended name is 'opentelemetry' (as referenced in the import statement), please correct it for consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This file is in myenv/bin/, which is a virtual environment directory. These files are auto-generated when installing packages and should not be manually edited. The shebang path reflects the actual directory structure on the developer's machine - if the project folder is named 'openllmetry', that's just the project name, not a typo. The 'opentelemetry' in the import is the correct package name. This is not something the PR author should or can fix - it's just how their local environment is set up. Additionally, virtual environment files should typically not be committed to version control at all. Could the project actually be named 'openllmetry' intentionally (perhaps combining 'opentelemetry' and 'LLM')? Even if it is a typo in the directory name, is this comment actionable since it's about the developer's local file system path, not the code itself? Even if 'openllmetry' is unintentional, this comment is not actionable because it's about the developer's local directory structure, not the code. The shebang is auto-generated based on where the virtual environment is located. The real issue is that virtual environment files shouldn't be in the PR at all, but that's a different concern. This comment should be deleted. It's commenting on an auto-generated file in a virtual environment directory, and the "issue" is just the developer's local directory name, which is not something that should be changed in the code. Virtual environment files are typically not meant to be committed or reviewed.
Workflow ID: wflow_SZYMYmJgY2sLWFKY
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
myenv/pyvenv.cfg
Outdated
| @@ -0,0 +1,5 @@ | |||
| home = /usr/bin | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committing a full virtual environment (e.g. myenv directory) may lead to portability and maintenance issues. It's best to add virtual environment directories to .gitignore.
myenv/bin/Activate.ps1
Outdated
| $VenvExecDir = Get-Item -Path $VenvExecPath | ||
|
|
||
| Write-Verbose "Activation script is located in path: '$VenvExecPath'" | ||
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical issue: The verbose message for 'VenvExecDir Fullname' is missing a closing single quote. Correct it by including a matching closing quote.
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" | |
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)'" |
myenv/bin/activate
Outdated
| fi | ||
|
|
||
| _OLD_VIRTUAL_PATH="$PATH" | ||
| PATH="$VIRTUAL_ENV/"bin":$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue on this line:
PATH="$VIRTUAL_ENV/"bin":$PATH
The quotes seem misplaced. Likely it should be:
PATH="$VIRTUAL_ENV/bin:$PATH"
Please adjust the quoting so that the bin directory is correctly concatenated.
| PATH="$VIRTUAL_ENV/"bin":$PATH" | |
| PATH="$VIRTUAL_ENV/bin:$PATH" |
myenv/bin/activate.fish
Outdated
| set -gx VIRTUAL_ENV /home/harsha08_2k6/Desktop/openllmetry/myenv | ||
|
|
||
| set -gx _OLD_VIRTUAL_PATH $PATH | ||
| set -gx PATH "$VIRTUAL_ENV/"bin $PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: The line set -gx PATH "$VIRTUAL_ENV/"bin $PATH seems to include an unexpected quote position. It probably should be set -gx PATH "$VIRTUAL_ENV/bin" $PATH.
| set -gx PATH "$VIRTUAL_ENV/"bin $PATH | |
| set -gx PATH "$VIRTUAL_ENV/bin" $PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 14
♻️ Duplicate comments (12)
myenv/bin/python3.12 (1)
1-1: CRITICAL: Remove virtual environment from repository.Same issue as the parent directory - this virtual environment artifact should not be committed.
myenv/bin/python (1)
1-1: CRITICAL: Remove virtual environment from repository.This virtual environment file should not be committed to version control.
myenv/bin/python3 (1)
1-1: CRITICAL: Remove virtual environment from repository.This virtual environment file contains system-specific paths and should not be committed.
myenv/bin/httpx (1)
1-8: CRITICAL: Remove virtual environment artifacts and hardcoded paths.This file is a virtual environment console script wrapper that should not be committed. Specific issues:
- Hardcoded user-specific path in the shebang (Line 1):
/home/harsha08_2k6/Desktop/openllmetry/myenv/bin/python3will fail on any other developer's machine- These console script wrappers are automatically generated by pip when installing packages
- Not portable or usable across different environments
Remove the entire
myenv/directory from this PR.myenv/bin/pip (1)
1-8: CRITICAL: Remove virtual environment artifacts.This pip wrapper contains hardcoded user-specific paths (Line 1) and is a virtual environment artifact that should not be committed.
myenv/bin/opentelemetry-bootstrap (1)
1-8: CRITICAL: Remove virtual environment artifacts.This OpenTelemetry bootstrap wrapper is a virtual environment artifact with hardcoded user-specific paths (Line 1) and should not be committed.
myenv/bin/hf (1)
1-8: CRITICAL: Remove virtual environment artifacts.This HuggingFace Hub CLI wrapper is a virtual environment artifact with hardcoded user-specific paths (Line 1) and should not be committed.
myenv/bin/normalizer (1)
1-8: Same: remove venv script from repo.Generated CLI shim with local-path shebang; should not be versioned. Ignore and delete from VCS as noted in the previous comment.
myenv/bin/activate.fish (1)
33-69: Virtualenv activation script should not be in repo.Contains machine-specific absolute paths (Line 36) and prompt overrides. Remove myenv/ from version control and add ignore rules.
myenv/bin/activate (1)
38-47: Remove committed venv; absolute VIRTUAL_ENV path is repo-unsafe.This is environment-specific and will break elsewhere. Drop myenv/ from the repo and add .gitignore as suggested.
myenv/pyvenv.cfg (1)
1-5: Do not version pyvenv.cfg (machine‑specific, absolute paths).This file encodes your local paths (home = /usr/bin, executable, command) and will not be portable. Covered in earlier comment; please remove from the PR and add myenv/ to .gitignore.
myenv/bin/Activate.ps1 (1)
1-247: Venv artifacts should not be committed.Same as earlier: drop myenv/ from VCS and configure optional dependencies via packaging extras to meet the PR goal.
🧹 Nitpick comments (2)
setup.py (2)
12-59: Extras may need target libs.Per group-specific extras (e.g., 'openai', 'langchain'), consider including the target libraries (openai, langchain) with compatible ranges so users can
pip install traceloop-sdk[openai]and get a working setup.
1-3: Modernize packaging (optional).Consider migrating to pyproject.toml (PEP 621) and using Hatch/Setuptools PEP 517 backends. Cleaner metadata, better tooling.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (21)
myenv/bin/Activate.ps1(1 hunks)myenv/bin/activate(1 hunks)myenv/bin/activate.csh(1 hunks)myenv/bin/activate.fish(1 hunks)myenv/bin/distro(1 hunks)myenv/bin/hf(1 hunks)myenv/bin/httpx(1 hunks)myenv/bin/normalizer(1 hunks)myenv/bin/opentelemetry-bootstrap(1 hunks)myenv/bin/opentelemetry-instrument(1 hunks)myenv/bin/pip(1 hunks)myenv/bin/pip3(1 hunks)myenv/bin/pip3.12(1 hunks)myenv/bin/python(1 hunks)myenv/bin/python3(1 hunks)myenv/bin/python3.12(1 hunks)myenv/bin/tiny-agents(1 hunks)myenv/bin/tqdm(1 hunks)myenv/lib64(1 hunks)myenv/pyvenv.cfg(1 hunks)setup.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: Store API keys only in environment variables/secure vaults; never hardcode secrets in code
Use Flake8 for code linting and adhere to its rules
Files:
setup.py
🔇 Additional comments (1)
setup.py (1)
4-5: I can see the packagetraceloop-sdkalready exists on PyPI. To fully assess whether this naming is intentional and legitimate, I need to gather more context about the project and the relationship between the repository name and package name.No issues found—package naming is intentional and legitimate.
OpenLLMetry is a set of extensions built on top of OpenTelemetry, and it's built and maintained by Traceloop, with the repo containing standard OpenTelemetry instrumentations for LLM providers as well as a Traceloop SDK. The Traceloop's Python SDK allows you to easily start monitoring and debugging your LLM execution, with tracing built on top of OpenTelemetry. The package name
traceloop-sdkis the official published name for the Python SDK within the openllmetry repository and already exists on PyPI. The naming reflects the SDK's affiliation with Traceloop, the organization behind the project.
myenv/bin/activate.csh
Outdated
| # This file must be used with "source bin/activate.csh" *from csh*. | ||
| # You cannot run it directly. | ||
|
|
||
| # Created by Davide Di Blasi <[email protected]>. | ||
| # Ported to Python 3.3 venv by Andrew Svetlov <[email protected]> | ||
|
|
||
| alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' | ||
|
|
||
| # Unset irrelevant variables. | ||
| deactivate nondestructive | ||
|
|
||
| setenv VIRTUAL_ENV /home/harsha08_2k6/Desktop/openllmetry/myenv | ||
|
|
||
| set _OLD_VIRTUAL_PATH="$PATH" | ||
| setenv PATH "$VIRTUAL_ENV/"bin":$PATH" | ||
|
|
||
|
|
||
| set _OLD_VIRTUAL_PROMPT="$prompt" | ||
|
|
||
| if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then | ||
| set prompt = '(myenv) '"$prompt" | ||
| setenv VIRTUAL_ENV_PROMPT '(myenv) ' | ||
| endif | ||
|
|
||
| alias pydoc python -m pydoc | ||
|
|
||
| rehash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Remove committed virtualenv; align PR with “extras” objective instead.
This file (and the whole myenv/ directory) is auto‑generated, machine‑specific, and includes absolute paths with your username. It should not be versioned and will break for other devs/CI and leaks local paths. Please drop myenv/ from the PR, add it to .gitignore, and implement optional deps via packaging extras (pyproject.toml) as per the PR title.
Add ignore rules:
+# Python venvs and artifacts
+myenv/
+.venv/
+venv/
+**/__pycache__/
+*.pycExample packaging extras (PEP 621):
[project.optional-dependencies]
instrumentation = ["opentelemetry-sdk>=1.27", "opentelemetry-instrumentation-httpx>=0.47"]
httpx = ["httpx>=0.27"]
openai = ["openai>=1.50"]
# pip install .[instrumentation,httpx]Verification script (lists venv artifacts to remove):
🏁 Script executed:
#!/bin/bash
fd -HI --type d '^(myenv|\.venv|venv)$' 2>/dev/null || true
fd -HI --type f 'pyvenv\.cfg|Activate\.ps1|/bin/activate(\.csh|\.fish)?$|/bin/activate$' 2>/dev/null || trueLength of output: 46
---
🏁 Script executed:
```shell
#!/bin/bash
# Check if .gitignore exists and whether myenv/ is already ignored
if [ -f .gitignore ]; then
echo "=== .gitignore content ==="
cat .gitignore
else
echo ".gitignore does not exist"
fi
echo ""
echo "=== Checking for pyproject.toml ==="
if [ -f pyproject.toml ]; then
echo "pyproject.toml found"
grep -A 20 "\[project" pyproject.toml || echo "No [project] section found"
grep -A 10 "optional-dependencies" pyproject.toml || echo "No optional-dependencies found"
else
echo "pyproject.toml not found"
fi
echo ""
echo "=== Checking for setup.py ==="
ls -la setup.py 2>/dev/null || echo "setup.py not found"
Length of output: 2319
🏁 Script executed:
#!/bin/bash
# Check setup.py for optional dependencies structure
echo "=== setup.py content ==="
cat setup.pyLength of output: 2814
Remove committed virtualenv directory from PR.
The myenv/ directory is auto-generated, machine-specific, and contains absolute paths with your username. It should not be versioned and will break for other developers/CI. Remove it from this PR.
Update .gitignore to explicitly include:
# Environments
.env
.venv
env/
venv/
+myenv/
ENV/
env.bak/
venv.bak/Note: The repo already has optional dependencies configured in setup.py under extras_require (full, minimal, openai, langchain), so no additional packaging configuration is needed.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In myenv/bin/activate.csh lines 1-27, the review points out that the committed
myenv/ virtualenv is machine-specific and must be removed from the PR; remove
the entire myenv/ directory from the repository (stop tracking and delete it
from the index/commit), add a line to .gitignore to ignore myenv/ (and verify no
other venv artifacts are committed), then commit the removal and updated
.gitignore so the virtualenv and its absolute-path files are not versioned going
forward.
myenv/bin/activate.csh
Outdated
| setenv VIRTUAL_ENV /home/harsha08_2k6/Desktop/openllmetry/myenv | ||
|
|
||
| set _OLD_VIRTUAL_PATH="$PATH" | ||
| setenv PATH "$VIRTUAL_ENV/"bin":$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix PATH quoting (csh): current value yields an invalid entry.
The PATH line inserts a literal "bin" token. Use the canonical venv form:
-setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
+setenv PATH "$VIRTUAL_ENV/bin:$PATH"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| setenv PATH "$VIRTUAL_ENV/"bin":$PATH" | |
| setenv PATH "$VIRTUAL_ENV/bin:$PATH" |
🤖 Prompt for AI Agents
In myenv/bin/activate.csh at line 15, the PATH assignment uses incorrect quoting
which inserts a literal "bin" token; replace the current line with the canonical
virtualenv form that appends the venv's bin directory to PATH (i.e., construct
the string so $VIRTUAL_ENV and "/bin" are concatenated before :$PATH), making
the PATH entry valid in csh.
myenv/bin/Activate.ps1
Outdated
| # Remove extraneous quotations around a string value. | ||
| if ("'""".Contains($val.Substring(0, 1))) { | ||
| $val = $val.Substring(1, $val.Length - 2) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard quote trimming to avoid Substring exceptions on short values.
If a value is only one char, $val.Substring(1, $val.Length - 2) throws. Safer:
- if ("'""".Contains($val.Substring(0, 1))) {
- $val = $val.Substring(1, $val.Length - 2)
- }
+ if ($val.Length -ge 2 -and
+ ( $val.StartsWith("'") -or $val.StartsWith('"') ) -and
+ ( $val.EndsWith("'") -or $val.EndsWith('"') )) {
+ $val = $val.Substring(1, $val.Length - 2)
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Remove extraneous quotations around a string value. | |
| if ("'""".Contains($val.Substring(0, 1))) { | |
| $val = $val.Substring(1, $val.Length - 2) | |
| } | |
| # Remove extraneous quotations around a string value. | |
| if ($val.Length -ge 2 -and | |
| ( $val.StartsWith("'") -or $val.StartsWith('"') ) -and | |
| ( $val.EndsWith("'") -or $val.EndsWith('"') )) { | |
| $val = $val.Substring(1, $val.Length - 2) | |
| } |
🤖 Prompt for AI Agents
In myenv/bin/Activate.ps1 around lines 153 to 156, the existing quote-trimming
uses $val.Substring(1, $val.Length - 2) which will throw for very short strings;
add a guard to ensure $val.Length -ge 2 (and optionally verify the last
character is a matching quote) before calling Substring, otherwise skip trimming
(or use a safe alternative like TrimStart/TrimEnd); ensure the conditional
checks both the first and last characters are quotes and length is sufficient
before performing the substring operation.
myenv/bin/Activate.ps1
Outdated
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" | ||
| Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unterminated string/interpolation in Write-Verbose lines (script won’t load).
Both lines miss closing ) and '. Fix as:
-Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
-Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
+Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)'"
+Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)'"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" | |
| Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" | |
| Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)'" | |
| Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)'" |
🤖 Prompt for AI Agents
In myenv/bin/Activate.ps1 around lines 174-175, the two Write-Verbose lines have
unterminated string/interpolation (missing closing ) and '), so the script fails
to load; update each line to properly close the interpolation and string by
adding the missing characters so they read complete Write-Verbose statements
with "$(...)" and surrounding quotes.
myenv/bin/distro
Outdated
| #!/home/harsha08_2k6/Desktop/openllmetry/myenv/bin/python3 | ||
| # -*- coding: utf-8 -*- | ||
| import re | ||
| import sys | ||
| from distro.distro import main | ||
| if __name__ == '__main__': | ||
| sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
| sys.exit(main()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Blocker: Virtualenv artifacts committed; remove myenv/ and use packaging extras instead.
- This is a generated venv console script, not project source. Keeping it in VCS is non‑portable (absolute shebang to your local path), leaks PII (username in path), and risks drift/licensing bloat. It will break on other machines/CI.
- It also conflicts with the PR goal (“optional dependencies with extras”). Ship extras, not the environment.
Actions:
- Remove the entire myenv/ directory from the repo and add ignore rules.
- Define optional deps via extras and document install commands (e.g., pip install .[otel], pip install .[hf]).
.gitignore addition:
+myenv/
+.venv/
+venv/
+ENV/
+env/
+__pycache__/
+*.py[cod]Example extras (adapt versions to your policy):
# pyproject.toml
[project.optional-dependencies]
otel = [
"opentelemetry-sdk>=1.26",
"opentelemetry-exporter-otlp>=1.26",
"opentelemetry-instrumentation-requests>=0.49b0",
"opentelemetry-instrumentation-httpx>=0.49b0",
]
hf = [
"huggingface_hub>=0.25",
]Verification (read‑only):
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Committed virtualenv directories:"
fd -HI '^(myenv|.venv|venv|env|ENV)$' -t d || true
echo "Files with absolute myenv shebangs:"
rg -nP '^#!.*/myenv/bin/python3' -S || true
echo "Presence of pyvenv.cfg (should not be committed):"
fd -HI 'pyvenv.cfg' || trueLength of output: 1034
Remove myenv/ directory and .gitignore virtualenv artifacts; define optional dependencies via extras instead.
The myenv/ directory and related console scripts in this PR are generated virtualenv artifacts that should never be committed to VCS. The verification confirms 11 scripts across myenv/bin/ (including the distro file under review) contain absolute shebangs pointing to your local machine path (/home/harsha08_2k6/Desktop/openllmetry/myenv/bin/python3), exposing PII and breaking portability for all CI/CD systems and other developers.
Required fixes:
- Remove the entire
myenv/directory from the repository - Add
.gitignorerules:myenv/,.venv/,venv/,env/,ENV/,__pycache__/,*.pyc,*.pyo,*.pyd - Define optional dependencies in
pyproject.toml:
[project.optional-dependencies]
otel = [
"opentelemetry-sdk>=1.26",
"opentelemetry-exporter-otlp>=1.26",
"opentelemetry-instrumentation-requests>=0.49b0",
"opentelemetry-instrumentation-httpx>=0.49b0",
]
hf = [
"huggingface_hub>=0.25",
]Document install commands in README: pip install .[otel], pip install .[hf], etc.
🤖 Prompt for AI Agents
In myenv/bin/distro around lines 1 to 8: this file is part of a committed
virtualenv (myenv/) that must be removed; delete the entire myenv/ directory
from the repo, add .gitignore entries to ignore virtualenvs and Python build
artifacts (myenv/, .venv/, venv/, env/, ENV/, __pycache__/, *.pyc, *.pyo,
*.pyd), and remove any other generated scripts under myenv/bin; instead declare
optional dependencies in pyproject.toml under [project.optional-dependencies]
with the provided "otel" and "hf" lists, and update the README to document
installation via pip install .[otel] and pip install .[hf].
myenv/bin/tqdm
Outdated
| #!/home/harsha08_2k6/Desktop/openllmetry/myenv/bin/python3 | ||
| # -*- coding: utf-8 -*- | ||
| import re | ||
| import sys | ||
| from tqdm.cli import main | ||
| if __name__ == '__main__': | ||
| sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
| sys.exit(main()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not commit virtualenv artifacts. Remove myenv/bin from VCS.
This is a generated entry-point with an absolute shebang to a local path. It breaks portability and bloats the repo. Add myenv/ to .gitignore and drop it from the PR.
Apply:
+ # .gitignore
+ myenv/
+ .venv/
+ venv/
+ **/__pycache__/
+ *.py[cod]And run:
git rm -r --cached myenv🤖 Prompt for AI Agents
In myenv/bin/tqdm around lines 1 to 8, this file is a virtualenv-generated
entry-point with an absolute shebang and should not be committed; remove myenv/
from VCS, add myenv/ to .gitignore, and unstage/remove the tracked virtualenv
files by running git rm -r --cached myenv (or remove the specific file), commit
the .gitignore update and the removal, and then ensure you do not re-add
virtualenv artifacts by recreating the virtualenv locally if needed.
myenv/lib64
Outdated
| @@ -0,0 +1 @@ | |||
| lib No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRITICAL: Virtual environment artifacts must not be committed to the repository.
This entire myenv/ directory should be removed from the PR and added to .gitignore. Virtual environments are:
- User-specific and machine-specific
- Generated artifacts that should be recreated locally by each developer
- Not portable across different systems
- Repository bloat
The PR title suggests adding optional dependencies with extras. The actual changes should be in setup.py, pyproject.toml, or similar packaging configuration files, not in virtual environment artifacts.
Apply this change:
- Remove the entire
myenv/directory from the PR - Add
myenv/,venv/,.venv/,env/to.gitignore - Ensure only the actual packaging configuration changes (e.g.,
setup.pywithextras_require) are committed
🤖 Prompt for AI Agents
In myenv/lib64 around lines 1 to 1, the PR accidentally includes a committed
virtual environment folder; remove the entire myenv/ directory from the
commit/PR, add common venv patterns (myenv/, venv/, .venv/, env/) to .gitignore,
and ensure only packaging changes (e.g., update setup.py or pyproject.toml with
extras_require) remain in the diff; after removing the folder, run git rm -r
--cached myenv (or remove and recommit), update .gitignore, and verify the
commit contains only the intended packaging/configuration changes.
| packages=find_packages(), | ||
| install_requires=[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclude venv and non-package dirs from distribution.
find_packages() will happily pick up myenv/ if present. Exclude it (and tests/examples) to avoid shipping venv artifacts.
Apply:
- packages=find_packages(),
+ packages=find_packages(exclude=("tests*", "examples*", "myenv*", "venv*", ".venv*")),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| packages=find_packages(), | |
| install_requires=[ | |
| packages=find_packages(exclude=("tests*", "examples*", "myenv*", "venv*", ".venv*")), | |
| install_requires=[ |
🤖 Prompt for AI Agents
In setup.py around lines 6 to 7, find_packages() is currently used without
exclusions and may include venv or non-package dirs; update the call to exclude
common virtualenv and non-distribution directories (e.g. "venv", "myenv", "env",
"tests", "test", "examples", "docs") by passing an exclude list to find_packages
(for example find_packages(exclude=[...])). Ensure the exclusion list covers
variations used in the repo so those directories are not included in the
distributed packages.
| 'opentelemetry-sdk>=0.52b1', | ||
| # Add other core required packages here | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid SDK version spec; add API and correct ranges.
opentelemetry-sdk follows 1.x, not 0.52b1. This spec will fail to resolve. Also add opentelemetry-api to install_requires.
Apply:
- 'opentelemetry-sdk>=0.52b1',
+ 'opentelemetry-api>=1.22,<2',
+ 'opentelemetry-sdk>=1.22,<2',Optionally add:
+ python_requires=">=3.8",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'opentelemetry-sdk>=0.52b1', | |
| # Add other core required packages here | |
| ], | |
| 'opentelemetry-api>=1.22,<2', | |
| 'opentelemetry-sdk>=1.22,<2', | |
| # Add other core required packages here | |
| ], |
🤖 Prompt for AI Agents
In setup.py around lines 9-11, the install_requires entry uses an
invalid/opentelemetry-sdk version and omits opentelemetry-api; replace the
single incorrect 'opentelemetry-sdk>=0.52b1' entry with two proper constraints
e.g. add "opentelemetry-api>=1.0.0,<2.0.0" and "opentelemetry-sdk>=1.0.0,<2.0.0"
in install_requires, ensuring both API and SDK are specified and version ranges
follow the 1.x series; optionally include any other OpenTelemetry companion
packages you need.
| extras_require={ | ||
| 'full': [ | ||
| 'opentelemetry-instrumentation-alephalpha==0.39.0', | ||
| 'opentelemetry-instrumentation-anthropic==0.39.0', | ||
| 'opentelemetry-instrumentation-bedrock==0.39.0', | ||
| 'opentelemetry-instrumentation-chromadb==0.39.0', | ||
| 'opentelemetry-instrumentation-cohere==0.39.0', | ||
| 'opentelemetry-instrumentation-crewai==0.39.0', | ||
| 'opentelemetry-instrumentation-google-generativeai==0.39.0', | ||
| 'opentelemetry-instrumentation-groq==0.39.0', | ||
| 'opentelemetry-instrumentation-haystack==0.39.0', | ||
| 'opentelemetry-instrumentation-lancedb==0.39.0', | ||
| 'opentelemetry-instrumentation-langchain==0.39.0', | ||
| 'opentelemetry-instrumentation-llamaindex==0.39.0', | ||
| 'opentelemetry-instrumentation-logging==0.52b1', | ||
| 'opentelemetry-instrumentation-marqo==0.39.0', | ||
| 'opentelemetry-instrumentation-milvus==0.39.0', | ||
| 'opentelemetry-instrumentation-mistralai==0.39.0', | ||
| 'opentelemetry-instrumentation-ollama==0.39.0', | ||
| 'opentelemetry-instrumentation-openai==0.39.0', | ||
| 'opentelemetry-instrumentation-pinecone==0.39.0', | ||
| 'opentelemetry-instrumentation-qdrant==0.39.0', | ||
| 'opentelemetry-instrumentation-replicate==0.39.0', | ||
| 'opentelemetry-instrumentation-requests==0.52b1', | ||
| 'opentelemetry-instrumentation-sagemaker==0.39.0', | ||
| 'opentelemetry-instrumentation-sqlalchemy==0.52b1', | ||
| 'opentelemetry-instrumentation-threading==0.52b1', | ||
| 'opentelemetry-instrumentation-together==0.39.0', | ||
| 'opentelemetry-instrumentation-transformers==0.39.0', | ||
| 'opentelemetry-instrumentation-urllib3==0.52b1', | ||
| 'opentelemetry-instrumentation-vertexai==0.39.0', | ||
| 'opentelemetry-instrumentation-watsonx==0.39.0', | ||
| 'opentelemetry-instrumentation-weaviate==0.39.0', | ||
| 'opentelemetry-semantic-conventions-ai==0.4.3', | ||
| 'opentelemetry-util-http==0.52b1', | ||
| ], | ||
| 'minimal': [ | ||
| 'opentelemetry-instrumentation-requests==0.52b1', | ||
| 'opentelemetry-instrumentation-urllib3==0.52b1', | ||
| ], | ||
| 'openai': [ | ||
| 'opentelemetry-instrumentation-openai==0.39.0', | ||
| ], | ||
| 'langchain': [ | ||
| 'opentelemetry-instrumentation-langchain==0.39.0', | ||
| ], | ||
| # Add other targeted optional groups here | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Version drift across extras; verify compatibility and consider grouping.
Mixing 0.39.0 (LLM/AI vendors) with 0.52b1 (core) may be fine if they target API 1.x, but please verify the supported matrix and pin consistently where needed. Consider building 'full' from the union of smaller groups to reduce duplication.
Run:
🏁 Script executed:
#!/bin/bash
# Check existence and latest versions on PyPI to validate pins
for pkg in opentelemetry-sdk opentelemetry-api \
opentelemetry-instrumentation-openai \
opentelemetry-instrumentation-requests \
opentelemetry-instrumentation-langchain \
opentelemetry-semantic-conventions-ai \
opentelemetry-util-http
do
echo "== $pkg =="
curl -s "https://pypi.org/pypi/$pkg/json" | jq -r '.info.version, (.releases | keys | join(" "))' | head -n1
done
# Sanity: does "0.52b1" exist for SDK? (expected: no)
curl -s https://pypi.org/pypi/opentelemetry-sdk/json | jq -r '.releases | has("0.52b1")'Length of output: 310
I need to verify whether the specific 0.52b1 versions pinned in setup.py actually exist on PyPI, as the core SDK doesn't have this version.
Critical: dependency pins are broken and will fail installation.
The 0.52b1 versions do exist for instrumentation packages like requests (released Mar 20, 2025), but the vendor packages pinned to 0.39.0 (openai, langchain, anthropic, etc.) are not available on PyPI. For example, opentelemetry-instrumentation-openai latest version is 0.47.3 (Sep 21, 2025), with no 0.39.0 release found in the version history.
This means the full extra will fail to install immediately. Additionally, all pinned versions are significantly outdated:
- Instrumentation packages (requests, urllib3, util-http): pinned 0.52b1 (March 2025) vs. latest 0.59b0 (October 2025)
- Vendor packages: completely uninstallable at pinned versions
- Semantic conventions AI: pinned 0.4.3 vs. latest 0.4.13
Update all pins to valid, available versions on PyPI and align instrumentation versions to a consistent release window.
|
Hey @harsha08-2k6 what's the purpose of this? |
|
hi @nirga , Optional dependencies with extras: Instead of installing all packages (including many you may not use), you allow users to install only what they need, for example, just OpenAI instrumentation or LangChain instrumentation. This reduces bloat and speeds up installs. So overall, you set up an environment to work safely without messing with your system Python and improved how the Traceloop SDK package handles dependencies to be more flexible and user-friendly. This helps developers customize their installs and avoid unnecessary packages |
|
Thanks @harsha08-2k6 - can you specify which workflow you cannot do today that you'll be able to do with this? |
|
hi @nirga - Selective package installation: The Traceloop SDK forced users to install all instrumentation dependencies even if they only needed a few, causing long install times and extra disk usage. Collaborative development: Without proper .gitignore rules, virtual environment artifacts could accidentally be committed and conflict with others' environments. Reliable package management: Without version-aligned optional dependencies (extras_require), installs could break due to incompatible or unavailable packages. Workflows you can now do successfully: Flexible dependency installation: Users can install only needed instrumentation packages with commands like pip install traceloop-sdk[openai] or pip install traceloop-sdk[full]. Safe local development: Use isolated Python virtual environments locally without polluting repos or system Python. Maintainable branching and collaboration: Clean branches without environment artifacts that can be safely pushed, reviewed, and merged. Version reliable installs: With pinned compatible package versions in extras, your SDK installs reliably for many users. In simple terms, your work today enables efficient, clean, and maintainable Python development and collaboration workflows that were problematic before due to environment pollution and rigid packaging. |
feat(instrumentation): ...orfix(instrumentation): ....Important
Add optional dependencies with extras in
setup.pyand scripts for activating Python virtual environments across different shells.setup.pywith optional dependencies usingextras_requirefor selective instrumentation.full,minimal,openai,langchain.Activate.ps1,activate,activate.csh,activate.fishfor activating virtual environments in PowerShell, bash, csh, and fish shells.PATH,PYTHONHOME, and prompt settings.distro,hf,httpx,normalizer,opentelemetry-bootstrap,opentelemetry-instrument,pip,pip3,tiny-agents,tqdmfor various command-line tools.This description was created by
for 58172f5. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit