Skip to content

Commit caa4f56

Browse files
Merge branch 'master' into StockAndSpan_Doctests
2 parents ec23923 + 4394fd9 commit caa4f56

File tree

843 files changed

+24930
-5987
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

843 files changed

+24930
-5987
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
2-
ARG VARIANT=3.12-bookworm
2+
ARG VARIANT=3.13-bookworm
33
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
44
COPY requirements.txt /tmp/pip-tmp/
55
RUN python3 -m pip install --upgrade pip \
6-
&& python3 -m pip install --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
7-
&& pipx install pre-commit ruff \
8-
&& pre-commit install
6+
&& python3 -m pip install --no-cache-dir -r /tmp/pip-tmp/requirements.txt \
7+
&& pipx install pre-commit ruff

.devcontainer/README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
https://code.visualstudio.com/docs/devcontainers/tutorial
1+
# Development Container
2+
3+
This is **Devcontainer** configuration to provide a consistent development environment for all contributors.
4+
5+
## Features
6+
7+
- [x] Pre-configured **Python environment**
8+
- [x] Automatic installation of **pre-commit hooks**
9+
- [x] **Ruff** linter ready to check your code
10+
- [x] **Oh My Zsh** with plugins:
11+
- `zsh-autosuggestions`
12+
- `zsh-syntax-highlighting`
13+
14+
## Usage
15+
16+
1. Install [**Docker** ](https://www.docker.com/get-started/) and [**Visual Studio Code**](https://code.visualstudio.com/)
17+
2. Install the **Remote - Containers** extension in VS Code
18+
19+
- Do `CTRL+P`, paste this command and press `Enter`
20+
21+
```shell
22+
ext install ms-vscode-remote.remote-containers
23+
```
24+
3. Open this repository in VS Code
25+
4. When prompted, click **"Reopen in Container"**
26+
5. Wait for the environment to build and initialize
27+
28+
After setup:
29+
30+
- `pre-commit` hooks are installed
31+
- `ruff` and other tools are available
32+
- The shell uses Zsh by default
33+
34+
## Tips
35+
36+
To manually run checks on all files:
37+
38+
```bash
39+
pre-commit run --all-files
40+
```
41+
42+
> For further information here's [Microsoft tutorial about devcontainers.](https://code.visualstudio.com/docs/devcontainers/tutorial)

.devcontainer/devcontainer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
// Update 'VARIANT' to pick a Python version: 3, 3.11, 3.10, 3.9, 3.8
88
// Append -bullseye or -buster to pin to an OS version.
99
// Use -bullseye variants on local on arm64/Apple Silicon.
10-
"VARIANT": "3.12-bookworm",
10+
"VARIANT": "3.13-bookworm"
1111
}
1212
},
1313

14+
"postCreateCommand": "zsh .devcontainer/post_install",
15+
1416
// Configure tool-specific properties.
1517
"customizations": {
1618
// Configure properties specific to VS Code.
@@ -20,7 +22,8 @@
2022
"python.defaultInterpreterPath": "/usr/local/bin/python",
2123
"python.linting.enabled": true,
2224
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
23-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy"
25+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
26+
"terminal.integrated.defaultProfile.linux": "zsh"
2427
},
2528

2629
// Add the IDs of extensions you want installed when the container is created.

.devcontainer/post_install

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Begin post-installation steps..."
4+
5+
set -e
6+
7+
echo "Installing pre-commit hooks..."
8+
pre-commit install
9+
10+
echo "Installing Oh My Zsh plugins..."
11+
12+
# Install zsh-autosuggestions if not present
13+
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then
14+
echo "Cloning zsh-autosuggestions..."
15+
git clone https://github.com/zsh-users/zsh-autosuggestions \
16+
"${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
17+
fi
18+
19+
# Install zsh-syntax-highlighting if not present
20+
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ]; then
21+
echo "Cloning zsh-syntax-highlighting..."
22+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
23+
"${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
24+
fi
25+
26+
echo "Configuring plugins in ~/.zshrc..."
27+
sed -i '/^plugins=/c\plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' ~/.zshrc
28+
29+
echo "Post-installation steps completed successfully. Enjoy!"

.github/CODEOWNERS

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
# Order is important. The last matching pattern has the most precedence.
99

10-
/.* @cclauss @dhruvmanila
11-
12-
# /arithmetic_analysis/
10+
/.* @cclauss
1311

1412
# /backtracking/
1513

@@ -21,15 +19,15 @@
2119

2220
# /cellular_automata/
2321

24-
# /ciphers/ @cclauss # TODO: Uncomment this line after Hacktoberfest
22+
# /ciphers/
2523

2624
# /compression/
2725

2826
# /computer_vision/
2927

30-
# /conversions/ @cclauss # TODO: Uncomment this line after Hacktoberfest
28+
# /conversions/
3129

32-
# /data_structures/ @cclauss # TODO: Uncomment this line after Hacktoberfest
30+
# /data_structures/
3331

3432
# /digital_image_processing/
3533

@@ -67,7 +65,7 @@
6765

6866
# /neural_network/
6967

70-
# /other/ @cclauss # TODO: Uncomment this line after Hacktoberfest
68+
# /other/
7169

7270
# /project_euler/
7371

@@ -81,7 +79,7 @@
8179

8280
# /sorts/
8381

84-
# /strings/ @cclauss # TODO: Uncomment this line after Hacktoberfest
82+
# /strings/
8583

8684
# /traversals/
8785

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ body:
66
attributes:
77
value: >
88
Before requesting please search [existing issues](https://github.com/TheAlgorithms/Python/labels/enhancement).
9+
Do not create issues to implement new algorithms as these will be closed.
910
Usage questions such as "How do I...?" belong on the
1011
[Discord](https://discord.gg/c7MnfGFGa6) and will be closed.
1112
1213
- type: textarea
1314
attributes:
1415
label: "Feature description"
1516
description: >
16-
This could be new algorithms, data structures or improving any existing
17-
implementations.
17+
This could include new topics or improving any existing implementations.
1818
validations:
1919
required: true

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Keep GitHub Actions up to date with Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* [ ] Add an algorithm?
66
* [ ] Fix a bug or typo in an existing algorithm?
7+
* [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
78
* [ ] Documentation change?
89

910
### Checklist:

.github/workflows/build.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,30 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v4
12+
- uses: actions/checkout@v5
13+
- uses: astral-sh/setup-uv@v6
1414
with:
15-
python-version: 3.12
16-
allow-prereleases: true
17-
- uses: actions/cache@v3
15+
enable-cache: true
16+
cache-dependency-glob: uv.lock
17+
- uses: actions/setup-python@v5
1818
with:
19-
path: ~/.cache/pip
20-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip setuptools six wheel
24-
python -m pip install pytest-cov -r requirements.txt
19+
python-version: 3.x
20+
allow-prereleases: true
21+
- run: uv sync --group=test
2522
- name: Run tests
2623
# TODO: #8818 Re-enable quantum tests
27-
run: pytest
28-
--ignore=quantum/q_fourier_transform.py
29-
--ignore=project_euler/
30-
--ignore=scripts/validate_solutions.py
31-
--cov-report=term-missing:skip-covered
32-
--cov=. .
24+
run: uv run pytest
25+
--ignore=computer_vision/cnn_classification.py
26+
--ignore=docs/conf.py
27+
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
28+
--ignore=machine_learning/lstm/lstm_prediction.py
29+
--ignore=neural_network/input_data.py
30+
--ignore=project_euler/
31+
--ignore=quantum/q_fourier_transform.py
32+
--ignore=scripts/validate_solutions.py
33+
--ignore=web_programming/current_stock_price.py
34+
--ignore=web_programming/fetch_anime_and_play.py
35+
--cov-report=term-missing:skip-covered
36+
--cov=. .
3337
- if: ${{ success() }}
3438
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.github/workflows/devcontainer_ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test DevContainer Build
2+
3+
on:
4+
push:
5+
paths:
6+
- ".devcontainer/**"
7+
pull_request:
8+
paths:
9+
- ".devcontainer/**"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
- uses: devcontainers/[email protected]
17+
with:
18+
push: never
19+
runCmd: "true"

0 commit comments

Comments
 (0)