Skip to content

Commit af2a96b

Browse files
committed
Add contributing guidelines
1 parent 454f200 commit af2a96b

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

CONTRIBUTING.md

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# How to contribute
2+
3+
Contributors are essential to Scapy (as they are to most open source
4+
projects). Here is some advice to help you help the project!
5+
6+
## Project objectives
7+
8+
We try to keep Scapy as powerful as possible, to support as many
9+
protocols and platforms as possible, to keep and make the code (and
10+
the commit history) as clean as possible.
11+
12+
Since Scapy can be slow and memory consuming, we try to limit CPU and
13+
memory usage, particularly in parts of the code often called.
14+
15+
## Reporting issues
16+
17+
### Questions
18+
19+
It is OK so submit issues to ask questions (more than OK,
20+
encouraged). There is a label "question" that you can use for that.
21+
22+
### Bugs
23+
24+
If you have installed Scapy through a package manager (from your Linux
25+
or BSD system, from PyPI, etc.), please get and install the current
26+
development code, and check that the bug still exists before
27+
submitting an issue.
28+
29+
Please label your issues "bug".
30+
31+
If you're not sure whether a behavior is a bug or not, submit an issue
32+
and ask, don't be shy!
33+
34+
### Enhancements / feature requests
35+
36+
If you want a feature in Scapy, but cannot implement it yourself or
37+
want some hints on how to do that, open an issue with label
38+
"enhancement".
39+
40+
Explain if possible the API you would like to have (e.g., give examples
41+
of function calls, packet creations, etc.).
42+
43+
## Submitting pull requests
44+
45+
### Coding style & conventions
46+
47+
First, Scapy "legacy" code contains a lot of code that do not comply
48+
with the following recommendations, but we try to comply with the some
49+
guidelines for new code.
50+
51+
- The code should be PEP-8 compliant; you can check your code with
52+
[pep8](https://pypi.python.org/pypi/pep8).
53+
- [Pylint](http://www.pylint.org/) can help you write good Python
54+
code (even if respecting Pylint rules is sometimes either too hard
55+
or even undesirable; human brain needed!).
56+
- [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)
57+
is a nice read!
58+
- Avoid creating unnecessary `list` objects, particularly if they
59+
can be huge (e.g., when possible, use `xrange()` instead of
60+
`range()`, `for line in fdesc` instead of `for line in
61+
fdesc.readlines()`; more generally prefer generators over lists).
62+
63+
### Tests
64+
65+
Please consider adding tests for your new features or that trigger the
66+
bug you are fixing. This will prevent a regression from being
67+
unnoticed.
68+
69+
### New protocols
70+
71+
New protocols can go either in `scapy/layers` or to
72+
`scapy/contrib`. Protocols in `scapy/layers` should be usually found
73+
on common networks, while protocols in `scapy/contrib` should be
74+
uncommon or specific.
75+
76+
### Features
77+
78+
Protocol-related features should be implemented within the same module
79+
as the protocol layers(s) (e.g., `traceroute()` is implemented in
80+
`scapy/layers/inet.py`).
81+
82+
Other features may be implemented in a module (`scapy/modules`) or a
83+
contribution (`scapy/contrib`).
84+
85+
### Core
86+
87+
If you contribute to Scapy's core (e.g., `scapy/base_classes.py`,
88+
`scapy/packet.py`, etc.), please be very careful with performances and
89+
memory footprint, as it is easy to write Python code that wastes
90+
memory or CPU cycles.
91+
92+
As an example, Packet().__init__() is called each time a **layer** is
93+
parsed from a string (during a network capture or a PCAP file
94+
read). Adding inefficient code here will have a disastrous effect on
95+
Scapy's performances.
96+
97+
### Code review
98+
99+
Maintainers tend to be picky, and you might feel frustrated that your
100+
code (which is perfectly working in your use case) is not merged
101+
faster.
102+
103+
Please don't be offended, and keep in mind that maintainers are
104+
concerned about code maintainability and readability, commit history
105+
(we use the history a lot, for example to find regressions or
106+
understand why certain decisions have been made), performances,
107+
integration in Scapy, API consistency (so that someone who knows how
108+
to use Scapy will know how to use your code), etc.
109+
110+
**Thanks for reading, happy hacking!**

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ and
2222
[the quick demo: an interactive session](http://www.secdev.org/projects/scapy/demo.html)
2323
(some examples may be outdated).
2424

25+
# Contributing #
26+
27+
Want to contribute? Great! Please take a few minutes to
28+
[read this](CONTRIBUTING.md)!
29+
2530
# License #
2631

2732
Scapy is free software: you can redistribute it and/or modify it under

0 commit comments

Comments
 (0)