Skip to content

Commit 846bc51

Browse files
authored
Merge branch 'TheAlgorithms:master' into master
2 parents 6ff0e1c + 8e70e2e commit 846bc51

File tree

1,306 files changed

+103740
-14721
lines changed

Some content is hidden

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

1,306 files changed

+103740
-14721
lines changed

.coveragerc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
2+
ARG VARIANT=3.13-bookworm
3+
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
4+
COPY requirements.txt /tmp/pip-tmp/
5+
RUN python3 -m pip install --upgrade pip \
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "Python 3",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
// Update 'VARIANT' to pick a Python version: 3, 3.11, 3.10, 3.9, 3.8
8+
// Append -bullseye or -buster to pin to an OS version.
9+
// Use -bullseye variants on local on arm64/Apple Silicon.
10+
"VARIANT": "3.13-bookworm"
11+
}
12+
},
13+
14+
"postCreateCommand": "zsh .devcontainer/post_install",
15+
16+
// Configure tool-specific properties.
17+
"customizations": {
18+
// Configure properties specific to VS Code.
19+
"vscode": {
20+
// Set *default* container specific settings.json values on container create.
21+
"settings": {
22+
"python.defaultInterpreterPath": "/usr/local/bin/python",
23+
"python.linting.enabled": true,
24+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
25+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
26+
"terminal.integrated.defaultProfile.linux": "zsh"
27+
},
28+
29+
// Add the IDs of extensions you want installed when the container is created.
30+
"extensions": [
31+
"ms-python.python",
32+
"ms-python.vscode-pylance"
33+
]
34+
}
35+
},
36+
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
// "forwardPorts": [],
39+
40+
// Use 'postCreateCommand' to run commands after the container is created.
41+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
42+
43+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
45+
}

.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: 11 additions & 13 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,21 +19,21 @@
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

34-
/digital_image_processing/ @mateuszz0000
32+
# /digital_image_processing/
3533

3634
# /divide_and_conquer/
3735

38-
/dynamic_programming/ @Kush1101
36+
# /dynamic_programming/
3937

4038
# /file_transfer/
4139

@@ -59,17 +57,17 @@
5957

6058
# /machine_learning/
6159

62-
/maths/ @Kush1101
60+
# /maths/
6361

6462
# /matrix/
6563

6664
# /networking_flow/
6765

6866
# /neural_network/
6967

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

72-
/project_euler/ @dhruvmanila @Kush1101
70+
# /project_euler/
7371

7472
# /quantum/
7573

@@ -79,9 +77,9 @@
7977

8078
# /searches/
8179

82-
/sorts/ @mateuszz0000
80+
# /sorts/
8381

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

8684
# /traversals/
8785

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Bug report
2+
description: Create a bug report to help us address errors in the repository
3+
labels: [bug]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
Before requesting please search [existing issues](https://github.com/TheAlgorithms/Python/labels/bug).
9+
Usage questions such as "How do I...?" belong on the
10+
[Discord](https://discord.gg/c7MnfGFGa6) and will be closed.
11+
12+
- type: input
13+
attributes:
14+
label: "Repository commit"
15+
description: >
16+
The commit hash for `TheAlgorithms/Python` repository. You can get this
17+
by running the command `git rev-parse HEAD` locally.
18+
placeholder: "a0b0f414ae134aa1772d33bb930e5a960f9979e8"
19+
validations:
20+
required: true
21+
22+
- type: input
23+
attributes:
24+
label: "Python version (python --version)"
25+
placeholder: "Python 3.10.7"
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
attributes:
31+
label: "Dependencies version (pip freeze)"
32+
description: >
33+
This is the output of the command `pip freeze --all`. Note that the
34+
actual output might be different as compared to the placeholder text.
35+
placeholder: |
36+
appnope==0.1.3
37+
asttokens==2.0.8
38+
backcall==0.2.0
39+
...
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
attributes:
45+
label: "Expected behavior"
46+
description: "Describe the behavior you expect. May include images or videos."
47+
validations:
48+
required: true
49+
50+
- type: textarea
51+
attributes:
52+
label: "Actual behavior"
53+
validations:
54+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discord community
4+
url: https://discord.gg/c7MnfGFGa6
5+
about: Have any questions or need any help? Please contact us via Discord
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Feature request
2+
description: Suggest features, propose improvements, discuss new ideas.
3+
labels: [enhancement]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
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.
10+
Usage questions such as "How do I...?" belong on the
11+
[Discord](https://discord.gg/c7MnfGFGa6) and will be closed.
12+
13+
- type: textarea
14+
attributes:
15+
label: "Feature description"
16+
description: >
17+
This could include new topics or improving any existing implementations.
18+
validations:
19+
required: true

.github/ISSUE_TEMPLATE/other.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Other
2+
description: Use this for any other issues. PLEASE do not create blank issues
3+
labels: ["awaiting triage"]
4+
body:
5+
- type: textarea
6+
id: issuedescription
7+
attributes:
8+
label: What would you like to share?
9+
description: Provide a clear and concise explanation of your issue.
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
id: extrainfo
15+
attributes:
16+
label: Additional information
17+
description: Is there anything else we should know about this issue?
18+
validations:
19+
required: false

0 commit comments

Comments
 (0)