mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Create GitHub Pages docs with Sphinx (#11888)
This commit is contained in:
parent
260e3d8b35
commit
e9e7c96465
|
@ -1,5 +1,5 @@
|
|||
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
|
||||
ARG VARIANT=3.12-bookworm
|
||||
ARG VARIANT=3.13-bookworm
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
|
||||
COPY requirements.txt /tmp/pip-tmp/
|
||||
RUN python3 -m pip install --upgrade pip \
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Update 'VARIANT' to pick a Python version: 3, 3.11, 3.10, 3.9, 3.8
|
||||
// Append -bullseye or -buster to pin to an OS version.
|
||||
// Use -bullseye variants on local on arm64/Apple Silicon.
|
||||
"VARIANT": "3.12-bookworm",
|
||||
"VARIANT": "3.13-bookworm",
|
||||
}
|
||||
},
|
||||
|
||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -9,8 +9,6 @@
|
|||
|
||||
/.* @cclauss
|
||||
|
||||
# /arithmetic_analysis/
|
||||
|
||||
# /backtracking/
|
||||
|
||||
# /bit_manipulation/
|
||||
|
|
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
@ -25,12 +25,13 @@ jobs:
|
|||
- name: Run tests
|
||||
# TODO: #8818 Re-enable quantum tests
|
||||
run: pytest
|
||||
--ignore=quantum/q_fourier_transform.py
|
||||
--ignore=computer_vision/cnn_classification.py
|
||||
--ignore=docs/conf.py
|
||||
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
|
||||
--ignore=machine_learning/lstm/lstm_prediction.py
|
||||
--ignore=neural_network/input_data.py
|
||||
--ignore=project_euler/
|
||||
--ignore=quantum/q_fourier_transform.py
|
||||
--ignore=scripts/validate_solutions.py
|
||||
--cov-report=term-missing:skip-covered
|
||||
--cov=. .
|
||||
|
|
50
.github/workflows/sphinx.yml
vendored
Normal file
50
.github/workflows/sphinx.yml
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
name: sphinx
|
||||
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the "master" branch
|
||||
push:
|
||||
branches: ["master"]
|
||||
pull_request:
|
||||
branches: ["master"]
|
||||
# Or manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build_docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
allow-prereleases: true
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install myst-parser sphinx-autoapi sphinx-pyproject
|
||||
- uses: actions/configure-pages@v5
|
||||
- run: sphinx-build -c docs . docs/_build/html
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs/_build/html
|
||||
|
||||
deploy_docs:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
if: github.event_name != 'pull_request'
|
||||
needs: build_docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/deploy-pages@v4
|
||||
id: deployment
|
|
@ -77,7 +77,7 @@ pre-commit run --all-files --show-diff-on-failure
|
|||
|
||||
We want your work to be readable by others; therefore, we encourage you to note the following:
|
||||
|
||||
- Please write in Python 3.12+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
|
||||
- Please write in Python 3.13+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
|
||||
- Please focus hard on the naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
|
||||
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
|
||||
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
|
||||
|
|
|
@ -351,6 +351,9 @@
|
|||
* [Power](divide_and_conquer/power.py)
|
||||
* [Strassen Matrix Multiplication](divide_and_conquer/strassen_matrix_multiplication.py)
|
||||
|
||||
## Docs
|
||||
* [Conf](docs/conf.py)
|
||||
|
||||
## Dynamic Programming
|
||||
* [Abbreviation](dynamic_programming/abbreviation.py)
|
||||
* [All Construct](dynamic_programming/all_construct.py)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
MIT License
|
||||
## MIT License
|
||||
|
||||
Copyright (c) 2016-2022 TheAlgorithms and contributors
|
||||
|
||||
|
|
3
docs/conf.py
Normal file
3
docs/conf.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from sphinx_pyproject import SphinxConfig
|
||||
|
||||
project = SphinxConfig("../pyproject.toml", globalns=globals()).name
|
|
@ -1,4 +1,4 @@
|
|||
### Interest
|
||||
# Interest
|
||||
|
||||
* Compound Interest: "Compound interest is calculated by multiplying the initial principal amount by one plus the annual interest rate raised to the number of compound periods minus one." [Compound Interest](https://www.investopedia.com/)
|
||||
* Simple Interest: "Simple interest paid or received over a certain period is a fixed percentage of the principal amount that was borrowed or lent. " [Simple Interest](https://www.investopedia.com/)
|
10
index.md
Normal file
10
index.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# TheAlgorithms/Python
|
||||
```{toctree}
|
||||
:maxdepth: 2
|
||||
:caption: index.md
|
||||
|
||||
<!-- CONTRIBUTING.md must be the FIRST doc and README.md can come after. -->
|
||||
CONTRIBUTING.md
|
||||
README.md
|
||||
LICENSE.md
|
||||
```
|
106
pyproject.toml
106
pyproject.toml
|
@ -1,5 +1,22 @@
|
|||
[project]
|
||||
name = "thealgorithms-python"
|
||||
version = "0.0.1"
|
||||
description = "TheAlgorithms in Python"
|
||||
authors = [ { name = "TheAlgorithms Contributors" } ]
|
||||
requires-python = ">=3.13"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
|
||||
]
|
||||
optional-dependencies.docs = [
|
||||
"myst-parser",
|
||||
"sphinx-autoapi",
|
||||
"sphinx-pyproject",
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py312"
|
||||
target-version = "py313"
|
||||
|
||||
output-format = "full"
|
||||
lint.select = [
|
||||
|
@ -113,6 +130,9 @@ lint.pylint.max-statements = 88 # default: 50
|
|||
ignore-words-list = "3rt,ans,bitap,crate,damon,fo,followings,hist,iff,kwanza,manuel,mater,secant,som,sur,tim,toi,zar"
|
||||
skip = "./.*,*.json,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictionary.txt,strings/words.txt"
|
||||
|
||||
[tool.pyproject-fmt]
|
||||
max_supported_python = "3.13"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
markers = [
|
||||
"mat_ops: mark a test as utilizing matrix operations.",
|
||||
|
@ -129,3 +149,87 @@ omit = [
|
|||
"project_euler/*",
|
||||
]
|
||||
sort = "Cover"
|
||||
|
||||
[tool.sphinx-pyproject]
|
||||
copyright = "2014, TheAlgorithms"
|
||||
autoapi_dirs = [
|
||||
"audio_filters",
|
||||
"backtracking",
|
||||
"bit_manipulation",
|
||||
"blockchain",
|
||||
"boolean_algebra",
|
||||
"cellular_automata",
|
||||
"ciphers",
|
||||
"compression",
|
||||
"computer_vision",
|
||||
"conversions",
|
||||
"data_structures",
|
||||
"digital_image_processing",
|
||||
"divide_and_conquer",
|
||||
"dynamic_programming",
|
||||
"electronics",
|
||||
"file_transfer",
|
||||
"financial",
|
||||
"fractals",
|
||||
"fuzzy_logic",
|
||||
"genetic_algorithm",
|
||||
"geodesy",
|
||||
"geometry",
|
||||
"graphics",
|
||||
"graphs",
|
||||
"greedy_methods",
|
||||
"hashes",
|
||||
"knapsack",
|
||||
"linear_algebra",
|
||||
"linear_programming",
|
||||
"machine_learning",
|
||||
"maths",
|
||||
"matrix",
|
||||
"networking_flow",
|
||||
"neural_network",
|
||||
"other",
|
||||
"physics",
|
||||
"project_euler",
|
||||
"quantum",
|
||||
"scheduling",
|
||||
"searches",
|
||||
"sorts",
|
||||
"strings",
|
||||
"web_programming",
|
||||
]
|
||||
autoapi_member_order = "groupwise"
|
||||
# autoapi_python_use_implicit_namespaces = true
|
||||
exclude_patterns = [
|
||||
".*/*",
|
||||
"docs/",
|
||||
]
|
||||
extensions = [
|
||||
"autoapi.extension",
|
||||
"myst_parser",
|
||||
]
|
||||
html_static_path = [ "_static" ]
|
||||
html_theme = "alabaster"
|
||||
myst_enable_extensions = [
|
||||
"amsmath",
|
||||
"attrs_inline",
|
||||
"colon_fence",
|
||||
"deflist",
|
||||
"dollarmath",
|
||||
"fieldlist",
|
||||
"html_admonition",
|
||||
"html_image",
|
||||
# "linkify",
|
||||
"replacements",
|
||||
"smartquotes",
|
||||
"strikethrough",
|
||||
"substitution",
|
||||
"tasklist",
|
||||
]
|
||||
myst_fence_as_directive = [
|
||||
"include",
|
||||
]
|
||||
templates_path = [ "_templates" ]
|
||||
[tool.sphinx-pyproject.source_suffix]
|
||||
".rst" = "restructuredtext"
|
||||
# ".txt" = "markdown"
|
||||
".md" = "markdown"
|
||||
|
|
|
@ -15,6 +15,7 @@ requests
|
|||
rich
|
||||
# scikit-fuzzy # uncomment once fuzzy_logic/fuzzy_operations.py is fixed
|
||||
scikit-learn
|
||||
sphinx_pyproject
|
||||
statsmodels
|
||||
sympy
|
||||
tensorflow ; python_version < '3.13'
|
||||
|
|
Loading…
Reference in New Issue
Block a user