Skip to content

Conversation

tanmaykumarchaki
Copy link

@tanmaykumarchaki tanmaykumarchaki commented Aug 22, 2025

-Improved reliability:
Updated action versions (checkout@v5 → @v4, setup-uv@v6 → @V3) and pinned Python to "3.11" for consistent builds across environments -Enhanced caching strategy:
Extended dependency caching to include both uv.lock and pyproject.toml files, reducing CI run times for the team Added code quality gates:

-Integrated ruff linting to maintain code standards -Added pytest execution to catch regressions early -Implemented automatic package building for release readiness

-Better developer experience: Added descriptive step names and structured workflow for easier debugging and maintenance

-Streamlined configuration: Removed unnecessary allow-prereleases flag to prevent potential instability issues

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

-Improved reliability: 
Updated action versions (checkout@v5 → @v4, setup-uv@v6 → @V3) and pinned Python to "3.11" for consistent builds across environments
-Enhanced caching strategy:
Extended dependency caching to include both uv.lock and pyproject.toml files, reducing CI run times for the team
Added code quality gates:

-Integrated ruff linting to maintain code standards
-Added pytest execution to catch regressions early
-Implemented automatic package building for release readiness


-Better developer experience: Added descriptive step names and structured workflow for easier debugging and maintenance

-Streamlined configuration: Removed unnecessary allow-prereleases flag to prevent potential instability issues
@tanmaykumarchaki tanmaykumarchaki marked this pull request as draft August 22, 2025 14:06
@tanmaykumarchaki tanmaykumarchaki marked this pull request as ready for review August 22, 2025 14:44
@tanmaykumarchaki tanmaykumarchaki marked this pull request as draft August 22, 2025 14:48
run: uv run ruff check , --output-format=github


run: uv run ruff check , --output-format=github
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the comma (,) do on this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it .

Copy link
Member

@cclauss cclauss Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the . useful? If not, let's remove it.

@cclauss
Copy link
Member

cclauss commented Aug 23, 2025

Why does pre-commit fail?

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Checkout Repository
Copy link
Member

@cclauss cclauss Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step only has a name but no run or uses so this GHA is invalid https://github.com/TheAlgorithms/Python/actions/runs/17159313101

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanmaykumarchaki
Copy link
Author

Why does pre-commit fail?

The pre-commit fails due to some wrong indentation and some mismatched indents, let me see that.

schedule:
- cron: "0 0 * * *" # Run everyday
push:
branches: [main, develop]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo has no main or develop branch, so this change disables all push testing.

Comment on lines 7 to 8
- "*.md"
- "docs/**"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore these? docs contains Python code.

- "docs/**"

pull_request:
branches: [main]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo has no main branch, so this change disables all pull request testing.


pull_request:
branches: [main]
types: [opened, synchronize, reopened]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these?

types: [opened, synchronize, reopened]
paths-ignore:
- "*.md"
- "docs/**"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore these? docs contains Python code.

**/uv.lock
**/pyproject.toml
- name: Set up Python
uses: actions/setup-python@v5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hyphen on line 37 makes this entire file invalid.

actions/setup-python@v5 tells the reader more than Set up Python.

with:
python-version: 3.x
python-version: "3.11"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow-prereleases: true
- run: uv sync --group=test
- name: Install dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv sync --group=test tells the reader more than Install dependencies.

Comment on lines +43 to +44
uv sync --all-extras
uv pip list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not helpful. This has the potential to slow down the build and generate longer logs, which will go unread.

Comment on lines -37 to -38
- if: ${{ success() }}
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if and run commands need to be placed in the same job step, not in two separate job steps.

uv sync --all-extras
uv pip list
- name: Lint code
run: uv run ruff check . --output-format=github
Copy link
Member

@cclauss cclauss Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why run ruff again? It is already run in the pre-commit and dedicated ruff jobs.

@cclauss cclauss closed this Aug 23, 2025
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