Skip to content

Commit aa25f27

Browse files
committed
feat: Update CI configuration and documentation
- Removed the redundant tests.yml workflow and consolidated it into ci.yml for better management. - Updated CHANGELOG.md to reflect the addition of performance tests and the update to version 0.2.0. - Modified README.md to include new usage instructions and requirements. - Enhanced logging.md, testing.md, and usage.md documentation to provide clearer guidelines. - Updated pyproject.toml to reflect the new version and dependencies. Changes include: - Deletion of .github/workflows/tests.yml - Modifications to various documentation files - Addition of performance tests directory
1 parent 2294843 commit aa25f27

File tree

9 files changed

+149
-28
lines changed

9 files changed

+149
-28
lines changed

.github/workflows/tests.yml renamed to .github/workflows/ci.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Tests
1+
# .github/workflows/ci.yml
2+
name: CI
23

34
on:
45
push:
@@ -11,7 +12,7 @@ jobs:
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
14-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
15+
python-version: ['3.10', '3.11', '3.12']
1516

1617
steps:
1718
- uses: actions/checkout@v2
@@ -24,9 +25,18 @@ jobs:
2425
- name: Install dependencies
2526
run: |
2627
python -m pip install --upgrade pip
27-
python -m pip install pytest pytest-cov pytest-asyncio
2828
pip install -e ".[dev]"
29+
pip install pylint mypy
2930
3031
- name: Run tests
3132
run: |
3233
pytest --cov=tsignal
34+
35+
- name: Code quality checks
36+
run: |
37+
pylint src/tsignal
38+
mypy src/tsignal
39+
40+
- name: Performance tests
41+
run: |
42+
pytest -v -m performance

CHANGELOG.md

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,61 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.1.0] - 2024-01-26
7+
## [0.2.0] - 2024-03-19
8+
9+
### Changed
10+
- Updated minimum Python version requirement to 3.10
11+
- This change was necessary to ensure reliable worker thread functionality
12+
- Python 3.10+ provides improved async features and type handling
13+
- Better support for async context management and error handling
14+
- Updated documentation to reflect new Python version requirement
15+
- Enhanced worker thread implementation with Python 3.10+ features
816

917
### Added
10-
- Initial release
11-
- Basic signal-slot mechanism with decorators
12-
- Support for both synchronous and asynchronous slots
13-
- Thread-safe signal emissions
14-
- Automatic connection type detection
15-
- Comprehensive test suite
16-
- Full documentation
18+
- Performance tests for stress testing and memory usage analysis
19+
- Includes `test_stress.py` for heavy signal load testing
20+
- Includes `test_memory.py` for memory profiling
21+
22+
### Removed
23+
- Support for Python versions below 3.10
24+
25+
### Note
26+
Core features are now implemented and stable:
27+
- Robust signal-slot mechanism
28+
- Thread-safe operations
29+
- Async/await support
30+
- Worker thread pattern
31+
- Comprehensive documentation
32+
- Full test coverage
33+
34+
Next steps before 1.0.0:
35+
- Additional stress testing
36+
- Memory leak verification
37+
- Production environment validation
38+
- Enhanced CI/CD pipeline
39+
- Extended documentation
1740

1841
## [0.1.1] - 2024-12-01
1942

2043
### Changed
21-
- Refactored signal connection logic to support direct function connections.
22-
- Improved error handling for invalid connections.
23-
- Enhanced logging for signal emissions and connections.
44+
- Refactored signal connection logic to support direct function connections
45+
- Improved error handling for invalid connections
46+
- Enhanced logging for signal emissions and connections
2447

2548
### Fixed
26-
- Resolved issues with disconnecting slots during signal emissions.
27-
- Fixed bugs related to async slot processing and connection management.
49+
- Resolved issues with disconnecting slots during signal emissions
50+
- Fixed bugs related to async slot processing and connection management
2851

2952
### Removed
30-
- Deprecated unused constants and methods from the core module.
53+
- Deprecated unused constants and methods from the core module
54+
55+
## [0.1.0] - 2024-01-26
56+
57+
### Added
58+
- Initial release
59+
- Basic signal-slot mechanism with decorators
60+
- Support for both synchronous and asynchronous slots
61+
- Thread-safe signal emissions
62+
- Automatic connection type detection
63+
- Comprehensive test suite
64+
- Full documentation

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ asyncio.run(main())
7070
```
7171

7272
## Features
73+
- Requires Python 3.10+
7374
- Easy-to-use signal-slot mechanism with decorators
7475
- Support for both synchronous and asynchronous slots
7576
- Thread-safe signal emissions
@@ -78,7 +79,7 @@ asyncio.run(main())
7879

7980
## Installation
8081

81-
Currently, this package is under development. You can install it directly from the repository:
82+
TSignal requires Python 3.10 or higher. You can install it directly from the repository:
8283

8384
```bash
8485
git clone https://github.com/tsignal/tsignal-python.git

docs/logging.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Logging Guidelines
22

3+
## Requirements
4+
TSignal requires Python 3.10 or higher.
5+
36
TSignal uses Python's standard logging module with the following levels:
47

58
- DEBUG: Detailed information about signal-slot connections and emissions

docs/testing.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Testing Guide
22

33
## Overview
4-
TSignal uses pytest for testing. Our test suite includes unit tests, integration tests, and supports async testing.
4+
TSignal requires Python 3.10 or higher and uses pytest for testing. Our test suite includes unit tests, integration tests, performance tests, and supports async testing.
55

66
## Test Structure
77
```
@@ -13,10 +13,14 @@ tests/
1313
│ ├── test_signal.py
1414
│ ├── test_slot.py
1515
│ └── test_with_signals.py
16-
└── integration/ # Integration tests
16+
├── integration/ # Integration tests
17+
│ ├── __init__.py
18+
│ ├── test_async.py
19+
│ └── test_threading.py
20+
└── performance/ # Performance and stress tests
1721
├── __init__.py
18-
├── test_async.py
19-
└── test_threading.py
22+
├── test_stress.py
23+
└── test_memory.py
2024
```
2125

2226
## Running Tests
@@ -43,8 +47,23 @@ pytest tests/unit/test_signal.py -k "test_signal_disconnect_all"
4347

4448
# Run tests by marker
4549
pytest -v -m asyncio
50+
pytest -v -m performance # Run performance tests only
4651
```
4752

53+
### Performance Tests
54+
Performance tests include stress testing and memory usage analysis. These tests are marked with the `@pytest.mark.performance` decorator.
55+
56+
```bash
57+
# Run only performance tests
58+
pytest -v -m performance
59+
60+
# Run specific performance test
61+
pytest tests/performance/test_stress.py
62+
pytest tests/performance/test_memory.py
63+
```
64+
65+
Note: Performance tests might take longer to run and consume more resources than regular tests.
66+
4867
### Debug Mode
4968
To enable debug logging during tests:
5069
```bash

docs/usage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Usage Guide
22

3+
## Requirements
4+
TSignal requires Python 3.10 or higher.
5+
36
## Table of Contents
47
1. [Basic Concepts](#basic-concepts)
58
2. [Signals](#signals)

pyproject.toml

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

55
[project]
66
name = "tsignal"
7-
version = "0.1.0"
7+
version = "0.2.0"
88
description = "A Python Signal-Slot library inspired by Qt"
99
readme = "README.md"
10-
requires-python = ">=3.7"
10+
requires-python = ">=3.10"
1111
license = {text = "MIT"}
1212
authors = [
1313
{name = "San Kim", email = "tsignal.dev@gmail.com"}
@@ -18,9 +18,6 @@ classifiers = [
1818
"Intended Audience :: Developers",
1919
"License :: OSI Approved :: MIT License",
2020
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.7",
22-
"Programming Language :: Python :: 3.8",
23-
"Programming Language :: Python :: 3.9",
2421
"Programming Language :: Python :: 3.10",
2522
"Programming Language :: Python :: 3.11",
2623
"Programming Language :: Python :: 3.12",
@@ -49,8 +46,9 @@ addopts = "--strict-markers --disable-warnings"
4946
testpaths = ["tests"]
5047
markers = [
5148
"asyncio: mark test as an async test",
49+
"performance: mark test as a performance test",
5250
]
53-
asyncio_mode = "auto"
51+
asyncio_mode = "strict"
5452
asyncio_default_fixture_loop_scope = "function"
5553

5654
[tool.coverage.run]

tests/performance/test_memory.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from memory_profiler import profile
2+
import pytest
3+
from tsignal import t_with_signals, t_signal, t_slot
4+
5+
@pytest.mark.performance
6+
@profile
7+
def test_memory_usage():
8+
# 시그널/슬롯 생성 및 제거 반복
9+
for _ in range(1000):
10+
sender = create_complex_signal_chain()
11+
sender.signal.disconnect()
12+
13+
def create_complex_signal_chain():
14+
@t_with_signals
15+
class Sender:
16+
@t_signal
17+
def signal(self): pass
18+
19+
@t_with_signals
20+
class Receiver:
21+
@t_slot
22+
def slot(self, value):
23+
pass
24+
25+
sender = Sender()
26+
receivers = [Receiver() for _ in range(100)]
27+
for r in receivers:
28+
sender.signal.connect(r, r.slot)
29+
return sender

tests/performance/test_stress.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import asyncio
2+
import pytest
3+
from tsignal import t_with_signals, t_signal, t_slot
4+
5+
@pytest.mark.asyncio
6+
async def test_heavy_signal_load():
7+
@t_with_signals
8+
class Sender:
9+
@t_signal
10+
def signal(self): pass
11+
12+
@t_with_signals
13+
class Receiver:
14+
@t_slot
15+
async def slot(self, value):
16+
await asyncio.sleep(0.001)
17+
18+
sender = Sender()
19+
receivers = [Receiver() for _ in range(100)]
20+
for r in receivers:
21+
sender.signal.connect(r, r.slot)
22+
23+
for _ in range(1000):
24+
sender.signal.emit()

0 commit comments

Comments
 (0)