Skip to content

Commit

Permalink
cicd: update
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkShawn2020 committed Dec 17, 2024
1 parent 7f769d0 commit 6c5e469
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
asset_name: watchcat-linux-${{ github.ref_name }}
asset_path: ./dist/watchcat-linux-${{ github.ref_name }}
- os: macos-latest
asset_name: watchcat-macos-${{ github.ref_name }}
asset_path: ./dist/watchcat-macos-${{ github.ref_name }}
asset_name: watchcat-macos-${{ github.ref_name }}.dmg
asset_path: ./dist/watchcat-macos-${{ github.ref_name }}.dmg

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
elif [ "${{ runner.os }}" = "Linux" ]; then
mv "./dist/watchcat-linux" "./dist/watchcat-linux-${{ github.ref_name }}"
else
mv "./dist/watchcat-macos" "./dist/watchcat-macos-${{ github.ref_name }}"
mv "./dist/watchcat-macos" "./dist/watchcat-macos-${{ github.ref_name }}.dmg"
fi
shell: bash

Expand Down
114 changes: 27 additions & 87 deletions docs/development/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ poetry shell

```json
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"editor.rulers": [88],
"files.trimTrailingWhitespace": true
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"editor.rulers": [88],
"files.trimTrailingWhitespace": true
}
```

Expand Down Expand Up @@ -133,60 +133,28 @@ poetry run mkdocs build

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "Python: WatchCat",
"type": "python",
"request": "launch",
"module": "watchcat",
"console": "integratedTerminal",
"justMyCode": false
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "Python: WatchCat",
"type": "python",
"request": "launch",
"module": "watchcat",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
```

### 使用日志调试

```python
from watchcat.logger import logger

def my_function():
logger.debug("Debug information")
logger.info("Processing...")
try:
# 你的代码
pass
except Exception as e:
logger.error(f"Error occurred: {e}")
```

### 性能分析

```python
import cProfile
import pstats

def profile_code():
profiler = cProfile.Profile()
profiler.enable()

# 你的代码

profiler.disable()
stats = pstats.Stats(profiler).sort_stats('cumulative')
stats.print_stats()
```

## 常见问题

### 1. Poetry 环境问题
Expand Down Expand Up @@ -218,31 +186,3 @@ def memory_intensive_function():
# 你的代码
pass
```

## 性能优化

### 1. 代码优化

```python
# 使用生成器而不是列表
def process_items():
return (item for item in items)

# 使用 slots
class OptimizedClass:
__slots__ = ['name', 'value']
```

### 2. PyQt 优化

```python
# 避免频繁更新
self.setUpdatesEnabled(False)
# 进行更新
self.setUpdatesEnabled(True)

# 批量处理信号
self.blockSignals(True)
# 处理
self.blockSignals(False)
```

0 comments on commit 6c5e469

Please sign in to comment.