Skip to content

Commit 5ea5ab1

Browse files
committed
refactor: правки по ревью — deps, tests/CI, константы, рефактор методов
1 parent 3dddf68 commit 5ea5ab1

21 files changed

Lines changed: 591 additions & 824 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, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.10'
17+
- name: Install deps
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -e '.[dev]'
21+
- name: Black check
22+
run: black --check popframe tests
23+
- name: Isort check
24+
run: isort --check-only popframe tests
25+
- name: Pylint (non-blocking)
26+
run: |
27+
pylint popframe || true
28+
- name: Pytest
29+
run: pytest -q

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ repos:
1414
rev: 22.10.0
1515
hooks:
1616
- id: black
17+
args: ["--line-length=120"]
18+
19+
- repo: https://github.com/PyCQA/isort
20+
rev: 5.13.2
21+
hooks:
22+
- id: isort
23+
args: ["--profile=black", "--line-length=120"]

README.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Below are examples for the main modules of PopFrame.
8383
**1. Region (models):**
8484
```python
8585
from popframe.models.region import Region
86-
region = Region.from_pickle('data/region.pickle')
86+
region = Region.from_pickle('examples/data/Ленинградская область.pickle')
8787
print(region.towns)
8888
```
8989

@@ -140,6 +140,14 @@ from popframe.utils.const import *
140140
See more examples in the `examples/` directory and documentation.
141141
Больше примеров — в папке `examples/` и в документации.
142142

143+
Data for the notebooks is provided under `examples/data`.
144+
- EN: Example notebooks expect inputs from `examples/data` (GeoJSON/Pickle). If you use your own region, update paths accordingly.
145+
- RU: Для запуска ноутбуков используйте данные из `examples/data`. Если работаете со своими данными, поправьте пути в ноутбуках.
146+
147+
Notes on external data access:
148+
- EN: Some examples fetch OpenStreetMap data (e.g., land use). Ensure internet access. If your environment requires VPN (e.g., Forti), connect before running.
149+
- RU: Часть примеров получает данные из OSM. Нужен доступ в интернет (при необходимости подключите VPN, например Forti).
150+
143151
Project Structure / Структура проекта
144152
------------------------------------
145153

@@ -254,5 +262,3 @@ Contacts / Контакты
254262
255263
256264
257-
258-

examples/aglomeration.ipynb

Lines changed: 303 additions & 318 deletions
Large diffs are not rendered by default.

examples/criterion_hex.ipynb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 1,
12+
"execution_count": null,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"# import osmnx as ox\n",
17-
"import pandas as pd\n",
18-
"import geopandas as gpd\n",
19-
"import networkx as nx\n",
20-
"import numpy as np\n",
2116
"import warnings\n",
2217
"import sys\n",
2318
"import os\n",
@@ -1742,7 +1737,7 @@
17421737
"name": "python",
17431738
"nbconvert_exporter": "python",
17441739
"pygments_lexer": "ipython3",
1745-
"version": "3.10.11"
1740+
"version": "3.10.12"
17461741
},
17471742
"orig_nbformat": 4
17481743
},

examples/engineer.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
"name": "python",
286286
"nbconvert_exporter": "python",
287287
"pygments_lexer": "ipython3",
288-
"version": "3.10.11"
288+
"version": "3.10.12"
289289
},
290290
"orig_nbformat": 4
291291
},

examples/landuse_assessment.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 6,
12+
"execution_count": null,
1313
"metadata": {},
1414
"outputs": [
1515
{
@@ -121,12 +121,11 @@
121121
}
122122
],
123123
"source": [
124-
"import json\n",
125124
"from io import StringIO\n",
126125
"from popframe.method.landuse_assessment import LandUseAssessment\n",
127126
"from popframe.models.region import Region\n",
128127
"import geopandas as gpd\n",
129-
"from loguru import logger\n",
128+
"\n",
130129
"\n",
131130
"region_model = Region.from_pickle('data/Ленинградская область.pickle')\n",
132131
"grid = gpd.read_file('data/gdf_hex.geojson', engine=\"pyogrio\")\n",
@@ -538,7 +537,7 @@
538537
"name": "python",
539538
"nbconvert_exporter": "python",
540539
"pygments_lexer": "ipython3",
541-
"version": "3.10.11"
540+
"version": "3.10.12"
542541
},
543542
"orig_nbformat": 4
544543
},

0 commit comments

Comments
 (0)