Skip to content

Commit 4e208ea

Browse files
committed
docs: Add setup, testing and coding style sections to the CONTRIBUTING.md
Signed-off-by: Cagri Yonca <cagri@ibm.com>
1 parent 11aed06 commit 4e208ea

2 files changed

Lines changed: 65 additions & 25 deletions

File tree

.github/workflows/linter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: astral-sh/ruff-action@v3
99
with:
10+
args: check --output-format=github
1011
src: >-
1112
./src
1213
./tests
14+
./tests_autowrapt
1315
./tests_aws

CONTRIBUTING.md

Lines changed: 63 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ free to scratch it.
55

66
To contribute with code, please submit a [pull request].
77

8-
A good way to familiarize yourself with the codebase and contribution process is
9-
to look for and tackle low-hanging fruit in the [issue tracker].
8+
A good way to familiarize yourself with the codebase and contribution process
9+
is to look for and tackle low-hanging fruit in the [issue tracker].
1010

11-
<!--Before embarking on a more ambitious contribution, please quickly [get in touch](#communication) with us.-->
11+
<!--Before embarking on a more ambitious contribution, please quickly [get in
12+
touch](#communication) with us.-->
1213

1314
**Note: We appreciate your effort, and want to avoid a situation where a
14-
contribution requires extensive rework (by you or by us), sits in backlog for a
15-
long time, or cannot be accepted at all!**
15+
contribution requires extensive rework (by you or by us), sits in backlog for
16+
a long time, or cannot be accepted at all!**
1617

1718
## Proposing new features
1819

@@ -33,18 +34,18 @@ Do not forget to add the label `bug` to your issue.
3334
## Merge approval
3435

3536
The project maintainers use `LGTM` (Looks Good To Me) in comments on the code
36-
review to indicate acceptance. A pull request requires LGTMs from, at least, one
37-
of the maintainers of each component affected.
37+
review to indicate acceptance. A pull request requires LGTMs from, at least,
38+
one of the maintainers of each component affected.
3839

3940
For a list of the maintainers, see the [MAINTAINERS.md](MAINTAINERS.md) page.
4041

4142
## Legal
4243

4344
### Copyright
4445

45-
Each source file must include a Copyright header to IBM. When submitting a pull
46-
request for review which contains new source code files, the developer must
47-
include the following content in the beginning of the file.
46+
Each source file must include a Copyright header to IBM. When submitting a
47+
pull request for review which contains new source code files, the developer
48+
must include the following content in the beginning of the file.
4849

4950
```
5051
# (c) Copyright IBM Corp. <YEAR>
@@ -56,7 +57,8 @@ include the following content in the beginning of the file.
5657
We have tried to make it as easy as possible to make contributions. This
5758
applies to how we handle the legal aspects of contribution.
5859

59-
We use the same approach - the [Developer's Certificate of Origin 1.1 (DCO)] - that the [Linux® Kernel community] uses to manage code contributions.
60+
We use the same approach - the [Developer's Certificate of Origin 1.1 (DCO)] -
61+
that the [Linux® Kernel community] uses to manage code contributions.
6062

6163
We simply ask that when submitting a pull request for review, the developer
6264
must include a sign-off statement in the commit message.
@@ -75,22 +77,57 @@ local git repository using the following command:
7577
git commit -s
7678
```
7779

78-
<!--
79-
## Communication
80-
**FIXME** Please feel free to connect with us on our [Slack channel](link).
81-
8280
## Setup
83-
**FIXME** Please add any special setup instructions for your project to help the developer
84-
become productive quickly.
85-
86-
## Testing
87-
**FIXME** Please provide information that helps the developer test any changes they make
88-
before submitting.
8981

90-
## Coding style guidelines
91-
**FIXME** Optional, but recommended: please share any specific style guidelines you might
92-
have for your project.
93-
-->
82+
1. **Clone the repository and install dependencies:**
83+
```shell
84+
git clone https://github.com/instana/python-sensor.git
85+
cd python-sensor
86+
pip install -e ".[dev]"
87+
```
88+
89+
This installs the package in editable mode with development dependencies
90+
(pytest, ruff, pre-commit, etc.)
91+
92+
2. **Set up pre-commit hooks:**
93+
```shell
94+
pre-commit install
95+
```
96+
97+
This automatically runs Ruff linter and formatter before each commit.
98+
99+
## Testing and Code Quality
100+
101+
Before submitting a pull request:
102+
103+
1. **Run tests:**
104+
```shell
105+
pytest
106+
```
107+
108+
2. **Check code style:**
109+
```shell
110+
ruff check ./src ./tests ./tests_autowrapt ./tests_aws
111+
```
112+
113+
Or run all pre-commit checks:
114+
```shell
115+
pre-commit run --all-files
116+
```
117+
118+
**Note:** All pull requests to `main` must pass GitHub Actions checks (Ruff
119+
linter + test suite).
120+
121+
## Coding Style
122+
123+
- Python 3.9+ compatible code
124+
- Follow PEP 8 style guidelines (enforced by Ruff)
125+
- Include copyright headers in new files (see [Legal](#legal) section)
126+
- Use type hints where appropriate
127+
- Ruff automatically formats code on commit via pre-commit hooks
128+
129+
Configuration is defined in [`pyproject.toml`](pyproject.toml). For advanced
130+
Ruff usage, see [Ruff documentation](https://docs.astral.sh/ruff/).
94131

95132
<!-- Reference links -->
96133

@@ -99,3 +136,4 @@ have for your project.
99136
[raise an issue]: https://github.com/instana/python-sensor/issues "Raise an issue"
100137
[Developer's Certificate of Origin 1.1 (DCO)]: https://github.com/hyperledger/fabric/blob/master/docs/source/DCO1.1.txt "DCO1.1"
101138
[Linux® Kernel community]: https://elinux.org/Developer_Certificate_Of_Origin "Linux Kernel DCO"
139+
[Ruff Documentation]: https://docs.astral.sh/ruff/ "Ruff Documentation"

0 commit comments

Comments
 (0)