diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e9ceba7..ff81a0c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,5 +21,14 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install pytest pytest-cov + - name: Install the actual distribution + run: python -m pip install . + - name: Smoke-test installed CLI outside the checkout + run: | + cd "$RUNNER_TEMP" + file-extractor-pro --help + file-extractor-pro "$GITHUB_WORKSPACE" --extensions py --dry-run --preview-format json > preview.json + python -c "import json; p=json.load(open('preview.json', encoding='utf-8')); assert p['file_count'] > 0; print('Previewed', p['file_count'], 'files')" + python -c "from importlib.metadata import distribution; d=distribution('file-extractor-pro'); names={e.name for e in d.entry_points}; assert {'file-extractor-pro', 'file-extractor-pro-gui'} <= names, names" - name: Run full test suite with coverage gate run: python -m pytest -q diff --git a/README.md b/README.md index 3af157f..4d31a27 100644 --- a/README.md +++ b/README.md @@ -28,15 +28,22 @@ No account, API key, cloud upload, or third-party runtime package is required. **Requirements:** Python 3.9+; Tkinter is additionally required for the desktop interface. +**Install from source** (no PyPI release is required): + ```bash git clone https://github.com/cortega26/File-Extractor-Pro.git cd File-Extractor-Pro +python -m pip install . ``` +Installation provides two commands you can run from any directory: +`file-extractor-pro` for the CLI and `file-extractor-pro-gui` for the desktop app. +The CLI has no Tkinter requirement. + **1. Preview a folder without writing an output file:** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions py md json yaml \ --exclude-folders node_modules .venv build dist \ --dry-run @@ -45,7 +52,7 @@ python -m services.cli ./my-project \ **2. Extract those files and generate a JSON report:** remove `--dry-run` and give the output an explicit destination. ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions py md json yaml \ --exclude-folders node_modules .venv build dist \ --output ./project-context.txt \ @@ -55,12 +62,12 @@ python -m services.cli ./my-project \ **Prefer a desktop window?** ```bash -python file_extractor.py +file-extractor-pro-gui ``` Choose a folder, tune inclusion/exclusion rules, and select **Extract**. The interface shows progress, supports cancellation, and can generate a report. -> **Tip:** Run commands from the cloned File-Extractor-Pro directory, replacing `./my-project` with a real folder path. The example output paths are illustrative. +> **Without installing?** Run `python -m services.cli /path/to/project --dry-run` or `python file_extractor.py` directly from the cloned repository. Replace `/path/to/my-project` with your own folder. Example output paths are illustrative. `pip install .` installs this checkout locally; it does **not** imply that a package has been published to PyPI. ## See it in action @@ -79,7 +86,7 @@ my-project/ Preview the selection: ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions md py \ --exclude-folders node_modules .venv \ --dry-run @@ -143,7 +150,7 @@ Each section keeps its source path so readers can identify where its content cam ### Desktop app -Launch with `python file_extractor.py`. The GUI includes: +Launch with `file-extractor-pro-gui`. The GUI includes: - Folder picker and recently used folders - Inclusion/exclusion modes and custom extensions @@ -163,7 +170,7 @@ The **read-only preview is currently a CLI feature**, not a GUI button. ### Command-line interface -Run `python -m services.cli --help` for the current CLI help. +The installed executable runs from any directory. Run `file-extractor-pro --help` for the current CLI help.
CLI options @@ -191,7 +198,7 @@ Run `python -m services.cli --help` for the current CLI help. **Get a JSON preview for another tool to consume** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions py md json \ --dry-run --preview-format json > selection.json ``` @@ -201,7 +208,7 @@ This writes `selection.json` through your **shell's redirection**, not through t **Package only Python and Markdown** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions py md \ --output ./code-review.txt ``` @@ -209,7 +216,7 @@ python -m services.cli ./my-project \ **Use explicit directory and file exclusions** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions py md yaml \ --exclude-folders node_modules .venv dist build \ --exclude-files "*.generated.py" "*.min.js" \ @@ -219,7 +226,7 @@ python -m services.cli ./my-project \ **Collect text while excluding certain extension types** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --mode exclusion --extensions log db \ --exclude-folders node_modules .venv \ --output ./filtered-files.txt @@ -228,7 +235,7 @@ python -m services.cli ./my-project \ **Inspect every candidate filename, including hidden ones** ```bash -python -m services.cli ./my-project \ +file-extractor-pro /path/to/my-project \ --extensions "*" --include-hidden \ --exclude-folders .git node_modules .venv \ --dry-run @@ -279,9 +286,10 @@ Request a report using `--report extraction-report.json`. The structure resemble ## Development -Runtime dependencies are limited to the Python standard library (with Tkinter available for the GUI). To work on the code: +Runtime dependencies are limited to the Python standard library (with Tkinter available for the GUI). The project is packaged with setuptools for **local installation**, not automatically published to PyPI. To work on the code: ```bash +python -m pip install -e . python -m pip install -r requirements-dev.txt python -m pytest -q python tools/coverage_gate.py diff --git a/pyproject.toml b/pyproject.toml index c5ac0a0..a3354bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,55 @@ +[build-system] +requires = ["setuptools>=77", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "file-extractor-pro" +version = "0.1.0" +description = "Preview and combine selected local text files using a desktop GUI or CLI." +readme = "README.md" +requires-python = ">=3.9" +license = "MIT" +license-files = ["LICENSE"] +authors = [{ name = "Carlos Ortega González" }] +keywords = ["file extraction", "text aggregation", "developer tools", "context packaging"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Environment :: X11 Applications", + "Intended Audience :: Developers", + "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 :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities", +] +dependencies = [] + +[project.urls] +Homepage = "https://github.com/cortega26/File-Extractor-Pro" +Issues = "https://github.com/cortega26/File-Extractor-Pro/issues" + +[project.scripts] +file-extractor-pro = "services.cli:main" + +[project.gui-scripts] +file-extractor-pro-gui = "file_extractor:main" + +[tool.setuptools] +packages = ["services", "ui_support"] +py-modules = [ + "file_extractor", + "ui", + "processor", + "config_manager", + "constants", + "logging_utils", +] + [tool.isort] profile = "black" line_length = 88 diff --git a/requirements.txt b/requirements.txt index 9389a9a..87e4871 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -# Fix: testing_ci_coverage_plugin -# Ensure pytest's coverage options remain available in all environments. -pytest-cov>=4.1.0 +# File Extractor Pro does not require third-party runtime libraries. +# Install it from source with: python -m pip install . +# Tests, coverage and security scanners are in requirements-dev.txt. diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py index a564b28..680cc95 100644 --- a/tests/test_dependencies.py +++ b/tests/test_dependencies.py @@ -5,14 +5,32 @@ from pathlib import Path -# Fix: testing_ci_coverage_plugin -def test_pytest_cov_listed_in_runtime_requirements() -> None: - """pytest-cov must ship with the runtime requirements for CI coverage gates.""" - - requirements_path = Path(__file__).resolve().parents[1] / "requirements.txt" - contents = requirements_path.read_text(encoding="utf-8").splitlines() +def test_coverage_tooling_is_development_only() -> None: + """Runtime stays stdlib-only; pytest-cov belongs to dev requirements.""" + root = Path(__file__).resolve().parents[1] + runtime = (root / "requirements.txt").read_text(encoding="utf-8").splitlines() + development = ( + (root / "requirements-dev.txt").read_text(encoding="utf-8").splitlines() + ) + assert not any(line.startswith("pytest-cov") for line in runtime) + assert any(line.startswith("pytest-cov") for line in development) + + +def test_installable_distribution_declares_both_entry_points() -> None: + """The packaged CLI and GUI must remain available as installed commands.""" + import tomllib - assert any(line.startswith("pytest-cov") for line in contents) + pyproject_path = Path(__file__).resolve().parents[1] / "pyproject.toml" + data = tomllib.loads(pyproject_path.read_text(encoding="utf-8")) + project = data["project"] + assert project["name"] == "file-extractor-pro" + assert project["dependencies"] == [] + assert project["scripts"]["file-extractor-pro"] == "services.cli:main" + assert ( + project["gui-scripts"]["file-extractor-pro-gui"] + == "file_extractor:main" + ) + assert {"services", "ui_support"} <= set(data["tool"]["setuptools"]["packages"]) # Fix: Q-110