aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.84k stars 389 forks source link

Docs: Move code snippets into dedicated python files add formatting and linting, fixing any outstanding errors #1064

Closed michaelbrewer closed 2 years ago

michaelbrewer commented 2 years ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

In the past there was many documentation errors found like #1004 , on a regular basis i would try to help the community by verifying the code examples, that they can compile, linted, valid formatting and had the correct line highlights

As part of general papercuts #857 and then later #1009 it was decided to split up the examples into separate files so that they can be linted or validates.

Currently the AWS Lambda Documentation has many typos, syntax errors, missing imports, invalid yaml indentation and terraform errors (about 25 errors currently and we keeping on running into this errors each time code examples are updated or added (see #1004). Here is a list of some of them as separate issues:

Hosted version of this is at: https://gyft.github.io/aws-lambda-powertools-python/latest/

Describe alternatives you've considered

Keeping the examples inside the markdown docs. But we run into issues like below, where errors are not easily picked up

Additional context

As a side effect many existing errors will be resolved AND measures put in to prevent them from happening again. Here is a list of errors currently in the documentation

List of open pull requests

Originally part of a simple PR #1065 but now split up into smaller ones

michaelbrewer commented 2 years ago

I have a pull request that partially fixes this (as there is a lot of examples to migrate). So once there is feedback on this I can continue.

michaelbrewer commented 2 years ago

@heitorlessa @sthulb - as part of the original papercuts, we had discuss how many errors we have fund in the code examples, and that extracting them into separate files would allow us to add formatting (isort, black), check for syntax error (py_compile) and perform linting (cfn-lint etc..).

So in a series of pull requests, i have extracted and fixes all of the code examples (python, terraform and sam templates) and fixed (over 25 errors so far). Some of these pull requests has quite a few errors and some just have smaller formatting inconsistencies.

sthulb commented 2 years ago

The pull requests associated with this issue will be resolved eventually. There’s a lot of them and they’re quite large too.

michaelbrewer commented 2 years ago

Yep and covers 25 error in the docs too

michaelbrewer commented 2 years ago

Updated preview of fixed docs is hosted here: https://gyft.github.io/aws-lambda-powertools-python/latest/

Up to version 1.25.10

michaelbrewer commented 2 years ago

@sthulb i have adding all of the missing bug reports for syntax errors identified from this task.

michaelbrewer commented 2 years ago

Updated preview of fixed docs is hosted here: gyft.github.io/aws-lambda-powertools-python/latest

Up to version 1.26.1

github-actions[bot] commented 2 years ago

Comments on closed issues are hard for our team to see.