Skip to content

Conversation

@filipchristiansen
Copy link
Contributor

@filipchristiansen filipchristiansen commented Dec 28, 2024

This pull request introduces several improvements to modernize the codebase, optimize the CI workflow, and automate package publishing:

  1. Updated Type Hints:

    • Used pyupgrade with --py39-plus and --py310-plus flags to upgrade type hints to Python 3.9+ and 3.10+ syntax.
  2. Enforced Double Quotes:

    • Removed skip-string-normalization = true from the black configuration in pyproject.toml.
    • Reran black via pre-commit hooks to enforce double quotes in the codebase.
  3. Refactored Dependency Management:

    • Split requirements.txt into requirements.txt (runtime dependencies) and requirements-dev.txt (development dependencies).
  4. Enhanced CI Workflow:

    • Integrated pre-commit hooks into the CI pipeline to enforce code quality checks automatically.
    • Added pip caching to the CI workflow to speed up dependency installation.
  5. Automated Package Publishing:

    • Added a publish.yml GitHub Actions workflow to automate publishing to PyPI.
    • The workflow triggers on release creation or manual dispatch, builds the package, and publishes it to PyPI using twine.

These changes aim to maintain code consistency, streamline dependency management, improve the efficiency of the CI pipeline, and simplify package distribution.

filipchristiansen and others added 14 commits December 26, 2024 10:02
- Add .pre-commit-config.yaml and pyproject.toml for Black and isort
- Add missing type hints throughout the code (Dict[...] for Python 3.8 compatibility)
- Added badges and convert existing badges to use <a><img></a> format
- Lint Markdown files
- Lint Jinja templates with djlint
…bility, and functionality.

- **Introduced the `CloneConfig` dataclass** to encapsulate cloning parameters, including `url`, `local_path`, `commit`, and `branch`.
- **Enhanced documentation** by adding detailed docstrings to the functions `check_repo_exists`, `run_git_command`, and `clone_repo`.
- **Improved error handling** by refining exception management processes.
- **Streamlined repository existence checks** for increased reliability.
- **Added the `run_git_command` function** to centralize and simplify the execution of Git commands.
- **Refactored code structure** to enhance readability and maintainability.

---

- **Replaced manual hexadecimal comparison (`"0123456789abcdefABCDEF"`)** with the `string` module by defining `HEX_DIGITS = set(string.hexdigits)`.
- **Revised the construction of the `parsed` dictionary** in the `parse_url` function for clarity.
- **Refactored the `parse_patterns` function** to store patterns in a list (`patterns`) instead of repeatedly joining and splitting them.
- **Enhanced documentation** by adding docstrings to the `override_ignore_patterns` and `parse_query` functions.
- **Removed redundant `pattern.strip()` call** in `normalize_pattern`, as this is now handled within `parse_patterns`.
- **Optimized the `override_ignore_patterns` function** by implementing set difference for unordered comparisons.
- **Improved the `parse_query` function's structure** for better readability and maintainability.

---

- **Refined `print_query`, `print_error`, and `print_success` functions** to accept only the `url` parameter, removing the dependency on the entire `query` object.
- **Eliminated the unused `request` argument** from the above functions.
- **Integrated the `CloneConfig` dataclass** for improved parameter handling.

---

- **Adopted the `CloneConfig` dataclass** for consistent parameter management.

---

- **Removed the unused `files` argument** from the `create_summary_string` function to reduce unnecessary complexity.

---

- **Simplified the `AsyncTimeoutError` class** by removing a redundant `pass` statement.

---

- **Updated tests** to utilize the `CloneConfig` dataclass and align with the newly introduced `run_git_command` function for encapsulated Git command execution.

---

- **Aligned comparison with `DEFAULT_IGNORE_PATTERNS`** to use a set difference, ensuring unordered existence comparison.
…bility

- **Revised the construction of the parsed dictionary** in the `parse_url` function for clarity.
- **Improved the `parse_query` function's structure** for better readability and maintainability.
@cyclotruc cyclotruc merged commit 848b9dc into coderamp-labs:main Dec 29, 2024
7 of 12 checks passed
@filipchristiansen filipchristiansen deleted the chore/modernize-code-style branch December 29, 2024 09:21
FOLKS-Tech pushed a commit to FOLKS-Tech/gitingest that referenced this pull request Sep 5, 2025
Updated Type Hints:

Used pyupgrade with --py39-plus and --py310-plus flags to upgrade type hints to Python 3.9+ and 3.10+ syntax.
Enforced Double Quotes:

Removed skip-string-normalization = true from the black configuration in pyproject.toml.
Reran black via pre-commit hooks to enforce double quotes in the codebase.
Refactored Dependency Management:

Split requirements.txt into requirements.txt (runtime dependencies) and requirements-dev.txt (development dependencies).
Enhanced CI Workflow:

Integrated pre-commit hooks into the CI pipeline to enforce code quality checks automatically.
Added pip caching to the CI workflow to speed up dependency installation.
Automated Package Publishing:

Added a publish.yml GitHub Actions workflow to automate publishing to PyPI.
The workflow triggers on release creation or manual dispatch, builds the package, and publishes it to PyPI using twine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants