Skip to content

Commit 0d76155

Browse files
committed
Initial commit
0 parents  commit 0d76155

35 files changed

+1513
-0
lines changed

.github/workflows/pages.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: "pages"
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: "3.3"
25+
bundler-cache: true
26+
27+
- name: Build site
28+
run: bundle exec jekyll build
29+
env:
30+
JEKYLL_ENV: production
31+
32+
- uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: _site
35+
36+
deploy:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deployment.outputs.page_url }}
42+
steps:
43+
- id: deployment
44+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# IDEs
2+
.idea/
3+
.vscode/
4+
5+
# Python
6+
__pycache__/
7+
*.py[cod]
8+
*.pyo
9+
*.egg-info/
10+
dist/
11+
build/
12+
13+
# Type-checking / linting caches
14+
.mypy_cache/
15+
.ruff_cache/
16+
17+
# Environment
18+
.env
19+
.venv/
20+
venv/
21+
22+
# Jekyll
23+
_site/
24+
.jekyll-cache/
25+
.jekyll-metadata
26+
Gemfile.lock
27+
28+
# OS
29+
.DS_Store
30+
Thumbs.db

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem "jekyll", "~> 4.3"
4+
gem "just-the-docs", "~> 0.10"
5+
6+
group :jekyll_plugins do
7+
gem "jekyll-seo-tag"
8+
end

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Yakhyokhuja Valikhujaev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SOLID Principles in Python
2+
3+
<p align="center">
4+
<img src="assets/banner.png" alt="SOLID Principles in Python" />
5+
</p>
6+
7+
<p align="center">
8+
<b>Learn SOLID design principles through Python examples — violation vs correct, with UML diagrams.</b>
9+
</p>
10+
11+
<p align="center">
12+
<a href="https://yakhyo.github.io/solid-python/">Documentation</a> · <a href="https://yakhyo.github.io/solid-python/uz/">O'zbekcha</a>
13+
</p>
14+
15+
## Quick start
16+
17+
```bash
18+
python docs/01-srp/violation.py
19+
python docs/01-srp/correct.py
20+
```
21+
22+
Requires **Python 3.10+**, no external dependencies.
23+
24+
## Docs site locally
25+
26+
```bash
27+
bundle install
28+
bundle exec jekyll serve --livereload
29+
```
30+
31+
Then open `http://localhost:4000/solid-python/`
32+
33+
## Structure
34+
35+
```text
36+
docs/
37+
├── 01-srp/ # Single Responsibility
38+
├── 02-ocp/ # Open/Closed
39+
├── 03-lsp/ # Liskov Substitution
40+
├── 04-isp/ # Interface Segregation
41+
├── 05-dip/ # Dependency Inversion
42+
│ ├── violation.py # What goes wrong
43+
│ ├── correct.py # How to fix it
44+
│ ├── README.md # English docs
45+
│ └── README.uz.md # Uzbek docs
46+
├── index.md # Home (EN)
47+
└── index.uz.md # Home (UZ)
48+
```
49+
50+
## License
51+
52+
MIT — [LICENSE](LICENSE)

_config.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
title: SOLID Principles in Python
2+
description: Learn the five SOLID design principles with Python examples — violation vs correct, with UML diagrams.
3+
4+
theme: just-the-docs
5+
6+
url: "https://yakhyo.github.io"
7+
baseurl: "/solid-python"
8+
9+
repo_url: "https://github.com/yakhyo/solid-python"
10+
11+
author:
12+
name: Yakhyokhuja Valikhujaev
13+
email: "yakhyo9696@gmail.com"
14+
15+
aux_links:
16+
"GitHub":
17+
- "https://github.com/yakhyo/solid-python"
18+
19+
aux_links_new_tab: true
20+
21+
nav_sort: case_insensitive
22+
23+
heading_anchors: true
24+
25+
back_to_top: true
26+
back_to_top_text: "Back to top"
27+
28+
enable_copy_code_button: true
29+
30+
gh_edit_link: true
31+
gh_edit_link_text: "Edit this page on GitHub"
32+
gh_edit_repository: "https://github.com/yakhyo/solid-python"
33+
gh_edit_branch: "main"
34+
gh_edit_source: ""
35+
gh_edit_view_mode: "edit"
36+
37+
plugins:
38+
- jekyll-seo-tag
39+
40+
footer_content: >-
41+
&copy; 2025 Yakhyokhuja Valikhujaev.
42+
Distributed under the <a href="https://github.com/yakhyo/solid-python/blob/main/LICENSE">MIT License</a>.
43+
44+
sass:
45+
quiet_deps: true
46+
silence_deprecations:
47+
- import
48+
- global-builtin
49+
- color-functions
50+
51+
exclude:
52+
- "*.py"
53+
- "__pycache__"
54+
- Gemfile.lock
55+
- README.md
56+
- LICENSE
57+
- .github
58+
59+
callouts:
60+
warning:
61+
title: Warning
62+
color: red
63+
note:
64+
title: Note
65+
color: blue
66+
tip:
67+
title: Tip
68+
color: green

_includes/head_custom.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<style>
2+
.theme-toggle {
3+
position: fixed;
4+
bottom: 1.5rem;
5+
right: 1.5rem;
6+
z-index: 999;
7+
background: var(--body-background-color);
8+
border: 1px solid var(--border-color);
9+
border-radius: 50%;
10+
width: 2.5rem;
11+
height: 2.5rem;
12+
cursor: pointer;
13+
font-size: 1.2rem;
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
18+
transition: transform 0.2s ease;
19+
}
20+
.theme-toggle:hover {
21+
transform: scale(1.1);
22+
}
23+
</style>
24+
25+
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle dark mode"></button>
26+
27+
<script>
28+
(function () {
29+
var btn = document.getElementById("theme-toggle");
30+
var prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
31+
var current = localStorage.getItem("theme") || (prefersDark ? "dark" : "light");
32+
33+
function apply(theme) {
34+
jtd.setTheme(theme);
35+
btn.innerHTML = theme === "dark"
36+
? '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>'
37+
: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>';
38+
localStorage.setItem("theme", theme);
39+
}
40+
41+
apply(current);
42+
43+
btn.addEventListener("click", function () {
44+
var next = localStorage.getItem("theme") === "dark" ? "light" : "dark";
45+
apply(next);
46+
});
47+
48+
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", function (e) {
49+
if (!localStorage.getItem("theme")) {
50+
apply(e.matches ? "dark" : "light");
51+
}
52+
});
53+
})();
54+
</script>

assets/01-srp.png

55.2 KB
Loading

assets/02-ocp.png

64.4 KB
Loading

assets/03-lsp.png

58.5 KB
Loading

0 commit comments

Comments
 (0)