Skip to content

Commit

Permalink
Merge pull request #45 from WrenchAI/v2
Browse files Browse the repository at this point in the history
MagicLib Fix
  • Loading branch information
Kydoimos97 committed May 17, 2024
2 parents cfc1ee0 + 8a2da0a commit 79e5b08
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ To install the package, simply run the following command:
```bash
pip install WrenchCL
```
Upon recieving the below error:

```bash
ImportError: failed to find libmagic. Check your installation
```

Install the package with the optional libmagic dependency, users can using the following command:

```bash
pip install WrenchCL[libmagic]
```


# User Guides

Expand Down
12 changes: 11 additions & 1 deletion WrenchCL/Tools/FetchMetaData.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@

import os
import requests
import magic

try:
import magic
except ImportError as e:
raise ImportError(
"Failed to import 'magic'. Please install the appropriate library. "
"On Windows, you can install it with:\n"
"pip install WrenchCL[libmagic]\n"
"On other platforms, ensure 'libmagic' is installed."
) from e

from datetime import datetime

def get_metadata(file_source, is_url=True):
Expand Down
10 changes: 9 additions & 1 deletion WrenchCL/Tools/FileTyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
#
import mimetypes
import requests
import magic
try:
import magic
except ImportError as e:
raise ImportError(
"Failed to import 'magic'. Please install the appropriate library. "
"On Windows, you can install it with:\n"
"pip install WrenchCL[libmagic]\n"
"On other platforms, ensure 'libmagic' is installed."
) from e


def get_file_type(file_source, is_url=True):
Expand Down
39 changes: 11 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import platform
from setuptools import setup, find_packages


# Function to find a folder that ends with .egg-info
def find_egg_info_folder(path='.'):
for folder_name in os.listdir(path):
if folder_name.endswith('.egg-info'):
return folder_name
return None


# Read the long description from README.md
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
Expand All @@ -28,32 +30,13 @@ def find_egg_info_folder(path='.'):
with open(requires_path, "r", encoding="utf-8") as f:
required = f.read().splitlines()

# Add a note for Windows users to install python-magic-bin if python-magic isn't found
if platform.system() == "Windows":
print(
"Note: If you encounter issues with python-magic on Windows, please install python-magic-bin manually:\n"
"pip install python-magic-bin~=0.4.14"
)
# Define the optional dependencies
extras = {'libmagic': ['python-magic-bin~=0.4.14']}

setup(
name='WrenchCL',
version='0.0.1.dev0',
author='willem@wrench.ai',
description=(
'WrenchCL is a comprehensive library designed to facilitate seamless interactions with '
'AWS services, OpenAI models, and various utility tools. This package aims to streamline '
'the development process by providing robust components for database interactions, '
'cloud storage, and AI-powered functionalities.'
),
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/WrenchAI/WrenchCL',
packages=find_packages(),
install_requires=required,
python_requires='>=3.11',
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
)
setup(name='WrenchCL', version='0.0.1.dev0', author='willem@wrench.ai',
description='WrenchCL is a comprehensive library designed to facilitate seamless interactions with AWS services, OpenAI models, and various utility tools. This package aims to streamline the development process by providing robust components for database interactions, cloud storage, and AI-powered functionalities.',
long_description=long_description, long_description_content_type="text/markdown",
url='https://github.com/WrenchAI/WrenchCL', packages=find_packages(), install_requires=required,
extras_require=extras, python_requires='>=3.11',
classifiers=['Programming Language :: Python :: 3', 'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent', ], )

0 comments on commit 79e5b08

Please sign in to comment.