Skip to content

Commit 9e4e527

Browse files
adding changes
1 parent af62500 commit 9e4e527

File tree

4 files changed

+46
-87
lines changed

4 files changed

+46
-87
lines changed

setup.py

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,15 @@
1-
2-
"""
3-
setup.py for zap-cli
4-
5-
This script is used to package and distribute the zap-cli project.
6-
It includes details like the package name, version, dependencies,
7-
and entry points, making it easy to install and use as a command-line tool.
8-
9-
Key features of this setup.py file:
10-
- Defines the package name and version.
11-
- Lists required dependencies (like the Click library).
12-
- Specifies the command-line entry point, allowing the 'zap-cli' command to be used in the terminal.
13-
- Enables installation in development mode (editable mode) with `pip install -e .`.
14-
15-
Running `python setup.py install` or `pip install -e .` allows users to install
16-
the zap-cli package and make the zap-cli command available globally.
17-
18-
This file should be included in version control (e.g., Git) since it is essential for
19-
package installation and distribution, but the generated `*.egg-info/` directories
20-
should be excluded from version control.
21-
"""
22-
231
from setuptools import setup, find_packages
242

253
setup(
26-
name='zap-cli',
27-
version='0.1',
28-
packages=find_packages(),
29-
include_package_data=True,
4+
name="zap-cli",
5+
version="0.1",
6+
packages=find_packages(), # Automatically finds the zap_cli package
307
install_requires=[
31-
'click',
32-
'requests',
33-
'psutil',
34-
'yt-dlp',
35-
'keyring',
36-
'pytube',
37-
'fastapi',
38-
'pydantic',
39-
'uvicorn',
40-
'rich',
41-
'pyttsx3',
42-
'PyPDF2',
43-
'opencv-python',
44-
'setuptools'
8+
'click', # Add any dependencies here, like 'requests', etc.
459
],
4610
entry_points={
4711
'console_scripts': [
48-
'zap-cli = zap_cli.cli:cli', # <package>.<file>:<function>
12+
'zap-cli = zap_cli.zap_cli:cli', # Correct the path to the cli function
4913
],
5014
},
51-
classifiers=[
52-
'Programming Language :: Python :: 3',
53-
'License :: OSI Approved :: MIT License',
54-
'Operating System :: OS Independent',
55-
],
56-
python_requires='>=3.6',
57-
long_description=open('README.md').read(),
58-
long_description_content_type='text/markdown',
5915
)
60-

setup.sh

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
11
#!/bin/bash
22

3-
# Python virtual environment setup script for zap-cli
3+
# Exit on any error
44
set -e
55

6-
# Colors
7-
GREEN='\033[0;32m'
8-
YELLOW='\033[1;33m'
9-
RED='\033[0;31m'
10-
NC='\033[0m'
11-
12-
# Directories
13-
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
14-
ROOT_DIR="$(realpath "$SCRIPT_DIR/..")"
15-
VENV_DIR="${ROOT_DIR}/venv"
16-
17-
echo -e "${YELLOW}Creating virtual environment at ${VENV_DIR}...${NC}"
18-
python3 -m venv "$VENV_DIR"
19-
20-
# Activate venv
21-
source "$VENV_DIR/bin/activate"
22-
23-
# Upgrade pip
24-
echo -e "${YELLOW}Upgrading pip...${NC}"
25-
pip install --upgrade pip
26-
27-
# Install dependencies
28-
if [ -f "${ROOT_DIR}/setup.py" ]; then
29-
echo -e "${YELLOW}Installing zap-cli in editable mode...${NC}"
30-
pip install -e "$ROOT_DIR"
31-
elif [ -f "${ROOT_DIR}/requirements.txt" ]; then
32-
echo -e "${YELLOW}Installing dependencies from requirements.txt...${NC}"
33-
pip install -r "${ROOT_DIR}/requirements.txt"
34-
else
35-
echo -e "${RED}No setup.py or requirements.txt found. Exiting...${NC}"
36-
deactivate
6+
# Define the project directory
7+
PROJECT_DIR="$(pwd)"
8+
9+
# 1. Check if Python and venv are installed
10+
echo "Checking Python and venv installation..."
11+
if ! command -v python3 &> /dev/null
12+
then
13+
echo "Python3 is not installed. Please install Python 3."
3714
exit 1
3815
fi
3916

40-
# Deactivate
17+
if ! command -v python3 -m venv &> /dev/null
18+
then
19+
echo "venv module is not available. Installing..."
20+
python3 -m pip install --user virtualenv
21+
fi
22+
23+
# 2. Create a virtual environment
24+
echo "Creating virtual environment..."
25+
python3 -m venv venv
26+
27+
# 3. Activate the virtual environment
28+
source venv/bin/activate
29+
30+
# 4. Install the packages from requirements.txt or setup.py
31+
echo "Installing dependencies..."
32+
if [[ -f "$PROJECT_DIR/requirements.txt" ]]; then
33+
pip install -r "$PROJECT_DIR/requirements.txt"
34+
else
35+
echo "requirements.txt not found. Installing from setup.py..."
36+
pip install .
37+
fi
38+
39+
# 5. Install zap-cli globally (editable mode)
40+
echo "Installing zap-cli globally in editable mode..."
41+
pip install -e .
42+
43+
# 6. Check if the installation was successful by running zap-cli
44+
echo "Checking zap-cli installation..."
45+
zap-cli --version
46+
47+
# 7. Deactivate the virtual environment
4148
deactivate
4249

43-
echo -e "${GREEN}✅ Setup complete.${NC}"
44-
echo -e "${GREEN}To use zap-cli globally, make sure ~/.local/bin is in your PATH.${NC}"
45-
echo -e "${GREEN}You can now run:${NC}"
46-
echo -e "${GREEN}zap-cli --help${NC}"
50+
echo "Setup complete! You can now use zap-cli globally."

zap_cli/__init__.py

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)