Skip to content
Closed
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
50 changes: 50 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Here are some notes for Python CDK development.

For comprehensive development guidelines, please also refer to the [CONTRIBUTING.md](./docs/CONTRIBUTING.md) file which contains important information for human developers.

## Development Setup

* Use Poetry for dependency management
- Install dependencies with `poetry install --all-extras`
- Run commands with `poetry run` or activate the virtual environment
- Use Poe tasks for common operations: `poetry run poe list`

## Testing

* Write unit tests in the `unit_tests` directory
- Tests should follow the same directory structure as the code they test
- Use pytest fixtures for common test setup
- Run tests with `poetry run poe pytest` or `poetry run poe pytest-fast` for faster tests

## Linting and Formatting

* Use Ruff for linting and formatting
- Run `poetry run poe format-fix` to auto-fix formatting issues
- Run `poetry run poe lint` to check for linting issues
- Run `poetry run poe check-all` to run all checks

## Code Organization

* Follow the existing module structure
- Place new code in the appropriate module based on functionality
- Use relative imports within modules
- Avoid circular dependencies by careful import ordering

## Import Conventions

* Avoid circular dependencies by following these guidelines:
- Submodules should import from lower-level modules, not from the top-level `airbyte_cdk` package
- Use `if TYPE_CHECKING:` blocks for imports that are only used as type hints
- For modules with circular dependency risks, use explicit relative imports

* Special handling for `__init__.py` files:
- Do not auto-sort imports in `__init__.py` files with isort
- Pay special attention to import order in `__init__.py` files to prevent circular dependencies

## Docstring Standards

* Use Google-style docstrings
- First sentence must be a one-liner on the same line as opening `"""` and end with a period
- Multi-line docstrings require a blank line after the one-liner
- Args section is optional, but if "args:" is specified, all arguments must be documented
- Argument types should not be documented in docstrings as they are already in function signatures
4 changes: 4 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Only Airbyte CDK maintainers can run slash commands. The most common slash comma
The full list of available slash commands can be found in the [slash command dispatch file](https://github.com/airbytehq/airbyte-python-cdk/blob/main/.github/workflows/slash_command_dispatch.yml#L21-L25).

# Appendix: Advanced Topics
## Development Guidelines for AI Agents

This repo houses a [`.cursorrules`](./../.cursorrules) file at the root of the repository. This is used to guide AI agents working within the repo. It may also have helpful info for new developers onboarding to the repo.


## Using MockServer in Place of Direct API Access

Expand Down
Loading