Skip to content

Commit 1bcfb5a

Browse files
committed
Initial commit
1 parent 5b413da commit 1bcfb5a

36 files changed

Lines changed: 131 additions & 80 deletions

README.md

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,52 @@
1+
# SOLID Principles in Python
2+
13
<p align="center">
24
<img src="assets/banner.png" alt="SOLID Principles in Python" />
35
</p>
46

5-
Learn the five SOLID design principles with small Python examples (**violation** vs **correct**) and UML class diagrams.
6-
7-
| Docs site | https://yakhyo.github.io/solid-python/ |
8-
|-----------|----------------------------------------|
9-
| Source | https://github.com/yakhyo/solid-python |
10-
11-
## Requirements
12-
13-
- **Python 3.10+** (for running the examples)
14-
- **Ruby 3.x + Bundler** (only for running the docs site locally)
7+
<p align="center">
8+
<b>Learn SOLID design principles through Python examples — violation vs correct, with UML diagrams.</b>
9+
</p>
1510

16-
## Running the examples
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>
1714

18-
Each example is a standalone script with no external dependencies.
15+
## Quick start
1916

2017
```bash
21-
python 01-single-responsibility/violation.py
22-
python 01-single-responsibility/correct.py
18+
python docs/01-srp/violation.py
19+
python docs/01-srp/correct.py
2320
```
2421

25-
## Running the docs site locally
22+
Requires **Python 3.10+**, no external dependencies.
23+
24+
## Docs site locally
2625

2726
```bash
2827
bundle install
2928
bundle exec jekyll serve --livereload
3029
```
3130

32-
Open `http://localhost:4000/solid-python/` in your browser.
31+
Then open `http://localhost:4000/solid-python/`
3332

34-
## Repository layout
33+
## Structure
3534

3635
```text
37-
.
38-
├── 01-single-responsibility/ # S — Single Responsibility Principle
39-
│ ├── violation.py
40-
│ ├── correct.py
41-
│ ├── README.md # English docs
42-
│ └── README.uz.md # Uzbek docs
43-
├── 02-open-closed/ # O — Open/Closed Principle
44-
├── 03-liskov-substitution/ # L — Liskov Substitution Principle
45-
├── 04-interface-segregation/ # I — Interface Segregation Principle
46-
├── 05-dependency-inversion/ # D — Dependency Inversion Principle
47-
├── assets/ # UML class diagrams
48-
├── index.md / index.uz.md # Home pages (EN / UZ)
49-
├── _config.yml # Jekyll configuration
50-
├── Gemfile # Jekyll dependencies
51-
└── .github/workflows/
52-
└── pages.yml # GitHub Pages deployment
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)
5348
```
5449

5550
## License
5651

57-
MIT — see [LICENSE](LICENSE).
52+
MIT — [LICENSE](LICENSE)

_config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ footer_content: >-
4141
&copy; 2025 Yakhyokhuja Valikhujaev.
4242
Distributed under the <a href="https://github.com/yakhyo/solid-python/blob/main/LICENSE">MIT License</a>.
4343
44-
color_scheme: light
45-
4644
sass:
4745
quiet_deps: true
4846
silence_deprecations:

_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>
-57.5 KB
Binary file not shown.

assets/01-srp.png

55.2 KB
Loading

assets/02-ocp.png

64.4 KB
Loading

assets/02-open-closed.png

-67.6 KB
Binary file not shown.

assets/03-liskov-substitution.png

-61.4 KB
Binary file not shown.

assets/03-lsp.png

58.5 KB
Loading
-86.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)