Skip to content

Commit acdeb77

Browse files
committed
added new automatization structure
1 parent ed759e7 commit acdeb77

13 files changed

Lines changed: 8716 additions & 3957 deletions

.github/workflows/update-readme.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ jobs:
1818
with:
1919
python-version: '3.10'
2020

21+
- name: Cache pip dependencies
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.cache/pip
25+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
26+
restore-keys: |
27+
${{ runner.os }}-pip-
28+
2129
- name: Install dependencies
2230
run: pip install -e .[dev]
2331

@@ -35,6 +43,14 @@ jobs:
3543
with:
3644
python-version: '3.10'
3745

46+
- name: Cache pip dependencies
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.cache/pip
50+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
51+
restore-keys: |
52+
${{ runner.os }}-pip-
53+
3854
- name: Install dependencies
3955
run: pip install -e .[dev]
4056

@@ -56,6 +72,14 @@ jobs:
5672
with:
5773
python-version: '3.10'
5874

75+
- name: Cache pip dependencies
76+
uses: actions/cache@v4
77+
with:
78+
path: ~/.cache/pip
79+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
80+
restore-keys: |
81+
${{ runner.os }}-pip-
82+
5983
- name: Install dependencies
6084
run: pip install -e .[dev]
6185

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ __pycache__/
55
.env
66
.DS_Store
77
.idea/
8-
.vscode/
8+
.vscode/
9+
problems_cache.json
10+
*.egg-info

README.md

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ My clean, typed, and tested solutions to LeetCode problems (Python 3.10+).
55
<!-- START_STATS -->
66
**Total**: **6**
77
🟢 **Easy**: 5 &nbsp; `░░░░░░░░░░` &nbsp; _(0.5%)_
8-
🟡 **Medium**: 1 &nbsp; `░░░░░░░░░░` &nbsp; _(0.1%)_
8+
🟡 **Medium**: 1 &nbsp; `░░░░░░░░░░` &nbsp; _(0.0%)_
99
🔴 **Hard**: 0 &nbsp; `░░░░░░░░░░` &nbsp; _(0.0%)_
1010
<!-- END_STATS -->
1111

1212
<!-- START_TABLE -->
1313
<details>
14-
<summary><b> Show all solved problems (6)</b></summary>
14+
<summary><b> Show all solved problems </b></summary>
15+
1516
## Problems
1617

1718
| # | Title | Difficulty | Solution |
@@ -33,25 +34,18 @@ My clean, typed, and tested solutions to LeetCode problems (Python 3.10+).
3334
Этот репозиторий — не просто сборник решений, а **готовая среда для практики LeetCode** с автоматизацией и профессиональным workflow.
3435

3536
### 💡 Что получает клонировавший:
36-
- ✅ Все решения на **Python ^3.10** с type hints
37-
- ✅ Тесты для каждой задачи (`pytest`)
38-
- ✅ Автоматическая проверка стиля (`ruff`)
39-
- ✅ Автообновляемый `README.md` с прогрессом и ссылками
40-
- ✅ Готовая CI/CD-настройка через GitHub Actions
37+
- ✅ Все решения на **Python ^3.10** с type hints
38+
- ✅ Тесты для каждой задачи (`pytest`)
39+
- ✅ Автоматическая проверка стиля (`ruff`)
40+
- ✅ Автоматическое создание /feat ветки, файлов проблемы и теста
41+
- ✅ Генерация файлов с контентом: условие задачи, сниппеты кода и примеры тестов (fetch from LeetCode API)
42+
- ✅ Автообновляемый `README.md` с прогрессом и ссылками
43+
- ✅ Интеллектуальное управление кэшем: автоматическое обновление раз в неделю или по требованию
44+
- ✅ Готовая CI/CD-настройка через GitHub Actions
4145
- ✅ Чёткая структура: `solutions/`, `tests/`, `scripts/`
4246

4347
⚠️ Для работы скрипта обновления README требуется интернет (запрос к LeetCode 'API' при первом запуске).
4448

45-
⚠️ Именование файлов
46-
47-
Номер задачи — 4 цифры с ведущими нулями — всегда в конце имени файла, после `_`.
48-
49-
| Тип | Шаблон | Обязательно? |
50-
|------|------|-------------|
51-
| Решение | {название_snake_case}_{NNNN}.py | Да (для парсинга номера) |
52-
| Тест | test_{название_snake_case}_{NNNN}.py | Желательно (для ясности), но достаточно test_{название_snake_case/или номер}.py |
53-
54-
5549
<hr>
5650

5751
<details>
@@ -60,19 +54,14 @@ My clean, typed, and tested solutions to LeetCode problems (Python 3.10+).
6054
This repo provides a production-grade setup for LeetCode practice:
6155
- Typed, tested Python 3.10+ solutions
6256
- Automated README generation with progress bars
57+
- Automated creation of /feat branch, problem and test files
58+
- Automated generation of files with content: problem statement, code snippets, and test examples (fetch from LeetCode API)
59+
- Smart cache management: automatic weekly refresh or on-demand
6360
- Preconfigured CI (tests + linter) and CD (auto-update)
6461
- No manual work — just solve, commit, PR
6562

6663
⚠️ For proper README generation, internet access is required (to query LeetCode 'API' on first run).
6764

68-
⚠️ Naming convention
69-
70-
The problem number — 4 digits with leading zeros — always at the end of the filename, after _.
71-
72-
| Type | Pattern | Required? |
73-
|------|-------|-----------|
74-
| Solution | {problem_name_snake_case}_{NNNN}.py | Yes (for number parsing) |
75-
| Test | test_{problem_name_snake_case}_{NNNN}.py | Recommended (for clarity), but enough to have test_{problem_name_snake_case/or number}.py |
7665
</details>
7766

7867
<hr>
@@ -109,12 +98,30 @@ pip install -e .[dev]
10998
```bash
11099
pytest && ruff check .
111100
```
112-
#### 5. Создай токен GitHub и добавь его в Secrets репозитория
101+
102+
#### 5. Используй скрипт обновления README (опционально)
103+
```bash
104+
python scripts/update_readme.py
105+
```
106+
Для принудительного обновления кэша задач используйте флаг `--force-refresh-cache`:
107+
```bash
108+
python scripts/update_readme.py --force-refresh-cache
109+
```
110+
111+
- Кэш задач обновляется автоматически раз в неделю (от даты изменения файла problems_cache.json). Для принудительного обновления кэша задач используйте флаг --force-refresh-cache:
112+
113+
#### 6. Создай токен GitHub и добавь его в Secrets репозитория
113114
1) https://github.com/settings/tokens → перейди по ссылке
114115
2) Generate new token (classic) → Note: `What’s this token for?` → Expiration: `your choice` → Scopes: `repo`+`workflow` → Generate token → Скопируй токен
115116
3) Repo LeetCode_solutions Settings → Secrets and variables → Actions → New repository secret с именем `GH_PAT` → Вставь токен → Add secret
116117

117-
#### 6. Создавай новую feat/ветку → Решай новую задачу → делай push → PR → merge в main → CI/CD сделает всё остальное автоматически!
118-
1) Удаление веток опционально (в истории коммитов сохраняется вся инфа)
118+
#### 7. Используй скрипт → Решай новую задачу → делай push → PR → merge в main → CI/CD сделает всё остальное автоматически!
119+
120+
```bash
121+
python3 scripts/create_problem.py <номер_задачи>
122+
```
123+
124+
1) Скрипт создает новую **/feat** ветку, а так же файлы решения и тестов минимизируя рутину
125+
2) Удаление веток после **merge** опционально (в истории коммитов сохраняется вся инфа)
119126
</details>
120127
<hr>

0 commit comments

Comments
 (0)