Skip to content

Commit 3801536

Browse files
authored
Merge pull request #13 from iraedeus/tooling
Repository refactoring 1. Black and isort have been replaced by ruff. 2. Pylint is also replaced by ruff 3. Added mypy as a type checking tool. 4. Project management - poetry
2 parents da8bf8a + 7c0768e commit 3801536

File tree

99 files changed

+519
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+519
-689
lines changed

.github/workflows/check.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
python-version: [ "3.11", "3.12", "3.13" ]
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install poetry
22+
run: pipx install poetry
23+
24+
- name: Install dependencies
25+
run: poetry install --with dev
26+
27+
- name: Ruff
28+
run: poetry run ruff check
29+
30+
- name: Install stubs
31+
run: poetry run pip install types-PyYAML types-tqdm
32+
33+
- name: Mypy
34+
run: poetry run mypy
35+
36+
- name: Pytest
37+
run: poetry run python -m pytest tests

.github/workflows/code_style.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/pylint.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ share/python-wheels/
2525
.installed.cfg
2626
*.egg
2727
MANIFEST
28+
poetry.lock
2829

2930
# PyInstaller
3031
# Usually these files are written by a python script from a template
@@ -157,7 +158,7 @@ cython_debug/
157158
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158159
# and can be added to the global gitignore or merged into this file. For a more nuclear
159160
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
161+
.idea/
161162

162163
#vscode
163164
.vscode

.pre-commit-config.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
![PyLint](https://github.com/PySATL/MPEst/actions/workflows/pylint.yml/badge.svg)
2-
![Check code style](https://github.com/PySATL/MPEst/actions/workflows/code_style.yml/badge.svg)
3-
[![Code style](https://img.shields.io/badge/Code%20style-black-000000.svg)](https://github.com/psf/black)
4-
![Unit Tests](https://github.com/PySATL/MPEst/actions/workflows/test.yml/badge.svg)
1+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
2+
![CI](https://github.com/PySATL/pysatl-mpest/actions/workflows/check.yml/badge.svg)
3+
<a href="https://github.com/PySATL/pysatl-mpest/blob/main/LICENSE"><img alt="License: MIT" src="https://black.readthedocs.io/en/stable/_static/license.svg"></a>
54

65
## Installation
76

@@ -98,6 +97,6 @@ plt.show()
9897
![plot](https://github.com/toxakaz/EM-algo/raw/main/examples/readme_example/example.png)
9998

10099
## Requirements
101-
- python 3.11
100+
- python >= 3.11
102101
- numpy
103102
- scipy

examples/__init__.py

Whitespace-only changes.

examples/big_mono_tests.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222

2323
counter = Clicker()
2424

25-
def _generate_test(
26-
model: type[AModelWithGenerator], o_borders: list[tuple[float, float]]
27-
) -> list[Test]:
25+
def _generate_test(model: type[AModelWithGenerator], o_borders: list[tuple[float, float]]) -> list[Test]:
2826
return generate_mono_test(
2927
model_t=model,
3028
params_borders=o_borders,
@@ -36,10 +34,7 @@ def _generate_test(
3634
tests_per_size=8,
3735
tests_per_cond=2,
3836
runs_per_test=1,
39-
solvers=[
40-
init_solver(16, 0.1, 0.001, 3, optimizer)
41-
for optimizer in TESTS_OPTIMIZERS
42-
],
37+
solvers=[init_solver(16, 0.1, 0.001, 3, optimizer) for optimizer in TESTS_OPTIMIZERS],
4338
)
4439

4540
tests += _generate_test(WeibullModelExp, [(0.25, 25), (0.25, 25)])

examples/config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77

88
CPU_COUNT = os.cpu_count()
99
MAX_WORKERS_PERCENT = 0.75
10-
MAX_WORKERS = (
11-
min(round(CPU_COUNT * MAX_WORKERS_PERCENT), CPU_COUNT)
12-
if CPU_COUNT is not None
13-
else 1
14-
)
10+
MAX_WORKERS = min(round(CPU_COUNT * MAX_WORKERS_PERCENT), CPU_COUNT) if CPU_COUNT is not None else 1
1511
# MAX_WORKERS = 4
1612

1713
RESULTS_FOLDER = EXAMPLES / "results"

0 commit comments

Comments
 (0)