Closed keithrozario closed 2 months ago
Thank you!
I assume examples in https://github.com/opensearch-project/opensearch-py/tree/main/samples/bulk do actually run, but if you have a minute please do double-check.
Would love to find a way where the guides are tested, at least for syntax correctness.
Link checker is failing, if you have a second to fix that it'd be amazing!
Thanks for merging this.
"Would love to find a way where the guides are tested, at least for syntax correctness."
One thing we could do (and we do for other repos as well) is to move all the code to separate .py files instead of inline in the docs. From there we can lint the .py files to ensure syntax correctness. If it's something the project is looking into, I can perhaps help with that as well.
@keithrozario I think it could be helpful, however I also think people appreciate guides with code snippets in them. We already have working samples. Dunno, maybe it's not worth overthinking.
Another idea is to go the route of https://github.com/opensearch-project/documentation-website/issues/7700 where we generate samples and documentation from spec (https://github.com/opensearch-project/documentation-website/issues/7700), we have these end-to-end tests that run against a real OpenSearch in https://github.com/opensearch-project/opensearch-api-specification/tree/main/tests, they could be turned into working samples and docs mechanically.
Fixed examples to make them working python code. (missing commas and quotes.
Description
Example code in the docs were missing crucial commas and double quotes. It meant the code wouldn't run in Python.
While it is a relatively small error that most Python developers will notice it, newcomers might struggle to find the error.
Hope this pull requests makes the example code easier to understand.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.