Skip to content

Commit 7e9eded

Browse files
committed
doc: MPT-20094 reorganize repository documentation
AI Generated. Rework the repository documentation structure around a developer-focused usage guide, shared-standard links, and a concise README. Replace PROJECT_DESCRIPTION with usage.md, add documentation rules, and keep Docker-based workflow guidance in the topic-specific docs.
1 parent 4092352 commit 7e9eded

10 files changed

Lines changed: 331 additions & 241 deletions

File tree

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,8 @@
11
---
2-
description: 'Python coding conventions and guidelines'
3-
applyTo: '**/*.py'
2+
description: 'Repository entry point for Copilot'
3+
applyTo: '**'
44
---
55

6-
# Python Coding Conventions
6+
# Copilot Instructions
77

8-
## General Instructions
9-
- All configuration **must be provided via environment variables**.
10-
- Do not hardcode configuration values.
11-
- Write maintainable, readable, and predictable code.
12-
- In `pyproject.toml`:
13-
- Use `*` for **minor versions only**
14-
`django==4.2.*`
15-
`django==^4.2.2`
16-
17-
- Use consistent naming conventions and follow language-specific best practices.
18-
19-
## Python Instructions
20-
- Use type annotations (PEP 484) - except in the `tests/` folder.
21-
- All public functions, methods, and classes **must include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html)**.
22-
- **Do not add inline comments**; rely on clear code and docstrings instead.
23-
- Function and variable names must be explicit and intention-revealing.
24-
- `pyproject.toml` is the source of truth for code quality rules. Generated code must not violate any configured rules.
25-
- **ruff** is the primary linter for general Python style and best practices.
26-
- **flake8** is used exclusively to run:
27-
- `wemake-python-styleguide` - Enforces strict Python coding standards ([docs](https://wemake-python-styleguide.readthedocs.io/en/latest/))
28-
- `flake8-aaa` - Validates the AAA pattern in tests
29-
- Follow PEP 8 unless explicitly overridden by ruff.
30-
- Prefer simple, explicit code over clever or compact implementations.
31-
32-
## Testing
33-
- Use pytest only.
34-
- Tests must be written as **functions**, not classes.
35-
- Test files and functions must use the `test_` prefix.
36-
- Follow ***AAA(Arrange - Act - Assert)*** strictly. See the [flake8-aaa documentation](https://flake8-aaa.readthedocs.io/en/stable/index.html).
37-
- Do **not** use `if` statements or branching logic inside tests.
38-
- Prefer fixtures over mocks whenever possible.
39-
- Avoid duplicating test logic; extract shared setup into fixtures.
40-
- Use `mocker` only when mocking is unavoidable.
41-
- Never use `unittest.mock` directly.
42-
- Always use `spec` or `autospec` when mocking.
43-
- Use `@pytest.mark.parametrize` tests when testing permutations of the same behavior.
8+
Read [AGENTS.md](../../AGENTS.md) first.

AGENTS.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
# AGENTS.md
22

3-
This file is the AI assistant entry point for `mpt-api-python-client`.
4-
5-
## Repository Purpose
6-
73
Python API client for the SoftwareONE Marketplace Platform (MPT) API. Provides synchronous
84
(`MPTClient`) and asynchronous (`AsyncMPTClient`) clients built on httpx, with typed
95
resource services, mixin-based HTTP operations, and an RQL query builder.
106

117
## Documentation Reading Order
128

13-
1. `README.md` — project overview and quick start
14-
2. `docs/architecture.md` — layered architecture, directory structure, key abstractions
15-
3. `docs/testing.md` — test structure, tooling, conventions, how to run tests
16-
4. `docs/contributing.md` — development workflow, coding conventions, linting setup
17-
5. `docs/local-development.md` — Docker setup, Make targets, environment variables
18-
19-
## Library Usage
20-
21-
See `docs/PROJECT_DESCRIPTION.md` for installation and usage examples (sync and async).
9+
1. `README.md` — repository overview, quick start, and documentation map
10+
2. `docs/usage.md` — installation, configuration, Python usage examples, and supported Docker-based commands
11+
3. `docs/architecture.md` — layered architecture, directory structure, and key abstractions
12+
4. `docs/local-development.md` — Docker-only setup and execution model
13+
5. `docs/testing.md` — repository-specific testing strategy and command mapping
14+
6. `docs/contributing.md` — repository-specific workflow and links to shared standards
15+
7. `docs/documentation.md` — repository-specific documentation rules
16+
17+
Then inspect the code paths relevant to the task:
18+
19+
- `mpt_api_client/mpt_client.py` — public sync and async client entry points
20+
- `mpt_api_client/http/` — HTTP clients, services, query state, and reusable mixins
21+
- `mpt_api_client/resources/` — domain resource groups such as catalog, commerce, billing, and integration
22+
- `mpt_api_client/models/` — response model layer and collection wrappers
23+
- `mpt_api_client/rql/` — fluent RQL query builder
24+
- `tests/unit/` — unit coverage for transport, resources, models, and query builder
25+
- `tests/e2e/` — live API coverage by domain
26+
- `make/` and `compose.yaml` — Docker-based local command entry points
2227

2328
## API Reference
2429

25-
The upstream MPT API is described by the OpenAPI spec:
30+
The upstream API contract is the MPT OpenAPI spec:
2631
https://api.s1.show/public/v1/openapi.json
2732

28-
Use this to understand available endpoints, request/response schemas, and field names.
29-
3033
## Key Commands
3134

3235
| Command | Purpose |
@@ -36,6 +39,15 @@ Use this to understand available endpoints, request/response schemas, and field
3639
| `make check` | Run all linting and type checks |
3740
| `make check-all` | Run checks + tests |
3841
| `make format` | Auto-format code |
42+
| `make bash` | Open a shell in the Docker container |
43+
| `make run` | Start an IPython session in Docker |
44+
45+
## Repository Rules
46+
47+
- Prefer Docker-based `make` targets over ad hoc local Python commands.
48+
- Keep `README.md` concise and navigational.
49+
- Put topic-specific documentation under `docs/` instead of expanding `README.md`.
50+
- Link shared engineering rules from `mpt-extension-skills` instead of duplicating them locally.
3951

4052
## Project Structure
4153

@@ -48,16 +60,3 @@ mpt_api_client/
4860
├── rql/ # RQL query builder
4961
└── exceptions.py # Error hierarchy
5062
```
51-
52-
## Shared Standards
53-
54-
This repository follows shared engineering standards from
55-
[mpt-extension-skills](https://github.com/softwareone-platform/mpt-extension-skills):
56-
57-
- `standards/python-style-guide.md`
58-
- `standards/testing-standard.md`
59-
- `standards/contributing-standard.md`
60-
- `standards/pull-request-guidelines.md`
61-
62-
63-

README.md

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-api-python-client&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-api-python-client)
2-
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=softwareone-platform_mpt-api-python-client&metric=coverage)](https://sonarcloud.io/summary/new_code?id=softwareone-platform_mpt-api-python-client)
3-
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
4-
51
# mpt-api-python-client
62

73
Python API client for the SoftwareONE Marketplace Platform (MPT) API.
@@ -10,6 +6,20 @@ Provides synchronous (`MPTClient`) and asynchronous (`AsyncMPTClient`) clients b
106
[httpx](https://www.python-httpx.org/), with typed resource services, mixin-based HTTP
117
operations, and an RQL query builder.
128

9+
## Documentation
10+
11+
Start with these documents:
12+
13+
- [AGENTS.md](AGENTS.md): AI-agent entry point and reading order
14+
- [docs/usage.md](docs/usage.md): installation, configuration, Python usage examples, and Docker-based commands
15+
- [docs/architecture.md](docs/architecture.md): repository structure, layers, and key abstractions
16+
- [docs/local-development.md](docs/local-development.md): Docker-only local setup and execution model
17+
- [docs/testing.md](docs/testing.md): repository-specific test strategy and commands
18+
- [docs/contributing.md](docs/contributing.md): repository-specific workflow and links to shared standards
19+
- [docs/documentation.md](docs/documentation.md): repository-specific documentation rules
20+
- [docs/rql.md](docs/rql.md): fluent RQL query builder guide
21+
- [MPT OpenAPI Spec](https://api.s1.show/public/v1/openapi.json): upstream API contract
22+
1323
## Quick Start
1424

1525
```bash
@@ -18,51 +28,10 @@ make build
1828
make test
1929
```
2030

21-
## Usage
22-
23-
**[Installation & Usage Guide](docs/PROJECT_DESCRIPTION.md)**
24-
25-
```python
26-
from mpt_api_client import MPTClient
27-
28-
client = MPTClient() # reads MPT_API_TOKEN and MPT_API_BASE_URL from environment
29-
30-
for product in client.catalog.products.iterate():
31-
print(product.name)
32-
```
33-
34-
### RQL Filtering Example
35-
36-
```python
37-
from mpt_api_client import MPTClient, RQLQuery
38-
39-
client = MPTClient()
40-
products = client.catalog.products
41-
42-
target_ids = RQLQuery("id").in_([
43-
"PRD-123-456",
44-
"PRD-789-012",
45-
])
46-
active = RQLQuery(status="active")
47-
vendor = RQLQuery("vendor.name").eq("Microsoft")
48-
49-
query = target_ids & active & vendor
50-
51-
for product in products.filter(query).order_by("-audit.updated.at").select("id", "name").iterate():
52-
print(product.id, product.name)
53-
```
54-
55-
## Documentation
31+
Use `make help` to inspect all supported Docker-based commands.
5632

57-
| Document | Description |
58-
|----------------------------------------------------------------|-------------------------------------------------------------|
59-
| [Architecture](docs/architecture.md) | Layered architecture, directory structure, key abstractions |
60-
| [RQL Guide](docs/rql.md) | Fluent builder for Resource Query Language filters |
61-
| [Contributing](docs/contributing.md) | Development workflow, coding conventions, linting setup |
62-
| [Testing](docs/testing.md) | Test structure, tooling, conventions |
63-
| [Local Development](docs/local-development.md) | Docker setup, Make targets, environment variables |
64-
| [Usage Guide](docs/PROJECT_DESCRIPTION.md) | Installation, sync and async usage examples |
65-
| [MPT OpenAPI Spec](https://api.s1.show/public/v1/openapi.json) | Upstream API contract (endpoints, schemas) |
33+
See [docs/usage.md](docs/usage.md) for installation details, sync and async examples, RQL
34+
usage, and Docker-based command examples.
6635

6736
## Key Commands
6837

@@ -75,5 +44,3 @@ make format # auto-format code
7544
make bash # open a shell in the container
7645
make run # start an IPython session
7746
```
78-
79-
Run `make help` to see all available commands.

docs/PROJECT_DESCRIPTION.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/contributing.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
11
# Contributing
22

3-
This document describes the development workflow and coding conventions for
4-
`mpt-api-python-client`.
3+
This document captures repository-specific contribution guidance. Shared engineering rules
4+
live in `mpt-extension-skills` and should be linked, not copied, from this repository.
55

6-
- [Package architecture](./architecture.md)
7-
- [Python coding standards](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/python-coding.md)
8-
- [Extensions best practices](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/extensions-best-practices.md)
6+
## Shared Standards
7+
8+
- [Python coding conventions](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/python-coding.md)
99
- [Packages and dependencies](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/packages-and-dependencies.md)
10-
- [Testing](./testing.md)
11-
- [Unit tests](./unit_tests.md)
12-
- [E2E tests](./e2e_tests.md)
1310
- [Pull requests](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/pull-requests.md)
14-
- [Makefiles](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/makefiles.md)
15-
- [Makefile targets](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/knowledge/make-targets.md)
11+
- [Repository documentation](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/documentation.md)
12+
- [Makefile structure](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/makefiles.md)
13+
14+
## Shared Knowledge
15+
16+
- [Build and checks](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/knowledge/build-and-checks.md)
17+
- [Make target meanings](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/knowledge/make-targets.md)
18+
19+
## Development Model
20+
21+
This repository uses Docker as the default local execution model.
22+
23+
- Use `make build` to build the container image.
24+
- Use `make bash` when you need an interactive shell inside the container.
25+
- Use `make run` for an IPython session with project dependencies available.
26+
- Use `make test`, `make check`, and `make check-all` through the provided `make` targets.
27+
28+
## Repository-Specific Expectations
29+
30+
- Keep public API changes aligned with [`mpt_api_client/mpt_client.py`](../mpt_api_client/mpt_client.py) and the resource/service layout described in [architecture.md](architecture.md).
31+
- Keep resource-specific behavior inside the matching module under [`mpt_api_client/resources/`](../mpt_api_client/resources).
32+
- Keep transport and query behavior inside [`mpt_api_client/http/`](../mpt_api_client/http) and [`mpt_api_client/rql/`](../mpt_api_client/rql).
33+
- Add or update tests near the affected domain under [`tests/unit/`](../tests/unit) or [`tests/e2e/`](../tests/e2e).
34+
- When repository behavior changes, update the narrowest relevant document under [`docs/`](.).
35+
36+
## Validation Before Review
37+
38+
Follow the shared validation flow from
39+
[knowledge/build-and-checks.md](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/knowledge/build-and-checks.md).
40+
41+
In this repository, run validation through the Docker-based targets documented in
42+
[testing.md](testing.md). Use `make build` first when dependencies or `uv.lock` change.

docs/documentation.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Documentation
2+
3+
This repository follows the shared documentation standard:
4+
5+
- [standards/documentation.md](https://github.com/softwareone-platform/mpt-extension-skills/blob/main/standards/documentation.md)
6+
7+
This file documents repository-specific documentation rules only.
8+
9+
## Repository Rules
10+
11+
- `README.md` must stay concise and act as the main human entry point.
12+
- `AGENTS.md` must stay operational and tell AI agents which files to read first.
13+
- Topic-specific documentation must live in the matching file under [`docs/`](.).
14+
- Shared engineering rules must be linked from `mpt-extension-skills` instead of copied into this repository.
15+
- When changing setup, usage, testing, or architecture behavior, update the corresponding document in the same change.
16+
- `docs/usage.md` is the source of truth for installation, configuration, examples, and supported command entry points.
17+
18+
## Current Documentation Map
19+
20+
- [`README.md`](../README.md): overview, quick start, and documentation map
21+
- [`AGENTS.md`](../AGENTS.md): AI-agent entry point and reading order
22+
- [`usage.md`](usage.md): install, configure, and use the client
23+
- [`architecture.md`](architecture.md): repository structure and major abstractions
24+
- [`local-development.md`](local-development.md): Docker-only local setup and execution
25+
- [`testing.md`](testing.md): repository-specific testing strategy
26+
- [`contributing.md`](contributing.md): repository workflow and shared-standard links
27+
- [`rql.md`](rql.md): RQL query builder guide
28+
29+
## Change Rule
30+
31+
Prefer updating the smallest relevant document instead of creating overlapping summary files.

0 commit comments

Comments
 (0)