Skip to content

Commit 3d1eda0

Browse files
committed
Reworked for current Python conventions
* Use pyproject.toml * Reorganize along current Python project guidelines * Revise tests for pytest
1 parent 7088e50 commit 3d1eda0

23 files changed

+782
-223
lines changed

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This is an EditorConfig file:
2+
# https://EditorConfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
insert_final_newline = true
9+
charset = utf-8
10+
indent_style = tab
11+
indent_size = 4
12+
insert_final_newline = true
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2
17+
end_of_line = lf
18+
insert_final_newline = true
19+
20+
[*.py]
21+
indent_style = space
22+
indent_size = 4
23+
end_of_line = lf
24+
insert_final_newline = true
25+
26+
# Tab indentation (no size specified)
27+
[Makefile]
28+
indent_style = tab

.github/workflows/macos.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Stopit (macOS)
1+
name: Timed Threads (macOS)
22

33
on:
44
push:
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [macOS]
18-
python-version: ['3.10', '3.11']
18+
python-version: ['3.10', '3.11', '3.12']
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: Set up Python ${{ matrix.python-version }}
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install stopit
2929
run: |
3030
pip install "setuptools>=70.0.0" packaging pytest
31-
pip install -e .
31+
pip install -e .[dev]
3232
- name: Test Stopit
3333
run: |
34-
python tests.py
34+
pytest test

.github/workflows/pyodide.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copied from SymPy https://github.com/sympy/sympy/pull/27183
22

3-
name: Stopit (Pyodide)
3+
name: Timed Theads (Pyodide)
44

55
on:
66
push:
@@ -60,4 +60,4 @@ jobs:
6060
. .venv-pyodide/bin/activate
6161
echo $PATH
6262
python -c "import sys; print(sys.path); import stopit"
63-
# python tests.py
63+
# python test

.github/workflows/ubuntu.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Stopit (ubuntu)
1+
name: Timed Threads (ubuntu)
22

33
on:
44
push:
@@ -11,18 +11,18 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ['3.12', '3.11', '3.8', '3.9', '3.10']
14+
python-version: ['3.12', '3.11', '3.9', '3.10']
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python-version }}
21-
- name: Install stopit
21+
- name: Install Timed Threads
2222
run: |
2323
python -m pip install --upgrade pip
2424
pip install "setuptools>=70.0.0" packaging pytest
25-
pip install -e .
26-
- name: Test stopit
25+
pip install -e .[dev]
26+
- name: Test Timed threads
2727
run: |
28-
python tests.py
28+
pytest test

.github/workflows/windows.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Stopit (Windows)
1+
name: Timed Threads (Windows)
22

33
on:
44
push:
@@ -21,11 +21,11 @@ jobs:
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
- name: Install stopit
24+
- name: Install Timed Threads
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install "setuptools>=70.0.0" packaging pytest
28-
pip install -e .
29-
- name: Test stopit
28+
pip install -e .[dev]
29+
- name: Test Timed Threads
3030
run: |
31-
python tests.py
31+
pytest test

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
1+
*.c
2+
*.cpp
3+
*.egg
4+
*.gz
5+
*.nix
6+
*.py[cod]
7+
*.so
8+
*.stackdump
9+
*~
10+
.coverage
11+
.idea/
12+
.mypy_cache
13+
.project
14+
.pydevproject
15+
.settings
16+
.vscode
17+
/.cache
18+
/.pyodide-xbuildenv-*
19+
/.pytest_cache
20+
/.python-version
121
*.egg-info
222
*.pyc
323
*.pyo
424
.DS_Store
25+
/.python-version
26+
/ChangeLog-spell-corrected
27+
/Timed_Threads.egg-info
528
/.pyodide-xbuildenv*
629
/.python-version
30+
/ChangeLog
31+
/ChangeLog.orig
32+
/ChangeLog.rej
733
__pycache__/
834
build/
935
dist/
36+
tmp

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
default_language_version:
2+
python: python
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: check-merge-conflict
8+
- id: check-yaml
9+
- id: debug-statements
10+
stages: [pre-commit]
11+
- id: end-of-file-fixer
12+
stages: [pre-commit]
13+
exclude: ChangeLog-spell-corrected.diff
14+
- id: trailing-whitespace
15+
exclude: ChangeLog-spell-corrected.diff
16+
- id: check-json
17+
exclude: mathics_scanner/data/character-tables.json
18+
- repo: https://github.com/pycqa/isort
19+
rev: 6.0.1
20+
hooks:
21+
- id: isort
22+
stages: [pre-commit]
23+
args: ["--profile", "black"]
24+
- repo: https://github.com/psf/black
25+
rev: 25.1.0
26+
hooks:
27+
- id: black
28+
language_version: python3
29+
stages: [pre-commit]
30+
exclude: version.py

CHANGES.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Changes log
22
===========
33

4+
2.0.0 - 2025
5+
------------
6+
47
1.1.2 - 2018-02-09
58
------------------
69

@@ -16,7 +19,7 @@ Changes log
1619
1.1.0 - 2014-05-02
1720
------------------
1821

19-
* Added support for TIMER signal based timeout control (Posix OS only)
22+
* Added support for TIMER signal based timeout control (POSIX OS only)
2023
* API changes due to new timeout controls
2124
* An exhaustive documentation.
2225

ChangeLog-spell-corrected.diff

Whitespace-only changes.

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# A GNU Makefile to run various tasks - compatibility for us old-timers.
2+
3+
# Note: This makefile include remake-style target comments.
4+
# These comments before the targets start with #:
5+
# remake --tasks to shows the targets and the comments
6+
7+
GIT2CL ?= ./admin-tools/git2cl
8+
PYTHON ?= python3
9+
PIP ?= $(PYTHON) -m pip
10+
RM ?= rm
11+
PIP_INSTALL_OPTS ?=
12+
13+
.PHONY: all build \
14+
check clean \
15+
develop \
16+
pytest \
17+
rmChangeLog \
18+
test
19+
20+
#: Default target - same as "develop"
21+
all: develop
22+
23+
#: Set up to run from the source tree
24+
develop:
25+
$(PIP) install -e .$(PIP_INSTALL_OPTS)
26+
27+
#: Install timed_threads
28+
install:
29+
$(PYTHON) -m pip install -e .
30+
31+
#: Run unit tests and Mathics doctest
32+
check: pytest
33+
34+
#: Same as check
35+
test: check
36+
37+
#: Remove derived files
38+
clean:
39+
@find . -name *.pyc -type f -delete;
40+
41+
#: Run py.test tests. Use environment variable "o" for pytest options
42+
pytest: mathics_scanner/data/character-tables.json
43+
$(PYTHON) -m pytest test $o
44+
45+
#: Remove ChangeLog
46+
rmChangeLog:
47+
$(RM) ChangeLog || true
48+
49+
#: Create a ChangeLog from git via git log and git2cl
50+
ChangeLog: rmChangeLog
51+
git log --pretty --numstat --summary | $(GIT2CL) >$@
52+
patch -p0 ChangeLog < ChangeLog-spell-corrected.diff

0 commit comments

Comments
 (0)