Skip to content

Commit

Permalink
Removed the install_dependencies functions and replaced them with opt…
Browse files Browse the repository at this point in the history
…ional dependencies
  • Loading branch information
adalfarus committed Jun 9, 2024
1 parent 3a32872 commit 640eb32
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 77 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jobs:
python -m pip install --upgrade pip
pip install pytest
- name: Install aplustools in editable mode
- name: Install aplustools with all optional dependencies
run: |
pip install -e .
- name: Install dependencies using aplustools
run: |
python -c "import aplustools; aplustools.install_all_dependencies()"
pip install -e '.[all]'
- name: Prepare test_data directory (macOS/Linux)
if: runner.os != 'Windows'
Expand Down Expand Up @@ -62,5 +58,5 @@ jobs:
- name: Run tests
run: |
echo "Running tests..."
pytest aplustools/tests
pytest src/aplustools/tests
echo "Tests completed."
42 changes: 36 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ classifiers = [

[project.optional-dependencies]
data = [
"PySide6>=6.7.0",
"PySide6==6.7.0",
"Pillow>=10.3.0",
"aiohttp>=3.9.3",
"aiohttp>=3.9.4",
"opencv-python>=4.9.0.80",
"pillow_heif==0.15.0",
"numpy==1.26.4",
Expand All @@ -78,11 +78,41 @@ data = [
io = [
"speedtest-cli==2.1.3",
"windows-toasts==1.1.1; os_name == 'nt'",
"PySide6>=6.7.0"]
package = ["numpy==1.26.4"]
security = ["cryptography>=42.0.5", "quantcrypt==0.4.2"]
web = ["requests>=2.32.0", "BeautifulSoup4>=4.12.2"]
"PySide6==6.7.0"]
iogui = [
"PySide6==6.7.0",
"brotli==1.1.0"
]
package = [
"numpy==1.26.4",
"scipy==1.13.0",
"scikit-learn==1.4.1.post1; os_name == 'nt'",
"scikit-learn; os_name != 'nt'"
]
security = ["cryptography>=42.0.5", "quantcrypt==0.4.2; python_version == '3.12'"]
web = ["requests>=2.32.0", "BeautifulSoup4>=4.12.2", "aiohttp==3.9.5"]
dev = ["pytest"]
all = [
"PySide6==6.7.0",
"Pillow>=10.3.0",
"aiohttp>=3.9.4",
"opencv-python>=4.9.0.80",
"pillow_heif==0.15.0",
"numpy==1.26.4",
"brotli>=1.1.0",
"zstandard>=0.22.0",
"py7zr>=0.21.0",
"requests>=2.32.0",
"BeautifulSoup4>=4.12.2",
"speedtest-cli==2.1.3",
"windows-toasts==1.1.1; os_name == 'nt'",
"scipy==1.13.0",
"scikit-learn==1.4.1.post1; os_name == 'nt'",
"scikit-learn; os_name != 'nt'",
"cryptography>=42.0.5; python_version == '3.12'",
"quantcrypt==0.4.2; python_version == '3.12' and os_name == 'nt'",
"pytest"
]

[project.urls]
Home = "https://pypi.org/project/aplustools/"
Expand Down
15 changes: 0 additions & 15 deletions src/aplustools/_direct_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys as _sys
import os as _os
import warnings as _warnings
from aplustools.package import install_dependencies_lst as _install_dependencies_lst
import typing as _typing


Expand All @@ -19,20 +18,6 @@ def execute_python_command(arguments: _typing.Optional[list] = None, *args, **kw
# exit(-1073741510) # 130 / 0xC000013A


def install_all_dependencies():
success = _install_dependencies_lst(["requests==2.32.0", "Pillow==10.3.0", "BeautifulSoup4==4.12.3",
"cryptography==42.0.5", "PySide6==6.7.0", "aiohttp==3.9.4",
"opencv-python==4.9.0.80", "brotli==1.1.0",
"zstandard==0.22.0", "py7zr==0.21.0", "pillow_heif==0.15.0", "numpy==1.26.4",
"speedtest-cli==2.1.3", "windows-toasts==1.1.1; os_name == 'nt'",
"quantcrypt>=0.4.2; os_name == 'nt'", "scipy==1.13.0",
"scikit-learn==1.4.1.post1; os_name == 'nt'",
"scikit-learn==1.5.0; os_name != 'nt'"])
if not success:
return
print("Done, all possible dependencies installed ...")


def set_dir_to_ex():
import __main__
# Get the directory where the main script (or frozen exe) is located
Expand Down
9 changes: 0 additions & 9 deletions src/aplustools/data/_direct_functions.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
from aplustools.package import install_dependencies_lst as _install_dependencies_lst
from typing import Union as _Union
import ctypes as _ctypes
import typing as _typing
from aplustools.package.argumint import EndPoint as _EndPoint
import json as _json


def install_dependencies():
success = _install_dependencies_lst(["requests==2.32.0", "PySide6==6.7.0", "Pillow==10.3.0", "aiohttp==3.9.4",
"opencv-python==4.9.0.80", "pillow_heif==0.15.0", "numpy==1.26.4"])
if not success:
return
print("Done, all possible dependencies for the data module installed ...")


def truedivmod(__x, __y):
return (lambda q, r: (int(q), r))(*divmod(__x, __y))

Expand Down
8 changes: 0 additions & 8 deletions src/aplustools/io/_direct_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from aplustools.package import install_dependencies_lst as _install_dependencies_lst
import multiprocessing as _multiprocessing
import subprocess as _subprocess
import threading as _threading
Expand All @@ -15,13 +14,6 @@
_msvcrt = None


def install_dependencies():
success = _install_dependencies_lst(["speedtest-cli==2.1.3", "windows-toasts==1.1.1; os_name == 'nt'"])
if not success:
return
print("Done, all possible dependencies for the io module installed ...")


def diagnose_shutdown_blockers(suggestions: bool = True):
blockers = []

Expand Down
8 changes: 0 additions & 8 deletions src/aplustools/io/gui/_direct_functions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
from aplustools.package import install_dependencies_lst as _install_dependencies_lst
from PySide6.QtCore import QTimer, Signal, QObject, QEvent, QDateTime
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout


def install_dependencies():
success = _install_dependencies_lst(["PySide6==6.7.0", "brotli==1.1.0"])
if not success:
return
print("Done, all possible dependencies for the data module installed ...")


class QNoSpacingVBoxLayout(QVBoxLayout):
def __init__(self, parent=None):
super().__init__(parent=parent)
Expand Down
9 changes: 1 addition & 8 deletions src/aplustools/package/_direct_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __dir__(self):
return dir(self.module)


def _execute_python_command(arguments: _Optional[list] = None, *args, **kwargs) -> _subprocess.CompletedProcess[str]:
def _execute_python_command(arguments: _Optional[list] = None, *args, **kwargs) -> _subprocess.CompletedProcess[str]: # Shared code
if arguments is None:
arguments = []
print(' '.join([_sys.executable] + arguments))
Expand All @@ -51,13 +51,6 @@ def install_dependencies_lst(dependencies: list) -> bool:
return True


def install_dependencies():
success = install_dependencies_lst(["numpy==1.26.4", "scipy==1.13.0", "scikit-learn==1.4.1.post1"])
if not success:
return
print("Done, all possible dependencies for the package module installed ...")


class AttributeObject:
_types: dict = {}

Expand Down
9 changes: 1 addition & 8 deletions src/aplustools/security/_direct_functions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
from aplustools.package import install_dependencies_lst as _install_dependencies_lst


def install_dependencies():
success = _install_dependencies_lst(["cryptography==42.0.5", "quantcrypt==0.4.2"])
if not success:
return
print("Done, all possible dependencies for the utils module installed ...")
pass
9 changes: 1 addition & 8 deletions src/aplustools/web/_direct_functions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
from aplustools.package import install_dependencies_lst as _install_dependencies_lst


def install_dependencies():
success = _install_dependencies_lst(["requests==2.32.0", "BeautifulSoup4==4.12.3", "aiohttp==3.9.4"])
if not success:
return
print("Done, all possible dependencies for the data module installed ...")
pass

0 comments on commit 640eb32

Please sign in to comment.