Skip to content

Update the contributing doc #106

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

Merged
merged 1 commit into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,43 @@

We love pull requests. Here's a quick guide.

Fork, then clone:

```bash
git clone [email protected]:your-username/datadog-lambda-python.git
```

Make your change, update tests and ensure the tests pass (install Docker if you haven't):

```bash
./scripts/run_tests.sh
```

Push to your fork and [submit a pull request][pr].
1. Fork, clone and branch off `main`:
```bash
git clone [email protected]:<your-username>/datadog-lambda-python.git
git checkout -b <my-branch>
```
1. Make your changes. Ensure your code is compatible with both Python 2.7 and 3.X.
1. Test your Lambda function against the locally modified version of Datadog Lambda library.
* 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.

```bash
ln -s /PATH/TO/datadog-lambda-python/datadog_lambda /PATH/TO/MY/PROJECT
```
* 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.
* You can also build and publish a Lambda layer to your own AWS account and use it for testing.

```bash
# Build layers using docker
./scripts/build_layers.sh

# Publish the a testing layer to your own AWS account, and the ARN will be returned
# Example: ./scripts/publish_layers.sh us-east-1 Datadog-Python37
./scripts/publish_layers.sh <AWS_REGION> <Layer_Name>
```

1. Ensure the unit tests pass (install Docker if you haven't):
```bash
./scripts/run_tests.sh
```
1. Run the integration tests against your own AWS account and Datadog org (or ask a Datadog member to run):
```bash
BUILD_LAYERS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh
```
1. Update integration test snapshots if needed:
```bash
UPDATE_SNAPSHOTS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh
```
1. Push to your fork and [submit a pull request][pr].

[pr]: https://github.com/your-username/datadog-lambda-python/compare/DataDog:main...main

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![build](https://github.com/DataDog/datadog-lambda-python/workflows/build/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/datadog-lambda)](https://pypi.org/project/datadog-lambda/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datadog-lambda)
[![Slack](https://img.shields.io/badge/slack-%23serverless-blueviolet?logo=slack)](https://datadoghq.slack.com/channels/serverless/)
[![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)

Datadog Lambda Library for Python (2.7, 3.6, 3.7 and 3.8) enables enhanced Lambda metrics, distributed tracing, and custom metric submission from AWS Lambda functions.
Expand Down Expand Up @@ -99,6 +99,10 @@ You can also open an issue for a feature request.

If you find an issue with this package and have a fix, please feel free to open a pull request following the [procedures](CONTRIBUTING.md).

## Community

For product feedback and questions, join the `#serverless` channel in the [Datadog community on Slack](https://chat.datadoghq.com/).

## License

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
Expand Down