|
2 | 2 |
|
3 | 3 | We love pull requests. Here's a quick guide.
|
4 | 4 |
|
5 |
| -Fork, then clone: |
6 |
| - |
7 |
| -```bash |
8 |
| -git clone git@github.com:your-username/datadog-lambda-python.git |
9 |
| -``` |
10 |
| - |
11 |
| -Make your change, update tests and ensure the tests pass (install Docker if you haven't): |
12 |
| - |
13 |
| -```bash |
14 |
| -./scripts/run_tests.sh |
15 |
| -``` |
16 |
| - |
17 |
| -Push to your fork and [submit a pull request][pr]. |
| 5 | +1. Fork, clone and branch off `main`: |
| 6 | + ```bash |
| 7 | + git clone git@github.com:<your-username>/datadog-lambda-python.git |
| 8 | + git checkout -b <my-branch> |
| 9 | + ``` |
| 10 | +1. Make your changes. Ensure your code is compatible with both Python 2.7 and 3.X. |
| 11 | +1. Test your Lambda function against the locally modified version of Datadog Lambda library. |
| 12 | + * The easiest approach is to create a soft link of the `datadog_lambda` folder in your project's root. Note, this only overrides the `datadog_lambda` module, and you still need to install the `datadog_lambda` package or the Lambda layer to have the required dependencies. |
| 13 | +
|
| 14 | + ```bash |
| 15 | + ln -s /PATH/TO/datadog-lambda-python/datadog_lambda /PATH/TO/MY/PROJECT |
| 16 | + ``` |
| 17 | + * Another option is to install the `datadog_lambda` module from the local folder. E.g., add `/PATH/TO/datadog-lambda-python/` to your `requirements.txt`. This approach only work in a Linux environment, because the dependency `ddtrace` utilizes the native C extension. |
| 18 | + * You can also build and publish a Lambda layer to your own AWS account and use it for testing. |
| 19 | +
|
| 20 | + ```bash |
| 21 | + # Build layers using docker |
| 22 | + ./scripts/build_layers.sh |
| 23 | +
|
| 24 | + # Publish the a testing layer to your own AWS account, and the ARN will be returned |
| 25 | + # Example: ./scripts/publish_layers.sh us-east-1 Datadog-Python37 |
| 26 | + ./scripts/publish_layers.sh <AWS_REGION> <Layer_Name> |
| 27 | + ``` |
| 28 | +
|
| 29 | +1. Ensure the unit tests pass (install Docker if you haven't): |
| 30 | + ```bash |
| 31 | + ./scripts/run_tests.sh |
| 32 | + ``` |
| 33 | +1. Run the integration tests against your own AWS account and Datadog org (or ask a Datadog member to run): |
| 34 | + ```bash |
| 35 | + BUILD_LAYERS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh |
| 36 | + ``` |
| 37 | +1. Update integration test snapshots if needed: |
| 38 | + ```bash |
| 39 | + UPDATE_SNAPSHOTS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh |
| 40 | + ``` |
| 41 | +1. Push to your fork and [submit a pull request][pr]. |
18 | 42 |
|
19 | 43 | [pr]: https://github.com/your-username/datadog-lambda-python/compare/DataDog:main...main
|
20 | 44 |
|
|
0 commit comments