Skip to content

Commit a62695e

Browse files
authored
Merge pull request python-ldap#57 – Doc fixes & contributing guide
python-ldap#57
2 parents 773defa + 909c26b commit a62695e

File tree

10 files changed

+385
-114
lines changed

10 files changed

+385
-114
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
If you found a bug in python-ldap, or would request a new feature,
2+
this is the place to let us know.
3+
4+
Please describe the issue and your environment here.
5+
6+
---
7+
8+
Issue description:
9+
10+
11+
12+
13+
14+
15+
Steps to reproduce:
16+
17+
18+
19+
Operating system:
20+
21+
Python version:
22+
23+
python-ldap version:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ __pycache__/
1717
build/
1818
dist/
1919
PKG-INFO
20+
21+
# generated in the sample workflow
22+
/__venv__/

CONTRIBUTING.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Thank you for your interest in python-ldap!
2+
3+
If you wish to help, detailed instructions are in `Doc/contributing.rst`_,
4+
and in `online documentation`_.
5+
6+
.. _Doc/contributing.rst: Doc/contributing.rst
7+
.. _online documentation: http://python-ldap.readthedocs.io/en/latest/contributing.html
8+
9+
10+
Open-source veretans should find no surprises there.

Doc/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/_build
1+
/_build/
2+
/.build/

Doc/contributing.rst

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
.. highlight:: console
2+
3+
Contributing to python-ldap
4+
***************************
5+
6+
Thank you for your interest in python-ldap!
7+
If you'd like to contribute (be it code, documentation, maintenance effort,
8+
or anything else), this guide is for you.
9+
10+
11+
Communication
12+
=============
13+
14+
Always keep in mind that python-ldap is developed and maintained by volunteers.
15+
We're happy to share our work, and to work with you to make the library better,
16+
but (until you pay someone), there's obligation to provide assistance.
17+
18+
So, keep it friendly, respectful, and supportive!
19+
20+
21+
Mailing list
22+
------------
23+
24+
Discussion about the use and future of python-ldap occurs in
25+
the ``python-ldap@python.org`` mailing list.
26+
27+
It's also the channel to use if documentation (including this guide) is not
28+
clear to you.
29+
Do try searching around before you ask on the list, though!
30+
31+
You can `subscribe or unsubscribe`_ to this list or browse the `list archive`_.
32+
33+
.. _subscribe or unsubscribe: https://mail.python.org/mailman/listinfo/python-ldap
34+
.. _list archive: https://mail.python.org/pipermail/python-ldap/
35+
36+
37+
Issues
38+
------
39+
40+
Please report bugs, missing features and other issues to `the bug tracker`_
41+
at GitHub. You will need a GitHub account for that.
42+
43+
If you prefer not to open a GitHub account, you're always welcome to use the
44+
mailing list.
45+
46+
47+
Security Contact
48+
----------------
49+
50+
If you found a security issue that should not be discussed publicly,
51+
please e-mail the maintainer at ``pviktori@redhat.com``.
52+
If required, write to coordinate a more secure channel.
53+
54+
All other communication should be public.
55+
56+
57+
Process for Code contributions
58+
==============================
59+
60+
If you're used to open-source Python development with Git, here's the gist:
61+
62+
* ``git clone https://github.com/python-ldap/python-ldap``
63+
* Use GitHub for `the bug tracker`_ and pull requests.
64+
* Run tests with `tox`_; ignore Python interpreters you don't have locally.
65+
66+
.. _the bug tracker: https://github.com/python-ldap/python-ldap/issues
67+
.. _tox: https://tox.readthedocs.io/en/latest/
68+
69+
Or, if you prefer to avoid closed-source services:
70+
71+
* ``git clone https://pagure.io/python-ldap``
72+
* Send bug reports and patches to the mailing list.
73+
* Run tests with `tox`_; ignore Python interpreters you don't have locally.
74+
* Read the documentation directly at `Read the Docs`_.
75+
76+
.. _Read the Docs: http://python-ldap.readthedocs.io/
77+
78+
If you're new to some aspect of the project, you're welcome to use (or adapt)
79+
the workflow below.
80+
81+
82+
Sample workflow
83+
---------------
84+
85+
We assume that, as a user of python-ldap you're not new to software
86+
development in general, so these instructions are terse.
87+
If you need additional detail, please do ask on the mailing list.
88+
89+
.. note::
90+
91+
The following instructions are for Linux.
92+
If you can translate them to another system, please contribute your
93+
translation!
94+
95+
96+
Install `Git`_ and `tox`_.
97+
98+
Clone the repository::
99+
100+
$ git clone https://github.com/python-ldap/python-ldap
101+
$ cd python-ldap
102+
103+
Create a `virtual environment`_ to ensure you in-development python-ldap won't
104+
affect the rest of your system::
105+
106+
$ python3 -m venv __venv__
107+
108+
(For Python 2, install `virtualenv`_ and use it instead of ``python3 -m venv``.)
109+
110+
.. _git: https://git-scm.com/
111+
.. _virtual environment: https://docs.python.org/3/library/venv.html
112+
.. _virtualenv: https://virtualenv.pypa.io/en/stable/
113+
114+
Activate the virtual environment::
115+
116+
$ source __venv__/bin/activate
117+
118+
Install python-ldap to it in `editable mode`_::
119+
120+
(__venv__)$ python -m pip install -e .
121+
122+
This way, importing a Python module from python-ldap will directly
123+
use the code from your source tree.
124+
If you change C code, you will still need to recompile
125+
(using the ``pip install`` command again).
126+
127+
.. _editable mode: https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
128+
129+
Change the code as desired.
130+
131+
132+
To run tests, install and run `tox`_::
133+
134+
(__venv__)$ python -m pip install tox
135+
(__venv__)$ tox --skip-missing-interpreters
136+
137+
This will run tests on all supported versions of Python that you have
138+
installed, skipping the ones you don't.
139+
To run a subset of test environments, run for example::
140+
141+
(__venv__)$ tox -e py27,py36
142+
143+
In addition to ``pyXY`` environments, we have extra environments
144+
for checking things independent of the Python version:
145+
146+
* ``doc`` checks syntax and spelling of the documentation
147+
* ``coverage-report`` generates a test coverage report for Python code.
148+
It must be used last, e.g. ``tox -e py27,py36,coverage-report``.
149+
150+
151+
When your change is ready, commit to Git, and submit a pull request on GitHub.
152+
You can take a look at the `committer instructions`_ to see what we are looking
153+
for in a pull request.
154+
155+
If you don't want to open a GitHub account, please send patches as attachments
156+
to the python-ldap mailing list.
157+
158+
159+
.. _additional tests:
160+
161+
Additional tests and scripts
162+
============================
163+
164+
We use several specialized tools for debugging and maintenance.
165+
166+
Make targets
167+
------------
168+
169+
``make lcov-open``
170+
Generate and view test coverage for C code.
171+
Requires ``make`` and ``lcov``.
172+
173+
``make scan-build``
174+
Run static analysis. Requires ``clang``.
175+
176+
177+
Reference leak tests
178+
--------------------
179+
180+
Reference leak tests require a *pydebug* build of CPython and `pytest`_ with
181+
`pytest-leaks`_ plugin. A *pydebug* build has a global reference counter, which
182+
keeps track of all reference increments and decrements. The leak plugin runs
183+
each test multiple times and checks if the reference count increases.
184+
185+
.. _pytest: https://docs.pytest.org/en/latest/
186+
.. _pytest-leaks: https://pypi.python.org/pypi/pytest-leaks
187+
188+
Download and compile the *pydebug* build::
189+
190+
$ curl -O https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
191+
$ tar xJf Python-3.6.3.tar.xz
192+
$ cd Python-3.6.3
193+
$ ./configure --with-pydebug
194+
$ make
195+
196+
Create a virtual environment with the *pydebug* build::
197+
198+
$ ./python -m venv /tmp/refleak
199+
$ /tmp/refleak/bin/pip install pytest pytest-leaks
200+
201+
Run reference leak tests::
202+
203+
$ cd path/to/python-ldap
204+
$ /tmp/refleak/bin/pip install --upgrade .
205+
$ /tmp/refleak/bin/pytest -v -R: Tests/t_*.py
206+
207+
Run ``/tmp/refleak/bin/pip install --upgrade .`` every time a file outside
208+
of ``Tests/`` is modified.
209+
210+
211+
.. _committer instructions:
212+
213+
Instructions for core committers
214+
================================
215+
216+
If you have the authority (and responsibility) of merging changes from others,
217+
remember:
218+
219+
* All code changes need to be reviewed by someone other than the author.
220+
221+
* Tests must always pass. New features without tests shall *not* pass review.
222+
223+
* Make sure commit messages don't use GitHub-specific link syntax.
224+
Use the full URL, e.g. ``https://github.com/python-ldap/python-ldap/issues/50``
225+
instead of ``#20``.
226+
227+
* Exception: it's fine to use the short form in the summary line of a merge
228+
commit, if the full URL appears later.
229+
* It's OK to use shortcuts in GitHub *discussions*, where they are not
230+
hashed into immutable history.
231+
232+
* Make a merge commit if the contribution contains several well-isolated
233+
separate commits with good descriptions. Use *squash-and-merge* (or
234+
*fast-forward* from a command line) for all other cases.
235+
236+
* It's OK to push small changes into a pull request. If you do this, document
237+
what you have done (so the contributor can learn for the future), and get
238+
their :abbr:`ACK (confirmation)` before merging.
239+
240+
* When squashing, do edit commit messages to add references to the pull request
241+
and relevant discussions/issues, and to conform to Git best practices.
242+
243+
* Consider making the summary line suitable for the CHANGES document,
244+
and starting it with a prefix like ``Lib:`` or ``Tests:``.
245+
246+
* Push to Pagure as well.
247+
248+
If you have good reason to break the “rules”, go ahead and break them,
249+
but mention why.
250+
251+
252+
Instructions for release managers
253+
=================================
254+
255+
If you are tasked with releasing python-ldap, remember to:
256+
257+
* Bump all instances of the version number.
258+
* Go through all changes since last version, and add them to ``CHANGES``.
259+
* Run :ref:`additional tests` as appropriate, fix any regressions.
260+
* Merge all that (using pull requests).
261+
* Run ``python setup.py sdist``, and smoke-test the resulting package
262+
(install in a clean virtual environment, import ``ldap``).
263+
* Create Git tag ``python-ldap-{version}``, and push it to GitHub and Pagure.
264+
* Release the ``sdist`` on PyPI.
265+
* Announce the release on the mailing list.
266+
Mention the Git hash.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy