Skip to content

Commit 8690bed

Browse files
authored
Batch of smaller fixes and update to version 1.12.1 (#114)
* fix: fixed a bug with removing pids from internal list * Add type annotations to userfacing outputs * Allways run with threading to process can be interrupted with ctrl-c * Update pixi toml file * chore: Add changelog entry and update versions * Update pixi action * Update pixi lock file * Black formatting
1 parent a3e351b commit 8690bed

File tree

7 files changed

+1348
-1156
lines changed

7 files changed

+1348
-1156
lines changed

.github/workflows/docs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- uses: prefix-dev/setup-pixi@v0.7.0
23+
- uses: prefix-dev/setup-pixi@v0.8.1
2424
with:
2525
environments: docs
2626
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
@@ -52,7 +52,7 @@ jobs:
5252
# run: |
5353
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`);
5454

55-
- uses: prefix-dev/setup-pixi@v0.7.0
55+
- uses: prefix-dev/setup-pixi@v0.8.1
5656
with:
5757
environments: docs
5858
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v4
2929

30-
- uses: prefix-dev/setup-pixi@v0.7.0
30+
- uses: prefix-dev/setup-pixi@v0.8.1
3131
with:
3232
environments: test
3333
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
@@ -49,7 +49,7 @@ jobs:
4949
steps:
5050
- uses: actions/checkout@v4
5151

52-
- uses: prefix-dev/setup-pixi@v0.7.0
52+
- uses: prefix-dev/setup-pixi@v0.8.1
5353
with:
5454
environments: test
5555
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# AnyPyTools Change Log
22

3+
## v1.12.1
4+
5+
**Fixed:**
6+
* Fixed a crash when stopping simulations with ctrl-c. It should now shutdown more gracefully.
7+
* Fixed a bug making it was hard to stop simulations which were not running in parrallel. Now
8+
simulations are always started on separate threads, which makes it possible to stop them with ctrl-c.
9+
10+
**Added:**
11+
* Added a some python annotations to the code base, which should provide better type hints in IDEs.
12+
13+
314

415
## v1.12.0
516

anypytools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"NORMAL_PRIORITY_CLASS",
3737
]
3838

39-
__version__ = "1.12.0"
39+
__version__ = "1.12.1"
4040

4141

4242
def print_versions():

anypytools/abcutils.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def add(self, pid):
8383

8484
def remove(self, pid):
8585
with _thread_lock:
86-
self._pids.pop(pid, None)
86+
self._pids.discard(pid)
8787

8888
def stop_all(self):
8989
"""Clean up and shut down any running processes."""
@@ -914,12 +914,13 @@ def _worker(self, task, task_queue):
914914
task.logfile = ""
915915
task_queue.put(task)
916916

917-
def _schedule_processes(self, tasklist) -> Generator[_Task, None, None]:
917+
def _schedule_processes(
918+
self, tasklist: list[_Task]
919+
) -> Generator[_Task, None, None]:
918920
# Make a shallow copy of the task list,
919921
# so we don't mess with the callers list.
920922
tasklist = copy.copy(tasklist)
921-
number_tasks = len(tasklist)
922-
use_threading = number_tasks > 1 and self.num_processes > 1
923+
use_threading = "ANPYTOOLS_DEBUG_NO_THREADING" not in os.environ
923924
task_queue: Queue = Queue()
924925
threads: List[Thread] = []
925926
# run while there is still threads, tasks or stuff in the queue

pixi.lock

+1,324-1,145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ channels = ["conda-forge", "anybody" ]
66
platforms = ["win-64", "linux-64"]
77

88
[tasks]
9-
test = {cmd = "pytest tests", depends-on = ["install"]}
109
develop = "pip install -e ."
1110
install = "pip install ."
1211

1312
clean-build = "rm -rf build dist"
14-
build = {cmd="python -m build . --sdist"}
1513
pipy-upload = {cmd="twine upload dist/*"}
1614
release = {cmd="", depends-on=["test", "clean-build", "build", "pipy-upload"]}
1715

@@ -50,6 +48,9 @@ debugpy = ">=1.8.1,<1.9"
5048
[feature.test.target.win-64.dependencies]
5149
anybodycon = "*"
5250

51+
[feature.test.tasks]
52+
test = {cmd = "pytest tests", depends-on = ["install"]}
53+
5354

5455
[feature.docs.dependencies]
5556
python = "3.11.*"

0 commit comments

Comments
 (0)