paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
19.47k stars 1.79k forks source link

Make some dependencies optional #708

Closed notpushkin closed 2 months ago

notpushkin commented 3 months ago

Hey, first of all thanks for your wonderful project!

I've noticed that the default setup of Aider is at 926 MB now. This is mostly due to dependencies. Here's top 15:

124M    pyarrow
107M    playwright
103M    scipy
90M     pandas
85M     tree_sitter_languages
74M     googleapiclient
33M     numpy
27M     streamlit
27M     numpy.libs
24M     litellm
23M     scipy.libs
16M     networkx
15M     pydeck
15M     google
13M     grpc

The way around that is to make some dependencies optional. One low-hanging fruit is Streamlit, which is 484 MB (incluing its own dependencies)! To do that, you could declare it as an extra:

setup(
    name="aider",
    ...,
    extras_require={
        "browser": ["streamlit", "pyarrow", "pandas", ...],
    },
)

And check if it's available in the runtime:

def launch_gui(args):
    from aider import gui
    try:
        from streamlit.web import cli
    except ModuleNotFoundError:
        print(
            "Aider was installed without web support. To add it, run:\n"
            "    pip install aider-chat[browser]"
        )
        sys.exit(1)

Please let me know if you would be interested in a PR!

notpushkin commented 3 months ago

(Another option, of course, would be to replace Streamlit with something lighter, but I'm not sure if it's feasible at this point.)

paul-gauthier commented 2 months ago

As of v0.44.0:

paul-gauthier commented 2 months ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.