Skip to content

Commit 8bca16f

Browse files
authored
Merge pull request #406 from linien-org/release/v2.0.3
Release v2.0.3
2 parents 16dee16 + 379cacf commit 8bca16f

File tree

12 files changed

+57
-20
lines changed

12 files changed

+57
-20
lines changed

.github/actions/build-linien/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
using: "composite"
66
steps:
77
- name: Set up Python 3.10
8-
uses: actions/setup-python@v4
8+
uses: actions/setup-python@v5
99
with:
1010
python-version: "3.10"
1111

.github/actions/install-linien/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
using: "composite"
66
steps:
77
- name: Set up Python 3.10
8-
uses: actions/setup-python@v4
8+
uses: actions/setup-python@v5
99
with:
1010
python-version: "3.10"
1111

.github/workflows/pyinstaller-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fetch-depth: 0
1818

1919
- name: Set up Python
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5
2121
with:
2222
python-version: "3.10"
2323

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.3] - 2024-05-29
9+
10+
### Fixed
11+
* Now compatible with Python 3.12 by bumping version of `fabric` by @bleykauf in https://github.com/linien-org/linien/pull/406, thanks to @systemofapwne for reporting this issue
12+
13+
### Added
14+
* Handle corrupted json files by @bleykauf in https://github.com/linien-org/linien/pull/399
15+
16+
817
## [2.0.2] - 2024-05-14
918

1019
### Fixed
@@ -216,7 +225,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
216225

217226
* **Bug fixes and performance improvements**
218227

219-
[Unreleased]: https://github.com/linien-org/linien/compare/v2.0.1...v2.0.2
228+
[2.0.3]: https://github.com/linien-org/linien/compare/v2.0.2...v2.0.3
229+
[2.0.2]: https://github.com/linien-org/linien/compare/v2.0.1...v2.0.2
220230
[2.0.1]: https://github.com/linien-org/linien/compare/v2.0.0...v2.0.1
221231
[2.0.0]: https://github.com/linien-org/linien/compare/v1.0.2...v2.0.0
222232
[1.0.2]: https://github.com/linien-org/linien/compare/v1.0.1...v1.0.2

linien-client/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "linien-client"
7-
version = "2.0.2"
7+
version = "2.0.3"
88
authors = [
99
{ name = "Benjamin Wiegand", email = "[email protected]" },
1010
{ name = "Bastian Leykauf", email = "[email protected]" },
@@ -23,9 +23,9 @@ classifiers = [
2323
]
2424
requires-python = ">=3.8"
2525
dependencies = [
26-
"fabric>=2.7.0,<3.0",
26+
"fabric>=3.2.2,<4.0",
2727
"typing_extensions>=4.5.0,<5.0",
28-
"linien-common==2.0.2",
28+
"linien-common==2.0.3",
2929
]
3030

3131
[project.readme]

linien-common/linien_common/config.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
#
1616
# You should have received a copy of the GNU General Public License
1717
# along with Linien. If not, see <http://www.gnu.org/licenses/>.
18-
18+
import logging
1919
from pathlib import Path
2020

2121
from appdirs import AppDirs
2222

23+
logger = logging.getLogger(__name__)
24+
logger.setLevel(logging.DEBUG)
25+
2326
ACQUISITION_PORT = 19321
2427
SERVER_PORT = 18862
2528
DEFAULT_SWEEP_SPEED = (125 * 2048) << 6
@@ -29,3 +32,16 @@
2932

3033
LOG_FILE_PATH = USER_DATA_PATH / "linien.log"
3134
LOG_FILE_PATH.parent.mkdir(parents=True, exist_ok=True)
35+
36+
37+
def create_backup_file(filename: Path) -> None:
38+
"""Rename the file to a unique filename."""
39+
i = 0
40+
while True:
41+
backup_filename = filename.parent / f"{filename.stem}.backup{i}"
42+
if not backup_filename.exists():
43+
break
44+
i += 1
45+
46+
filename.rename(backup_filename)
47+
logger.info(f"{filename} has been saved as {backup_filename}.")

linien-common/linien_common/influxdb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import logging
2020
from dataclasses import dataclass
2121

22-
from .config import USER_DATA_PATH
22+
from .config import USER_DATA_PATH, create_backup_file
2323

2424
CREDENTIAL_STORE_FILENAME = "influxdb_credentials.json"
2525

@@ -69,3 +69,7 @@ def restore_credentials() -> InfluxDBCredentials:
6969
)
7070
except FileNotFoundError:
7171
return InfluxDBCredentials()
72+
except json.JSONDecodeError:
73+
logger.error(f"Credentials file {filename} was corrupted.")
74+
create_backup_file(filename)
75+
return InfluxDBCredentials()

linien-common/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "linien-common"
7-
version = "2.0.2"
7+
version = "2.0.3"
88
authors = [
99
{ name = "Benjamin Wiegand", email = "[email protected]" },
1010
{ name = "Bastian Leykauf", email = "[email protected]" },

linien-gui/linien_gui/config.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
from pathlib import Path
2424
from typing import Callable, Iterator, Tuple
2525

26-
from linien_common.config import USER_DATA_PATH
26+
from linien_common.config import USER_DATA_PATH, create_backup_file
2727

2828
logger = logging.getLogger(__name__)
2929
logger.setLevel(logging.DEBUG)
3030

3131
UI_PATH = Path(__file__).parents[0].resolve() / "ui"
32-
32+
SETTINGS_STORE_FILENAME = "settings.json"
3333
# don't plot more often than once per `DEFAULT_PLOT_RATE_LIMIT` seconds
3434
DEFAULT_PLOT_RATE_LIMIT = 0.1
3535

@@ -118,19 +118,22 @@ def __iter__(self) -> Iterator[Tuple[str, Setting]]:
118118

119119
def save_settings(settings: Settings) -> None:
120120
data = {name: setting.value for name, setting in settings}
121-
with open(USER_DATA_PATH / "settings.json", "w") as f:
121+
with open(USER_DATA_PATH / SETTINGS_STORE_FILENAME, "w") as f:
122122
json.dump(data, f, indent=0)
123123

124124

125125
def load_settings() -> Settings:
126126
settings = Settings()
127+
filename = USER_DATA_PATH / SETTINGS_STORE_FILENAME
127128
try:
128-
with open(USER_DATA_PATH / "settings.json", "r") as f:
129+
with open(filename, "r") as f:
129130
data = json.load(f)
130131
for name, value in data.items():
131132
if name in settings.__dict__:
132133
getattr(settings, name).value = value
133134
except FileNotFoundError:
134135
save_settings(settings)
135-
136+
except json.JSONDecodeError:
137+
logger.error(f"Settings file {filename} was corrupted.")
138+
create_backup_file(filename)
136139
return settings

linien-gui/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "linien-gui"
7-
version = "2.0.2"
7+
version = "2.0.3"
88
authors = [
99
{ name = "Benjamin Wiegand", email = "[email protected]" },
1010
{ name = "Bastian Leykauf", email = "[email protected]" },
@@ -28,7 +28,7 @@ dependencies = [
2828
"PyQt5>=5.12.0,<6.0",
2929
"requests>=2.31.0,<3.0",
3030
"superqt>=0.2.3",
31-
"linien_client==2.0.2",
31+
"linien_client==2.0.3",
3232
]
3333

3434
[project.readme]

0 commit comments

Comments
 (0)