Skip to content

Commit e3056d3

Browse files
committed
Initial commit
0 parents  commit e3056d3

34 files changed

Lines changed: 1530 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
19+
- name: Install tools
20+
run: pip install ruff mypy
21+
22+
- name: Ruff lint
23+
run: ruff check .
24+
25+
- name: Ruff format check
26+
run: ruff format --check .
27+
28+
- name: Mypy type check
29+
run: mypy --strict .

.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: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SOLID Principles in Python
2+
3+
Learn the five SOLID design principles with small Python examples (**violation** vs **correct**) and UML class diagrams.
4+
5+
- **Docs site**: `https://yakhyo.github.io/solid-python/`
6+
- **Source code**: `https://github.com/yakhyo/solid-python`
7+
8+
## Requirements
9+
10+
- **Python**: 3.10+ (for running the examples)
11+
- **Ruby**: 3.x + **Bundler** (only if you want to run the Jekyll docs locally)
12+
13+
## Running the Python examples
14+
15+
Each example is a standalone script (no external Python dependencies).
16+
17+
```bash
18+
python srp/violation.py
19+
python srp/correct.py
20+
21+
python ocp/violation.py
22+
python ocp/correct.py
23+
```
24+
25+
## Running the documentation site locally (Jekyll)
26+
27+
This repo uses the **just-the-docs** theme and includes a `Gemfile` for local runs.
28+
29+
1) Install Ruby dependencies:
30+
31+
```bash
32+
bundle install
33+
```
34+
35+
2) Start the dev server:
36+
37+
```bash
38+
bundle exec jekyll serve --livereload
39+
```
40+
41+
3) Open the site:
42+
43+
- This project uses `baseurl: /solid-python`, so the local URL is typically:
44+
- `http://localhost:4000/solid-python/`
45+
46+
### Optional: serve at `/` locally
47+
48+
If you prefer `http://localhost:4000/` locally, override the baseurl:
49+
50+
```bash
51+
bundle exec jekyll serve --livereload --baseurl ""
52+
```
53+
54+
## Repository layout
55+
56+
```text
57+
.
58+
├── index.md # English docs home (Jekyll)
59+
├── index.uz.md # Uzbek docs home (Jekyll)
60+
├── srp/ ocp/ lsp/ isp/ dip/
61+
│ ├── violation.py
62+
│ ├── correct.py
63+
│ ├── README.md # English docs page
64+
│ └── README.uz.md # Uzbek docs page
65+
├── assets/ # UML diagrams
66+
├── _config.yml # Jekyll config
67+
└── Gemfile # Jekyll dependencies
68+
```
69+
70+
## License
71+
72+
MIT — see `LICENSE` in the repository.
73+

_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+
author:
10+
name: Yakhyokhuja Valikhujaev
11+
email: "yakhyo9696@gmail.com"
12+
13+
aux_links:
14+
"GitHub":
15+
- "https://github.com/yakhyo/solid-python"
16+
17+
aux_links_new_tab: true
18+
19+
nav_sort: case_insensitive
20+
21+
heading_anchors: true
22+
23+
back_to_top: true
24+
back_to_top_text: "Back to top"
25+
26+
enable_copy_code_button: true
27+
28+
gh_edit_link: true
29+
gh_edit_link_text: "Edit this page on GitHub"
30+
gh_edit_repository: "https://github.com/yakhyo/solid-python"
31+
gh_edit_branch: "main"
32+
gh_edit_source: ""
33+
gh_edit_view_mode: "edit"
34+
35+
plugins:
36+
- jekyll-seo-tag
37+
38+
footer_content: >-
39+
© 2025 Yakhyokhuja Valikhujaev.
40+
Distributed under the <a href="https://github.com/yakhyo/solid-python/blob/main/LICENSE">MIT License</a>.
41+
42+
color_scheme: light
43+
44+
sass:
45+
quiet_deps: true
46+
silence_deprecations:
47+
- import
48+
- global-builtin
49+
- color-functions
50+
51+
exclude:
52+
- "__pycache__"
53+
- pyproject.toml
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

assets/dip.png

68.8 KB
Loading

assets/isp.png

86.4 KB
Loading

assets/lsp.png

61.4 KB
Loading

assets/ocp.png

67.6 KB
Loading

0 commit comments

Comments
 (0)