Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests/test_unit.py
pytest tests/unit_test.py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

.wekan
session.cast
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Pre-commit hooks for python-wekan project
repos:
# Built-in hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: debug-statements
- id: name-tests-test

# Python code formatting
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3

# Import sorting
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile", "black"]

# Python linting with Ruff (faster alternative to flake8)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

# Python linting
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
args: [--max-line-length=100, --extend-ignore=E203]

# Security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.8.6
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]

# Secrets detection
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package.lock.json
160 changes: 160 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
},
{
"path": "detect_secrets.filters.regex.should_exclude_file",
"pattern": [
"\\.venv/.*",
"\\.git/.*",
"node_modules/.*",
"__pycache__/.*"
]
}
],
"results": {
".ruff_cache/CACHEDIR.TAG": [
{
"type": "Hex High Entropy String",
"filename": ".ruff_cache/CACHEDIR.TAG",
"hashed_secret": "e8f8c345877b2411a59897798e422b15b0c16d76",
"is_verified": false,
"line_number": 1
}
],
".wekan": [
{
"type": "Secret Keyword",
"filename": ".wekan",
"hashed_secret": "e806c69a6ba4ef56fb1bff118b8cf31eedcb8926",
"is_verified": false,
"line_number": 3
}
],
"tests/cli_config_test.py": [
{
"type": "Secret Keyword",
"filename": "tests/cli_config_test.py",
"hashed_secret": "206c80413b9a96c1312cc346b7d2517b84463edd",
"is_verified": false,
"line_number": 40
},
{
"type": "Secret Keyword",
"filename": "tests/cli_config_test.py",
"hashed_secret": "fca268ae2442d5cabc3e12d87b349adf8bf7d76c",
"is_verified": false,
"line_number": 92
}
]
},
"generated_at": "2025-08-12T06:14:33Z"
}
4 changes: 4 additions & 0 deletions .wekan.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WEKAN_BASE_URL=https://your-wekan-server.com
WEKAN_USERNAME=your-username
WEKAN_PASSWORD=your-password
WEKAN_TIMEOUT=30000
100 changes: 100 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

This project uses **uv** for modern Python package management. See the Makefile for comprehensive commands.

### Quick Start
- **Setup development**: `make setup` or `make quickstart`
- **Install dependencies**: `make install` (production) or `make install-dev` (development)
- **Run tests**: `make test` or `make test-all`
- **Code quality**: `make lint` and `make format`
- **CLI development**: `make cli` or `make cli-config`

### Dependencies & Environment
- **Package manager**: `uv` (modern, fast pip replacement)
- **Virtual environment**: `.venv` (managed by uv)
- **Lock file**: `uv.lock` (replaces requirements.txt)
- **Dependencies defined**: `pyproject.toml`

### Testing
- **Unit tests**: `make test`
- **With coverage**: `make test-cov`
- **CLI tests**: `make test-cli`
- **Integration tests**: `make test-integration`
- **All tests**: `make test-all`

### CLI Development
The CLI is integrated into the main project:
- **Install CLI**: `uv sync --extra cli` or `make install-dev`
- **Test CLI**: `uv run wekan --help` or `make cli-help`
- **Run CLI**: `uv run wekan navigate` or `make cli`
- **Configure**: `uv run wekan config init` or `make cli-config`
- **Status check**: `uv run wekan status` or `make cli-status`

### Pre-commit Hooks
- **Install hooks**: `make install-dev` (automatic) or `uv run pre-commit install`
- **Run hooks**: `make pre-commit`
- **Format code**: `make format`

## Architecture Overview

### Core Library Structure (`/wekan/`)
This is a Python client library for the WeKan REST API with object-oriented design:

#### Key Components
- **WekanClient** (`wekan_client.py`): Main entry point, handles authentication and token management
- **Base class** (`base.py`): Common functionality for all WeKan objects
- **Object hierarchy**: WekanClient → Board → List/Swimlane → Card → Comments/Checklists

#### Object Relationships
```
WekanClient
├── Board (board.py)
│ ├── WekanList (wekan_list.py)
│ │ └── Card (card.py)
│ ├── Swimlane (swimlane.py)
│ │ └── Card (card.py)
│ ├── Integration (integration.py)
│ ├── CustomField (customfield.py)
│ └── Label (label.py)
├── User (user.py)
└── Card components:
├── CardComment (card_comment.py)
├── CardChecklist (card_checklist.py)
└── CardChecklistItem (card_checklist_item.py)
```

#### Authentication & Usage
- Uses username/password to obtain API tokens
- Tokens are automatically renewed when expired
- Environment variables: `WEKAN_USERNAME`, `WEKAN_PASSWORD`
- Base URL required for WeKan instance

### CLI Application (`/wekan/cli/`)
Integrated command-line interface built on top of the core library:
- Optional installation via `pip install python-wekan[cli]`
- Uses typer and rich for modern CLI experience
- Configuration via `.wekan` files or environment variables
- Entry point: `wekan` command

## Development Notes

### Dependencies
- **Core**: `requests`, `python-dateutil`, `certifi`, `urllib3`
- **CLI**: `typer`, `rich`, `pydantic` (optional)
- **Dev**: `pytest`, `pytest-cov`, `black`, `isort`, `mypy`, `ruff`, `pre-commit`
- **Package management**: `uv` with `pyproject.toml` and `uv.lock`

### Code Style
- Python 3.9+ required
- Type hints enabled (see `py.typed` marker)
- Pyright configuration in `pyproject.toml`

### Project Structure
- Main library: `/wekan/` - Core WeKan API client
- CLI tool: `/wekan/cli/` - Integrated command-line interface
- Tests: `/tests/` - Library and CLI tests
- Single `pyproject.toml` with optional CLI dependencies
Loading