ghg
This commit is contained in:
@@ -121,6 +121,7 @@ try { $IsWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = (Resolve-Path (Join-Path $scriptDir "..")).Path
|
||||
Set-Location $repoRoot
|
||||
$scriptsDir = Join-Path $repoRoot 'scripts'
|
||||
|
||||
$pythonExe = Find-Python -preferred $Python
|
||||
if (-not $pythonExe) { Write-Log "No Python interpreter found. Specify -Python <path> or install Python." "ERROR"; exit 2 }
|
||||
@@ -217,7 +218,7 @@ if (-not $NoInstall) {
|
||||
if ($Editable) { $editable_label = "(editable)" } else { $editable_label = "" }
|
||||
Write-Log ("Installing project {0}" -f $editable_label)
|
||||
try {
|
||||
if ($Editable) { & $venvPython -m pip install -e . } else { & $venvPython -m pip install . }
|
||||
if ($Editable) { & $venvPython -m pip install -e $scriptsDir } else { & $venvPython -m pip install $scriptsDir }
|
||||
} catch {
|
||||
Write-Log "pip install failed: $_" "ERROR"; exit 6
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ Optional flags:
|
||||
--no-playwright Skip running `python -m playwright install` (still installs deps)
|
||||
--playwright-only Install only Playwright browsers (installs playwright package if missing)
|
||||
--browsers Comma-separated list of Playwright browsers to install (default: chromium)
|
||||
--install-editable Install the project in editable mode (pip install -e .) for running tests
|
||||
--install-editable Install the project in editable mode (pip install -e scripts) for running tests
|
||||
--install-deno Install the Deno runtime using the official installer
|
||||
--no-deno Skip installing the Deno runtime
|
||||
--deno-version Pin a specific Deno version to install (e.g., v1.34.3)
|
||||
@@ -256,7 +256,7 @@ def main() -> int:
|
||||
parser.add_argument(
|
||||
"--install-editable",
|
||||
action="store_true",
|
||||
help="Install the project in editable mode (pip install -e .) for running tests",
|
||||
help="Install the project in editable mode (pip install -e scripts) for running tests",
|
||||
)
|
||||
deno_group = parser.add_mutually_exclusive_group()
|
||||
deno_group.add_argument(
|
||||
@@ -690,7 +690,7 @@ def main() -> int:
|
||||
# Install the project into the local venv (editable mode is the default, opinionated)
|
||||
if not args.quiet:
|
||||
print("Installing project into local venv (editable mode)")
|
||||
run([str(venv_python), "-m", "pip", "install", "-e", "."])
|
||||
run([str(venv_python), "-m", "pip", "install", "-e", str(repo_root / "scripts")])
|
||||
|
||||
# Verify top-level 'CLI' import and, if missing, attempt to make it available
|
||||
if not args.quiet:
|
||||
@@ -890,10 +890,10 @@ python -m medeia_macina.cli_entry @args
|
||||
" fi\n"
|
||||
"fi\n"
|
||||
"# If git not available or didn't resolve, walk up from CWD to find a project root.\n"
|
||||
'if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then\n'
|
||||
'if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ] && [ ! -f "$REPO/scripts/pyproject.toml" ]; then\n'
|
||||
' CUR="$(pwd -P)"\n'
|
||||
' while [ "$CUR" != "/" ] && [ "$CUR" != "" ]; do\n'
|
||||
' if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ]; then\n'
|
||||
' if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ] || [ -f "$CUR/scripts/pyproject.toml" ]; then\n'
|
||||
' REPO="$CUR"\n'
|
||||
" break\n"
|
||||
" fi\n"
|
||||
|
||||
@@ -236,7 +236,7 @@ if [[ "$EUID" -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
# Basic sanity check: ensure the detected repo root actually looks like the project
|
||||
if [[ ! -f "$REPO/pyproject.toml" && ! -f "$REPO/setup.py" && ! -f "$REPO/CLI.py" ]]; then
|
||||
if [[ ! -f "$REPO/pyproject.toml" && ! -f "$REPO/scripts/pyproject.toml" && ! -f "$REPO/setup.py" && ! -f "$REPO/CLI.py" ]]; then
|
||||
echo "WARNING: Detected repo root ($REPO) does not contain pyproject.toml, setup.py, or CLI.py; attempting to locate project root via git or current working directory..." >&2
|
||||
if git -C "$SCRIPT_DIR/.." rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||
REPO="$(git -C "$SCRIPT_DIR/.." rev-parse --show-toplevel)"
|
||||
@@ -323,10 +323,10 @@ if [[ "$NOINSTALL" != "true" ]]; then # If not explicitly requested, auto-selec
|
||||
|
||||
if [[ "$EDITABLE" == "true" ]]; then
|
||||
echo "Installing project in editable mode..."
|
||||
"$VENV_PY" -m pip install -e "$REPO"
|
||||
"$VENV_PY" -m pip install -e "$REPO/scripts"
|
||||
else
|
||||
echo "Installing project..."
|
||||
"$VENV_PY" -m pip install "$REPO"
|
||||
"$VENV_PY" -m pip install "$REPO/scripts"
|
||||
fi
|
||||
|
||||
# Verify the installed CLI module can be imported. This helps catch packaging
|
||||
@@ -386,7 +386,7 @@ PY
|
||||
|
||||
else
|
||||
echo "WARNING: Could not import 'medeia_macina.cli_entry' from the venv." >&2
|
||||
echo "Action: Try running: $VENV_PY -m pip install -e . or inspect the venv site-packages to verify the installation." >&2
|
||||
echo "Action: Try running: $VENV_PY -m pip install -e \"$REPO/scripts\" or inspect the venv site-packages to verify the installation." >&2
|
||||
fi
|
||||
|
||||
echo "Verifying environment for known issues (urllib3 compatibility)..."
|
||||
@@ -578,7 +578,7 @@ set -e
|
||||
# but prefer to discover a repo from the current working directory or git.
|
||||
REPO="__REPO__"
|
||||
# If the placeholder does not appear to point at a repo, attempt discovery.
|
||||
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
|
||||
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ] && [ ! -f "$REPO/scripts/pyproject.toml" ]; then
|
||||
# First try to find a git toplevel from the current working directory.
|
||||
if command -v git >/dev/null 2>&1; then
|
||||
gitroot=$(git -C "$(pwd -P)" rev-parse --show-toplevel 2>/dev/null || true)
|
||||
@@ -588,10 +588,10 @@ if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
|
||||
fi
|
||||
fi
|
||||
# If still unresolved, walk up from the CWD looking for signs of the project.
|
||||
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
|
||||
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ] && [ ! -f "$REPO/scripts/pyproject.toml" ]; then
|
||||
CUR="$(pwd -P)"
|
||||
while [ "$CUR" != "/" ] && [ "$CUR" != "" ]; do
|
||||
if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ]; then
|
||||
if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ] || [ -f "$CUR/scripts/pyproject.toml" ]; then
|
||||
REPO="$CUR"
|
||||
break
|
||||
fi
|
||||
|
||||
187
scripts/pyproject.toml
Normal file
187
scripts/pyproject.toml
Normal file
@@ -0,0 +1,187 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=65.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "medeia-macina"
|
||||
version = "0.1.0"
|
||||
description = "Comprehensive media management and search platform with support for local files, Hydrus database, torrents, books, and P2P networks"
|
||||
readme = "../readme.md"
|
||||
requires-python = ">=3.9,<3.14"
|
||||
license = {text = "MIT"}
|
||||
authors = [
|
||||
{name = "Your Name", email = "your.email@example.com"}
|
||||
]
|
||||
keywords = ["media", "search", "management", "hydrus", "download", "cli", "tui"]
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Topic :: Multimedia",
|
||||
"Topic :: Internet",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
# Core CLI and TUI frameworks
|
||||
"typer>=0.9.0",
|
||||
"prompt-toolkit>=3.0.0",
|
||||
"textual>=0.30.0",
|
||||
|
||||
# Media processing and downloading
|
||||
"yt-dlp[default]>=2023.11.0",
|
||||
"yt-dlp-ejs", # EJS challenge solver scripts for YouTube JavaScript challenges
|
||||
"requests>=2.31.0",
|
||||
"charset-normalizer>=3.2.0",
|
||||
"certifi>=2024.12.0",
|
||||
"httpx>=0.25.0",
|
||||
|
||||
# Document and data handling
|
||||
"pypdf>=3.0.0",
|
||||
"mutagen>=1.46.0",
|
||||
"cbor2>=4.0",
|
||||
"zstandard>=0.23.0",
|
||||
|
||||
# Image and media support
|
||||
"Pillow>=10.0.0",
|
||||
"python-bidi>=0.4.2",
|
||||
"ffmpeg-python>=0.2.0",
|
||||
|
||||
# Metadata extraction and processing
|
||||
"musicbrainzngs>=0.7.0",
|
||||
"lxml>=4.9.0",
|
||||
|
||||
# Advanced searching and libraries
|
||||
# Optional Soulseek support installs aioslsk>=1.6.0 when [provider=soulseek] is configured.
|
||||
"imdbinfo>=0.1.10",
|
||||
|
||||
# Encryption and security
|
||||
"pycryptodome>=3.18.0",
|
||||
|
||||
# Data processing
|
||||
"bencode3",
|
||||
"tqdm>=4.66.0",
|
||||
|
||||
# Browser automation
|
||||
"playwright>=1.40.0",
|
||||
|
||||
# Development and utilities
|
||||
"python-dateutil>=2.8.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
# Testing
|
||||
"pytest>=7.4.0",
|
||||
"pytest-cov>=4.1.0",
|
||||
"pytest-asyncio>=0.21.0",
|
||||
|
||||
# Code quality
|
||||
"black>=23.11.0",
|
||||
"flake8>=6.1.0",
|
||||
"isort>=5.12.0",
|
||||
"mypy>=1.7.0",
|
||||
"pylint>=3.0.0",
|
||||
|
||||
# Documentation
|
||||
"sphinx>=7.2.0",
|
||||
"sphinx-rtd-theme>=1.3.0",
|
||||
|
||||
# Debugging and profiling
|
||||
"ipython>=8.17.0",
|
||||
"ipdb>=0.13.0",
|
||||
"memory-profiler>=0.61.0",
|
||||
|
||||
# Version control and CI/CD helpers
|
||||
"pre-commit>=3.5.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
mm = "medeia_macina.cli_entry:main"
|
||||
medeia = "medeia_macina.cli_entry:main"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/yourusername/medeia-macina"
|
||||
Documentation = "https://medeia-macina.readthedocs.io"
|
||||
Repository = "https://github.com/yourusername/medeia-macina.git"
|
||||
Issues = "https://github.com/yourusername/medeia-macina/issues"
|
||||
|
||||
[tool.setuptools]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = [".."]
|
||||
exclude = ["tests*", "docs*"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ['py39', 'py310', 'py311', 'py312']
|
||||
include = '\\.pyi?$'
|
||||
extend-exclude = '''
|
||||
/(
|
||||
# directories
|
||||
\.eggs
|
||||
| \.git
|
||||
| \.hg
|
||||
| \.mypy_cache
|
||||
| \.tox
|
||||
| \.venv
|
||||
| _build
|
||||
| buck-out
|
||||
| build
|
||||
| dist
|
||||
| __pycache__
|
||||
)/
|
||||
'''
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 100
|
||||
target_version = ["py39", "py310", "py311", "py312"]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.9"
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
disallow_untyped_defs = false
|
||||
disallow_incomplete_defs = false
|
||||
check_untyped_defs = false
|
||||
no_implicit_optional = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
warn_no_return = true
|
||||
|
||||
[tool.pylint.messages_control]
|
||||
disable = [
|
||||
"C0330", "C0326", # Bad whitespace
|
||||
"R0913", # Too many arguments
|
||||
"R0914", # Too many local variables
|
||||
]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
python_files = ["test_*.py", "*_test.py"]
|
||||
addopts = "-v --cov=. --cov-report=html --cov-report=term-missing"
|
||||
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
omit = [
|
||||
"*/tests/*",
|
||||
"*/__main__.py",
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
exclude_lines = [
|
||||
"pragma: no cover",
|
||||
"def __repr__",
|
||||
"raise AssertionError",
|
||||
"raise NotImplementedError",
|
||||
"if __name__ == .__main__.:",
|
||||
"if TYPE_CHECKING:",
|
||||
]
|
||||
Reference in New Issue
Block a user