long2ice / meilisync

Realtime sync data from MySQL/PostgreSQL/MongoDB to Meilisearch
https://github.com/long2ice/meilisync
Apache License 2.0
260 stars 40 forks source link

Change motor and psycopg2 to be required dependencies, not optional. #90

Open showtimezz opened 6 months ago

showtimezz commented 6 months ago

Simply running pip install mailsync and attempting to run it results in the following issues.

File "/MeiliSync/venv/lib/python3.11/site-packages/meilisync/source/postgres.py", line 6, in <module>
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
File "/MeiliSync/venv/lib/python3.11/site-packages/meilisync/progress/redis.py", line 1, in <module>
import redis.asyncio as redis
ModuleNotFoundError: No module named 'redis'
File "/MeiliSync/venv/lib/python3.11/site-packages/meilisync/source/mysql.py", line 4, in <module>
import asyncmy
ModuleNotFoundError: No module named 'asyncmy'
File "/MeiliSync/venv/lib/python3.11/site-packages/meilisync/source/mongo.py", line 3, in <module>
import motor.motor_asyncio
ModuleNotFoundError: No module named 'motor'

Now, for example, only installing support for MongoDB with pip install meilisync[mongodb] fixes the issue with the motor package, however, it's still not running until you install psycopg2.

I'm guessing this is a case of segmenting the package more, or the easier route of listing these as regular dependencies, not optional ones until a better solution is implemented, if that's something the original author wants to pursue.

I've double checked that this is the behavior when running this via poetry on my local machine.