Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): generate docs from docstrings #5131

Open
wants to merge 632 commits into
base: develop
Choose a base branch
from

Conversation

JP-Ellis
Copy link

@JP-Ellis JP-Ellis commented Sep 5, 2024

Issue number: #5125

Summary

Changes

This is a fairly major change to the docs and generates documentation for all public methods, attributes and variables in AWS Powertools.

This is achieved using mkdocstrings, which replaces instances of

::: some.module.path

with the documentation of the specified module.

As a side effect of generating the documentation, an objects.inv file is also generated.

From a quick purview of the generated docs, they seem pretty good as the underlying code appears well documented; however, this probably needs to be double checked. Especially for cases where the Numpy docstring style is not being followed which may result in errors generating the docs.

User experience

There is no change to the usage of AWS Powertools.

There will be a significant change to the documentation in that the classes/functions/variables will be made public. Most editors would already be presenting this information to developers already, but this just makes it discoverable online.

The main benefit here is that other docs which want to refer to a specific class or function from AWS Powertools can now do so using the objects.inv file generated.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • Meet tenets criteria
  • I have performed a self-review of this change
  • Changes have been tested
    • I have tested the generation of docs locally, but I am not familiar with the rest of your pipeline for the documentation.
  • Changes are documented
    • As these are changes to the documentation itself, they should be self-evident to the end users
    • I would be happy to be pointed to most appropriate for the documentation on the documentation
  • PR title follows conventional commit semantics

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

dependabot bot and others added 30 commits July 12, 2024 08:09
Bumps [cfn-lint](https:/aws-cloudformation/cfn-lint) from 1.5.3 to 1.6.0.
- [Release notes](https:/aws-cloudformation/cfn-lint/releases)
- [Changelog](https:/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md)
- [Commits](aws-cloudformation/cfn-lint@v1.5.3...v1.6.0)

---
updated-dependencies:
- dependency-name: cfn-lint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Bumps [cfn-lint](https:/aws-cloudformation/cfn-lint) from 1.6.0 to 1.6.1.
- [Release notes](https:/aws-cloudformation/cfn-lint/releases)
- [Changelog](https:/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md)
- [Commits](aws-cloudformation/cfn-lint@v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: cfn-lint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
aws-powertools#4753)

Bumps [actions/dependency-review-action](https:/actions/dependency-review-action) from 4.3.3 to 4.3.4.
- [Release notes](https:/actions/dependency-review-action/releases)
- [Commits](actions/dependency-review-action@72eb03d...5a2ce3f)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
* Initial commit OpenAPI Extensions

* Polishing the PR with best practicies - Comments

* Polishing the PR with best practicies - Tests

* Polishing the PR with best practicies - make pydanticv2 happy

* Polishing the PR with best practicies - using model_validator to be more specific

* Temporary mypy disabling

* Make mypy happy?

* Make mypy happy?

* Polishing the PR with best practicies - adding e2e tests

* Adding docstring

* Adding documentation

* Addressing Simon's feedback

* Addressing Simon's feedback

* Addressing Simon's feedback

* Adding more tests

* Adding more tests

* Adding more tests
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…07 to 0.1.211 (aws-powertools#4760)

chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs

Bumps [cdklabs-generative-ai-cdk-constructs](https:/awslabs/generative-ai-cdk-constructs) from 0.1.207 to 0.1.211.
- [Release notes](https:/awslabs/generative-ai-cdk-constructs/releases)
- [Changelog](https:/awslabs/generative-ai-cdk-constructs/blob/main/CHANGELOG.md)
- [Commits](awslabs/generative-ai-cdk-constructs@v0.1.207...v0.1.211)

---
updated-dependencies:
- dependency-name: cdklabs-generative-ai-cdk-constructs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…#4763)

Bumps [sentry-sdk](https:/getsentry/sentry-python) from 2.9.0 to 2.10.0.
- [Release notes](https:/getsentry/sentry-python/releases)
- [Changelog](https:/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-python@2.9.0...2.10.0)

---
updated-dependencies:
- dependency-name: sentry-sdk
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [ruff](https:/astral-sh/ruff) from 0.5.1 to 0.5.2.
- [Release notes](https:/astral-sh/ruff/releases)
- [Changelog](https:/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.5.1...0.5.2)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#4765)

Bumps [aws-cdk](https:/aws/aws-cdk/tree/HEAD/packages/aws-cdk) from 2.148.0 to 2.149.0.
- [Release notes](https:/aws/aws-cdk/releases)
- [Changelog](https:/aws/aws-cdk/blob/main/CHANGELOG.v2.md)
- [Commits](https:/aws/aws-cdk/commits/v2.149.0/packages/aws-cdk)

---
updated-dependencies:
- dependency-name: aws-cdk
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rtools#4764)

Bumps [mkdocs-material](https:/squidfunk/mkdocs-material) from 9.5.28 to 9.5.29.
- [Release notes](https:/squidfunk/mkdocs-material/releases)
- [Changelog](https:/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.5.28...9.5.29)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…11 to 0.1.212 (aws-powertools#4769)

chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs

Bumps [cdklabs-generative-ai-cdk-constructs](https:/awslabs/generative-ai-cdk-constructs) from 0.1.211 to 0.1.212.
- [Release notes](https:/awslabs/generative-ai-cdk-constructs/releases)
- [Changelog](https:/awslabs/generative-ai-cdk-constructs/blob/main/CHANGELOG.md)
- [Commits](awslabs/generative-ai-cdk-constructs@v0.1.211...v0.1.212)

---
updated-dependencies:
- dependency-name: cdklabs-generative-ai-cdk-constructs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…s#4770)

Bumps [datadog-lambda](https:/DataDog/datadog-lambda-python) from 6.96.0 to 6.97.0.
- [Release notes](https:/DataDog/datadog-lambda-python/releases)
- [Commits](DataDog/datadog-lambda-python@v6.96.0...v6.97.0)

---
updated-dependencies:
- dependency-name: datadog-lambda
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
… 1.27.27 in /layer/scripts/layer-balancer in the layer-balancer group (aws-powertools#4779)

chore(deps): bump github.com/aws/aws-sdk-go-v2/config

Bumps the layer-balancer group in /layer/scripts/layer-balancer with 1 update: [github.com/aws/aws-sdk-go-v2/config](https:/aws/aws-sdk-go-v2).


Updates `github.com/aws/aws-sdk-go-v2/config` from 1.27.26 to 1.27.27
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.27.26...config/v1.27.27)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tools#4776)

Bumps [pytest-asyncio](https:/pytest-dev/pytest-asyncio) from 0.23.7 to 0.23.8.
- [Release notes](https:/pytest-dev/pytest-asyncio/releases)
- [Commits](pytest-dev/pytest-asyncio@v0.23.7...v0.23.8)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [cfn-lint](https:/aws-cloudformation/cfn-lint) from 1.6.1 to 1.8.1.
- [Release notes](https:/aws-cloudformation/cfn-lint/releases)
- [Changelog](https:/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md)
- [Commits](aws-cloudformation/cfn-lint@v1.6.1...v1.8.1)

---
updated-dependencies:
- dependency-name: cfn-lint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Bumps [ruff](https:/astral-sh/ruff) from 0.5.2 to 0.5.3.
- [Release notes](https:/astral-sh/ruff/releases)
- [Changelog](https:/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.5.2...0.5.3)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a timeout. (aws-powertools#4773)

* fix(idempotency): fix timeout bug from aws-powertools#4759

* Adding comment

* Adding comment

---------

Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
…76beecf11f8e8539d73a3553bf4 to 80edfc24bdf1283400eb04d20a8a605ae8bf7d48 (aws-powertools#4786)

chore(deps): bump aws-actions/closed-issue-message

Bumps [aws-actions/closed-issue-message](https:/aws-actions/closed-issue-message) from 8b6324312193476beecf11f8e8539d73a3553bf4 to 80edfc24bdf1283400eb04d20a8a605ae8bf7d48.
- [Commits](aws-actions/closed-issue-message@8b63243...80edfc2)

---
updated-dependencies:
- dependency-name: aws-actions/closed-issue-message
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
….145 in the boto-typing group (aws-powertools#4787)

chore(deps-dev): bump mypy-boto3-secretsmanager in the boto-typing group

Bumps the boto-typing group with 1 update: [mypy-boto3-secretsmanager](https:/youtype/mypy_boto3_builder).


Updates `mypy-boto3-secretsmanager` from 1.34.128 to 1.34.145
- [Release notes](https:/youtype/mypy_boto3_builder/releases)
- [Commits](https:/youtype/mypy_boto3_builder/commits)

---
updated-dependencies:
- dependency-name: mypy-boto3-secretsmanager
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: boto-typing
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
dependabot bot and others added 13 commits September 4, 2024 09:02
…lancer with 3 updates (aws-powertools#5114)

chore(deps): bump the layer-balancer group

Bumps the layer-balancer group in /layer/scripts/layer-balancer with 3 updates: [github.com/aws/aws-sdk-go-v2](https:/aws/aws-sdk-go-v2), [github.com/aws/aws-sdk-go-v2/config](https:/aws/aws-sdk-go-v2) and [github.com/aws/aws-sdk-go-v2/service/lambda](https:/aws/aws-sdk-go-v2).


Updates `github.com/aws/aws-sdk-go-v2` from 1.30.4 to 1.30.5
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@v1.30.4...v1.30.5)

Updates `github.com/aws/aws-sdk-go-v2/config` from 1.27.31 to 1.27.32
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.27.31...config/v1.27.32)

Updates `github.com/aws/aws-sdk-go-v2/service/lambda` from 1.58.1 to 1.58.2
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@service/s3/v1.58.1...service/s3/v1.58.2)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
- dependency-name: github.com/aws/aws-sdk-go-v2/service/lambda
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ws-powertools#5115)

Bumps [pypa/gh-action-pypi-publish](https:/pypa/gh-action-pypi-publish) from 1.10.0 to 1.10.1.
- [Release notes](https:/pypa/gh-action-pypi-publish/releases)
- [Commits](pypa/gh-action-pypi-publish@8a08d61...0ab0b79)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
…03 (aws-powertools#5116)

Bumps [types-redis](https:/python/typeshed) from 4.6.0.20240819 to 4.6.0.20240903.
- [Commits](https:/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-redis
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
…to 2.155.0a0 (aws-powertools#5117)

chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha

Bumps [aws-cdk-aws-lambda-python-alpha](https:/aws/aws-cdk) from 2.154.1a0 to 2.155.0a0.
- [Release notes](https:/aws/aws-cdk/releases)
- [Changelog](https:/aws/aws-cdk/blob/main/CHANGELOG.v2.md)
- [Commits](https:/aws/aws-cdk/commits)

---
updated-dependencies:
- dependency-name: aws-cdk-aws-lambda-python-alpha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
…5119)

Bumps [cryptography](https:/pyca/cryptography) from 42.0.8 to 43.0.1.
- [Changelog](https:/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@42.0.8...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
…5118)

Bumps [cfn-lint](https:/aws-cloudformation/cfn-lint) from 1.11.1 to 1.12.1.
- [Release notes](https:/aws-cloudformation/cfn-lint/releases)
- [Changelog](https:/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md)
- [Commits](aws-cloudformation/cfn-lint@v1.11.1...v1.12.1)

---
updated-dependencies:
- dependency-name: cfn-lint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…boto-typing group (aws-powertools#5121)

chore(deps-dev): bump mypy-boto3-logs in the boto-typing group

Bumps the boto-typing group with 1 update: [mypy-boto3-logs](https:/youtype/mypy_boto3_builder).


Updates `mypy-boto3-logs` from 1.35.10 to 1.35.12
- [Release notes](https:/youtype/mypy_boto3_builder/releases)
- [Commits](https:/youtype/mypy_boto3_builder/commits)

---
updated-dependencies:
- dependency-name: mypy-boto3-logs
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: boto-typing
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…lancer with 2 updates (aws-powertools#5124)

chore(deps): bump the layer-balancer group

Bumps the layer-balancer group in /layer/scripts/layer-balancer with 2 updates: [github.com/aws/aws-sdk-go-v2/config](https:/aws/aws-sdk-go-v2) and [github.com/aws/aws-sdk-go-v2/service/lambda](https:/aws/aws-sdk-go-v2).


Updates `github.com/aws/aws-sdk-go-v2/config` from 1.27.32 to 1.27.33
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.27.32...config/v1.27.33)

Updates `github.com/aws/aws-sdk-go-v2/service/lambda` from 1.58.2 to 1.58.3
- [Release notes](https:/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@service/s3/v1.58.2...service/s3/v1.58.3)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
- dependency-name: github.com/aws/aws-sdk-go-v2/service/lambda
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: layer-balancer
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
…62 to 0.1.263 (aws-powertools#5122)

chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs

Bumps [cdklabs-generative-ai-cdk-constructs](https:/awslabs/generative-ai-cdk-constructs) from 0.1.262 to 0.1.263.
- [Release notes](https:/awslabs/generative-ai-cdk-constructs/releases)
- [Changelog](https:/awslabs/generative-ai-cdk-constructs/blob/main/CHANGELOG.md)
- [Commits](awslabs/generative-ai-cdk-constructs@v0.1.262...v0.1.263)

---
updated-dependencies:
- dependency-name: cdklabs-generative-ai-cdk-constructs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powertools for AWS Lambda (Python) bot <[email protected]>
Co-authored-by: Leandro Damascena <[email protected]>
…5126)

Bumps [cfn-lint](https:/aws-cloudformation/cfn-lint) from 1.12.1 to 1.12.3.
- [Release notes](https:/aws-cloudformation/cfn-lint/releases)
- [Changelog](https:/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md)
- [Commits](aws-cloudformation/cfn-lint@v1.12.1...v1.12.3)

---
updated-dependencies:
- dependency-name: cfn-lint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Leandro Damascena <[email protected]>
This is a fairly major change to the docs and generates documentation for all
public methods, attributes and variables in AWS Powertools.

This is achieved using `mkdocstrings`, which replaces instances of

```markdown
::: some.module.path
```

with the documentation of the specified module.

As a side effect of generating the documentation, an `objects.inv` file is also
generated.

From a quick purview of the generated docs, they seem pretty good as the
underlying code appears well documented; however, this probably needs to be
double checked. Especially for cases where the Numpy docstring style is not
being followed which may result in errors generating the docs.

Ref: aws-powertools#5125
Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis requested a review from a team as a code owner September 5, 2024 22:40
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation internal Maintenance changes labels Sep 5, 2024
Copy link

boring-cyborg bot commented Sep 5, 2024

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 5, 2024
Copy link

sonarcloud bot commented Sep 5, 2024

@github-actions github-actions bot added feature New feature or functionality and removed documentation Improvements or additions to documentation internal Maintenance changes labels Sep 9, 2024
@leandrodamascena
Copy link
Contributor

Hey @JP-Ellis thanks for working in this PR and creating a reproduicle outcome from what we can expect.

Let me split down my feedback to make easy we agree on the next steps.

pdoc3 vs mkdocstrings

We already have an API documentation created by pdoc3, which works well. Personally, I like it; however, I see much more value in using mkdocstrings because it integrates seamlessly with our documentation and offers greater potential to utilize features from MkDocs, which is fantastic. In addition, we already have an issue opened for this migration, which is a great step forward to agree with this kind of work.

Testing this PR

2 - I tested this PR locally and I was able to create the objects.inv file and render the new API tab, which is great to see this working and how it looks like.

Current limitations/problems

3 - Even if we agreeing to migrate from pdoc3 to mkdocstrings, I see some problems in accepting this PR as it is. To move forward, we need to rethink how to do this. In this PR, you are adding 55 new files and marking some to be ignored by markdown lint, which may have some undesirable effects. Also, I admit that our codebase is far from being suitable for mkdocstrings to render this perfectly - or even good. Here are some examples:

We should not render these attributes
image

The code is completely broken here
image

We should not have these special characters in the examples
image

Links without href tag
image

Making a smooth transition

I'm thinking about making a smooth transition from pdoc3 to mkdocstrings and splitting it by utility, rather than all utilities at once. I suggest this because we'll need to change a lot in our docstrings, comments, and others to have documentation that is actually usable by customers. Otherwise, we'll just introduce a new section that doesn't have much value and may generate doubts about how to use it.

Enabling a new Ruff rule

5 - We can use this opportunity to progressively enable a new Ruff linter rule: https://docs.astral.sh/ruff/rules/#pydocstyle-d. We didn't enable that because our docstrings and comments need to be revamped.

Next steps

So, based on what I explained before, I suggest the next steps are:

1 - Modify this PR to add just one utility and make all the changes we need to make to the mkdocstrings + docstrings configuration. I suggest we start with BatchProcessing as the codebase is not complex and we can do an excellent job on it that will serve as a base for the others.
2 - Enable the Ruff D rule on this PR and see which files Ruff complains about.
3 - Publish the first version with this new change and see how this looks like.

Please let me know what you think and if you would like to make these changes and go through some back-and-forth review process. If you don't have time to do this —we know everyone is very busy— I can handle it and ping you for reviews and feedback. Please let me know your thoughts.

Again, thanks a lot for kicking out this to make our documentation even better.

@leandrodamascena leandrodamascena added the on-hold This item is on-hold and will be revisited in the future label Sep 9, 2024
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving a comment to Request Changes.

@leandrodamascena leandrodamascena linked an issue Sep 9, 2024 that may be closed by this pull request
1 task
@JP-Ellis
Copy link
Author

JP-Ellis commented Sep 9, 2024

Amazing feedback!

I should have made it clear at the start that this is meant to be a first proof-of-concept and step towards MkDocstrings. I didn't want to invest too much time in case this wasn't going to be adopted. I'm glad to hear this is something you are keen on!

To answer some of your more specific feedback.

pdoc3 vs mkdocstrings

We already have an API documentation [and] we already have an issue opened for [migrating to MkDocs]

I'll be honest, I completely missed that. But I'm glad to hear this was in the pipeline already!

In this PR, you are adding 55 new files and marking some to be ignored by markdown lint, which may have some undesirable effects.

Completely agree. When I personally use this, I actually create a small Python scripts that is invoked by Mkdocs to automatically generate the Markdown files on-the-fly. There are a couple of pros and cons:

  • Pro: The Markdown files are guaranteed to correspond to the Python files
  • Pro: No need to commit a large number of mostly-the-same Markdown files
  • Con: It may seem a bit 'magical' to someone unfamiliar
  • Con: It doesn't allow for customisation of the Markdown file on a per-file basis (I would say that for API docs, this is typically not a big issue)
  • Con: It adds yet another dependency, though only for building the docs.

Also, I admit that our codebase is far from being suitable for mkdocstrings to render this perfectly [...] we'll just introduce a new section that doesn't have much value and may generate doubts about how to use it.

Yeah, that's completely fair. A per-utility approach would certainly be possible. Since you already have the pdoc3 docs up, you could also put a disclaimer during the transition to the effect of

Note

The below docs are in the process of being transitioned and may contain some formatting issues.

We can use this opportunity to progressively enable a new Ruff linter rule: https://docs.astral.sh/ruff/rules/#pydocstyle-d. We didn't enable that because our docstrings and comments need to be revamped.

Absolutely a fantastic thing to add. Just be aware that Ruff doesn't necessarily enforce all docstring rules all the time as it tries to be smart about which lints are applicable to which rules. As a concrete example in repos I maintain, Ruff will detect if there is a mismatch between the args documented and the args in the function; but it will not raise a lint if the docstring has no args at all. This can be problematic if the args are in fact documented but in a style which Ruff did not expect.

With the pace of Ruff's development, this may have changed over the past months, but that is something to be aware of.

  1. Modify this PR to add just one utility and make all the changes we need to make to the mkdocstrings + docstrings configuration. I suggest we start with BatchProcessing as the codebase is not complex and we can do an excellent job on it that will serve as a base for the others.
  2. Enable the Ruff D rule on this PR and see which files Ruff complains about.
  3. Publish the first version with this new change and see how this looks like.

Sounds good! I won't get much time this week to contribute, but hopefully this weekend or next week I should get a bit of time :)

@leandrodamascena
Copy link
Contributor

Hey @JP-Ellis! Thanks for the feedback and clarifying things about this PoC. I am writing additional feedback based on your answers.

Completely agree. When I personally use this, I actually create a small Python scripts that is invoked by Mkdocs to automatically generate the Markdown files on-the-fly. There are a couple of pros and cons:

Yes, we should avoid doing this. My observation about the number of files is because it makes it difficult to review the PR and we can lose attention with too many files. That's why I suggested dividing this into small PRs by utility, which will make our work easier.

Yeah, that's completely fair. A per-utility approach would certainly be possible. Since you already have the pdoc3 docs up, you could also put a disclaimer during the transition to the effect of

Perfect, this is a really good idea.

Absolutely a fantastic thing to add. Just be aware that Ruff doesn't necessarily enforce all docstring rules all the time as it tries to be smart about which lints are applicable to which rules. As a concrete example in repos I maintain, Ruff will detect if there is a mismatch between the args documented and the args in the function; but it will not raise a lint if the docstring has no args at all. This can be problematic if the args are in fact documented but in a style which Ruff did not expect.

With the pace of Ruff's development, this may have changed over the past months, but that is something to be aware of.

Hmmm, I didn't know that. I'll spend some time checking this out and see what limitations/caveats we should be aware of and deal with "manually" when doing this work.

  1. Modify this PR to add just one utility and make all the changes we need to make to the mkdocstrings + docstrings configuration. I suggest we start with BatchProcessing as the codebase is not complex and we can do an excellent job on it that will serve as a base for the others.
  2. Enable the Ruff D rule on this PR and see which files Ruff complains about.
  3. Publish the first version with this new change and see how this looks like.

Sounds good! I won't get much time this week to contribute, but hopefully this weekend or next week I should get a bit of time :)

Perfect! Take your time, no rush at all and will be amazing to make this change and improve our documentation.

Thanks for taking the time to do this and let's make it happen 😄

@leandrodamascena leandrodamascena changed the base branch from v2 to develop October 5, 2024 22:20
@boring-cyborg boring-cyborg bot added the github-actions Pull requests that update Github_actions code label Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality github-actions Pull requests that update Github_actions code on-hold This item is on-hold and will be revisited in the future size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Addition of docs inventory (objects.inv)