This file contains guidelines and commands for AI agents working on the aa-pytools project.
aa-pytools is a Python library for Automation Anywhere + Python integration, targeting RPA developers. The project uses modern Python development tools and follows best practices for packaging, testing, and development workflow.
# Install dependencies (requires uv package manager)
make install
# or: uv sync# Run all tests with verbose output
make test
# or: pytest -vv
# Run a single test file
pytest -vv tests/decorators/test_safe_execute.py
# Run a single test function
pytest -vv tests/decorators/test_safe_execute.py::TestSafeExecuteBasic::test_successful_execution_returns_payload
# Run tests with coverage
pytest -vv --cov=src/aa_pytools --cov-report=term-missing# Lint code
ruff check .
# Format code
ruff format .
# Check and fix in one command
ruff check . --fix && ruff format .# Clean build artifacts
make clean
# Build package (includes version bump)
make build
# Bump version (default: patch)
make bump TYPE=minor # options: major, minor, patch
# Publish to TestPyPI
make publish-test
# Publish to PyPI
make publish- Python 3.13+ required
- Use type hints for all function parameters and return values
- Follow PEP 8 with ruff formatting
- Write comprehensive docstrings for all modules and public functions
- Use descriptive variable names (avoid single letters except for counters)
# Standard library imports first
import functools
import json
import sys
from pathlib import Path
from typing import Literal
# Third-party imports second
import pytest
# Local imports third
from aa_pytools.decorators.safe_execute import safe_execute- Use union types with
|syntax (Python 3.10+) - Use Literal types for string constants
- Import
typingonly when necessary (prefer built-in types) - Example:
def func(name: str) -> dict[str, any] | str:
"""
Module description.
This module provides functionality for...
Usage:
example = func()
Args:
param1 (str): Description of parameter
param2 (int | None): Optional parameter description
Returns:
dict[str, any]: Description of return value
Raises:
ValueError: When invalid input provided
TODO:
- Future improvement notes
"""- Use UPPER_SNAKE_CASE for module-level constants
- Group related constants together
- Provide descriptive comments for constant groups
# Default configuration values
DEFAULT_LOG_LEVEL = "INFO"
DEFAULT_FORMAT = "%(asctime)s | %(name)s | %(levelname)s | %(message)s"- Use structured error payloads in decorators and utilities
- Include error type and message in error responses
- Add trace information when debugging is needed
- Use the package logging system for error tracking
- Keep functions focused and single-purpose
- Use decorators for cross-cutting concerns (logging, error handling)
- Support both dict and JSON return formats where appropriate
- Include timing information for performance-critical operations
- Use descriptive class names with
Testprefix for test classes - Group related tests in logical test classes
- Use pytest fixtures for reusable test data
- Follow Arrange-Act-Assert pattern in tests
- Write comprehensive tests for all public functions
- Test both success and failure scenarios
- Use descriptive test method names that explain what is being tested
- Include edge cases and error conditions
- Use fixtures for reusable test setup
- Test decorator behavior with different parameter combinations
src/aa_pytools/
├── __init__.py # Package exports
├── core/ # Core functionality (logging, etc.)
├── decorators/ # Specialized decorators
├── execution/ # Execution management
├── vault/ # Credential management
└── api/ # API integration
The project uses better-commits with conventional commits:
feat:- New features (✨)fix:- Bug fixes (🐛)docs:- Documentation changes (📚)perf:- Performance improvements (🚀)test:- Test additions/fixes (🧪)build:- Build system changes (⚙️)
Commit format: type(scope): description (max 70 chars for title)
- pyproject.toml is the single source of truth for project configuration
- Use uv for dependency management
- setuptools as build backend
- pytest for testing framework
- ruff for linting and formatting
- Use the package logging system from
aa_pytools.core.logging - Auto-configure on first use within the package
- Support both console and file logging
- Use structured logging with consistent formatting
- Install dependencies:
make install - Write code following style guidelines
- Run linting:
ruff check . --fix && ruff format . - Run tests:
make test - Build package:
make build - Publish when ready (test first, then production)
- This is an RPA-focused library for Automation Anywhere integration
- Error safety is critical - use decorators like
@safe_execute - Performance timing should be included in key operations
- Credential security is important in vault operations
- API integration should be robust and well-tested
- Always run tests after changes:
make test - Use the existing logging system, don't import
loggingdirectly - Follow the established patterns in similar modules
- Add comprehensive tests for new functionality
- Update documentation when adding new features
- Use semantic versioning for releases