{"id":22671274,"url":"https://github.com/loveduckie/bgs-test","last_synced_at":"2025-03-29T11:42:29.361Z","repository":{"id":266513384,"uuid":"896907348","full_name":"LoveDuckie/bgs-test","owner":"LoveDuckie","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-04T16:17:30.000Z","size":1497,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-04T17:25:45.785Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LoveDuckie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-01T15:46:22.000Z","updated_at":"2024-12-04T16:16:28.000Z","dependencies_parsed_at":"2024-12-04T17:36:02.369Z","dependency_job_id":null,"html_url":"https://github.com/LoveDuckie/bgs-test","commit_stats":null,"previous_names":["loveduckie/bgs-test"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoveDuckie%2Fbgs-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoveDuckie%2Fbgs-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoveDuckie%2Fbgs-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoveDuckie%2Fbgs-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LoveDuckie","download_url":"https://codeload.github.com/LoveDuckie/bgs-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237111701,"owners_count":19257387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T16:14:05.916Z","updated_at":"2025-02-04T11:51:57.645Z","avatar_url":"https://github.com/LoveDuckie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# **bgs-tool**\n\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n[![Build, Test, and Package: Python](https://github.com/LoveDuckie/bgs-test/actions/workflows/build_python.yml/badge.svg)](https://github.com/LoveDuckie/bgs-test/actions/workflows/build_python.yml)\n\n\u003c/div\u003e\n\n## Overview\n\n`bgs-tool` is the application satisfying the test requirements for BGS. Below, you'll find details on how to run the application, its structure, and the design choices made during development.\n\n---\n\n## Usage\n\n\u003e **Note:** Ensure you follow the installation instructions before using the tool.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/help-docs.gif\" width=\"65%\" alt=\"Help documentation output\" /\u003e\n\n\u003c/div\u003e\n\n### Example: All parameters\n\n```bash\n#!/usr/bin/env bash\nbgs-tool --create-test-files --min-file-size-bytes 1048576 --max-file-size-bytes 1048576 --max-group-size-megabytes 10 --method compact --min-files 20 --max-files 20\n```\n\n### Example: Create and Use Test Data\n\n#### Defaults\n\n- **Minimum Files:** 5\n- **Maximum Files:** 15\n- **Minimum File Size Bytes:** \n- **Maximum File Size Bytes:**\n\n**Using default values**\n\n```bash\n#!/bin/bash\nbgs-tool --create-test-files --max-group-size-megabytes 25 --method compact --validate\n```\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/example-usage.gif\" width=\"65%\" alt=\"Help documentation output\" /\u003e\n\n\u003c/div\u003e\n\n**Overriding file generation parameters**\n\n```bash\n#!/bin/bash\nbgs-tool --create-test-files --min-files 5 --max-files 15 --max-group-size-megabytes 25 --method default --validate\n```\n\n### Example: Use Existing Source Files\n\n```bash\n#!/bin/bash\nbgs-tool --source-dir \u003cPath Goes Here\u003e --max-group-size-megabytes 25 --method default --validate\n```\n\n## Installation\n\nThis project is structured as a `pip`-installable package, suitable for local or editable installation. Editable installations symbolically link the package to `site-packages` for the active Python version.\n\n### Installation Methods\n\n#### Using `pip`\n\n`pip` is the package management tool for Python. This project can be installed as a package.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/pip-usage-example.gif\" width=\"65%\" alt=\"pip usage example\" /\u003e\n\n\u003c/div\u003e\n\n#### Using `pip` with `virtualenv`\n\n`pip` can be paired with `virtualenv` to isolate project dependencies in a virtualized environment.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/pip-with-virtualenv.gif\" width=\"65%\" alt=\"pip with virtualenv example\" /\u003e\n\n\u003c/div\u003e\n\n#### Using `pipx`\n\n`pipx` installs Python tools in isolated virtual environments, avoiding pollution of the global `site-packages`.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/pipx-usage-example.gif\" width=\"65%\" alt=\"pipx usage example\" /\u003e\n\n\u003c/div\u003e\n\n---\n\n## Unit Tests\n\nUnit tests were defined as part of this test sample. You can run them using the following command with `poetry`.\n\n```bash\n#!/usr/bin/env bash\npoetry run coverage run -m unittest discover .\n```\n\n### Example Output\n\n```plaintext\n2024-12-06 12:15:50,736 - DEBUG - get_file_attributes executed in 0.000001 seconds\n.2024-12-06 12:15:50,755 - DEBUG - get_file_attributes executed in 0.000002 seconds\n.2024-12-06 12:15:50,758 - DEBUG - group_files_compact executed in 0.000676 seconds\n.2024-12-06 12:15:50,759 - DEBUG - group_files executed in 0.000250 seconds\n...2024-12-06 12:15:50,766 - DEBUG - group_files_compact executed in 0.000835 seconds\n...2024-12-06 12:15:50,777 - DEBUG - save_groups executed in 0.003467 seconds\n...\n----------------------------------------------------------------------\nRan 12 tests in 0.050s\n\nOK\n```\n\n---\n\n## Requirements\n\n- **Tested OS:** macOS Sonoma\n\n### Tools\n\nThis project uses the following tools:\n\n- **`poetry`:** Manages project dependencies and metadata.  \n  ⚠️ **No external dependencies were added—only core Python packages are used.**\n- **`pyenv`:** Manages multiple Python versions on the same system.  \n- **`pipx`:** Ensures isolated installations of packaged projects.  \n- **`virtualenv`:** Creates isolated dependency environments.\n\n### Pipelines\n\nThe project uses **GitHub Actions** for continuous integration, covering linting, testing, packaging, and publishing. The workflow file is located at `.github/workflows/build_python.yml`.\n\nPipeline steps include:\n\n1. **Dependency Installation**\n2. **Linting and Testing**:\n   - **Linting:** Runs `pylint` on project files.\n   - **Testing:** Executes `unittest` test cases with `coverage` for accuracy.\n3. **Building**:\n   - Packages the tool for distribution.\n\n---\n\n## Design Considerations\n\n### Code Standards\n\n- **PEP 8 Compliance:** The project adheres to Python's style guide, enforced via `pylint` with a ruleset specified in `.pylintrc`.\n- **PEP 517, 518, 621 Compliance:** Implements standards for project metadata and dependency management using `poetry`.\n\n### Performance\n\n- **Compact Packing Algorithm:** Optimizes file grouping for compactness. I've also included the initial implementation of the algorithm to illustrate the progression.\n- **Efficient Directory Listing:** Uses `DirEntry` objects and `yield` to process directories incrementally, reducing memory overhead for large directories.\n\n---\n\n## Additional Features\n\n### Bonus Contributions\n\nIn addition to meeting the core requirements, the following features were added:\n\n- **GitHub Actions CI/CD:** Automated linting, testing, and packaging with every commit.\n- **Project Management with `poetry`:** Includes scripts for command-line invocation (`bgs-tool`).\n- **Semantic Versioning:** Implemented using `poetry-bumpversion` for adherence to [Semantic Versioning](https://semver.org/).\n- **Helper Scripts:** Consistent configuration and output for developers working on the project.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**⚠️ Note:** All enhancements are strictly within the scope of the requirements.\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floveduckie%2Fbgs-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floveduckie%2Fbgs-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floveduckie%2Fbgs-test/lists"}