Skip to content
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

Allow extras dependencies to truly be optional #565

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

ameade
Copy link
Contributor

@ameade ameade commented Apr 4, 2024

Installing via poetry install with no extras resulted in:

Traceback (most recent call last):
File "summarizer.py", line 9, in
import instructor
File "instructor/instructor/init.py", line 56, in
from .client_groq import from_groq
File "instructor/instructor/client_groq.py", line 9, in
client: groq.Groq,
^^^^^^^^^
AttributeError: module 'groq' has no attribute 'Groq'

This is because groq 0.1.1 (which I had installed) does not have groq.Groq. So it needs to be pinned to ^0.4.2. However, I am not using groq but the 'test-docs' extra installs both groq and anthropic, so it should probably be an extra itself. groq and anthropic being installed with 'test-docs' causes them to be imported in init.py

if importlib.util.find_spec("groq") is not None:
from .client_groq import from_groq
all += ["from_groq"]

Furthermore, all of the dependencies for these extras need to be marked optional or else they are installed anyways.


Ellipsis 🚀 This PR description was created by Ellipsis for commit 52f95bf.

Summary:

This PR makes 'groq' and 'anthropic' optional dependencies, removes unnecessary dependencies, and updates the 'groq' version.

Key points:

  • Made 'groq' and 'anthropic' optional dependencies.
  • Removed unnecessary dependencies from 'poetry.lock'.
  • Updated 'groq' version to 0.4.2 in 'pyproject.toml'.

Generated with ❤️ by ellipsis.dev

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working enhancement New feature or request labels Apr 4, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Reviewed the entire pull request up to 52f95bf
  • Looked at 766 lines of code in 2 files
  • Took 3 minutes and 9 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 2 additional comments because they didn't meet confidence threshold of 85%.
1. pyproject.toml:23:
  • Assessed confidence : 0%
  • Comment:
    Good job on making the extras dependencies truly optional. This allows users to install the package without these extras if they are not needed.
  • Reasoning:
    The PR author has made changes to the pyproject.toml file to make the extras dependencies truly optional. This is done by adding the optional = true flag to the dependencies and grouping them under the extras section. This is a good practice as it allows users to install the package without these extras if they are not needed. The changes look correct and follow the best practices for managing optional dependencies in Python projects.
2. poetry.lock:125:
  • Assessed confidence : 0%
  • Comment:
    The poetry.lock file has been correctly updated to reflect the changes made in the pyproject.toml file.
  • Reasoning:
    The PR author has updated the poetry.lock file to reflect the changes made in the pyproject.toml file. This is expected as the poetry.lock file is automatically generated and should match the pyproject.toml file. The changes look correct and there are no discrepancies between the two files.

Workflow ID: wflow_IUEAner15060Id91


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@jxnl
Copy link
Collaborator

jxnl commented Apr 4, 2024

thanks so much!

@jxnl jxnl merged commit a8f5981 into instructor-ai:main Apr 4, 2024
PrathamSoni pushed a commit to EndexAI/instructor that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants