Debian Codegraph @

docs/contributing.rst

raw
1 Contributing
2 ============
3
4 Getting Involved
5 ----------------
6
7 So you'd like to contribute? That's awesome! We would love to have your help,
8 especially in the following ways:
9
10 * Making Pull Requests for code, tests, or docs
11 * Commenting on open issues and pull requests
12 * Suggesting new features
13
14 Setting Up Your Environment
15 ---------------------------
16
17 Fork the repository and clone your fork to your local machine:
18
19 .. code-block:: bash
20
21 git clone https://github.com/yourusername/fastkml.git
22 cd fastkml
23 git checkout develop
24
25 Next, set up a virtual environment. This helps to manage dependencies and avoid conflicts:
26
27 .. code-block:: bash
28
29 python3 -m venv .venv
30 source venv/bin/activate # On Windows use `venv\Scripts\activate`
31
32 Then, install the required packages:
33
34 .. code-block:: bash
35
36 pip install -e ".[dev]"
37
38 Install the ``pre-commit`` hook with:
39
40 .. code-block:: bash
41
42 pre-commit install
43
44 and check the code with:
45
46 .. code-block:: bash
47
48 pre-commit run --all-files
49
50 Running the Tests
51 -----------------
52
53 To run the tests, simply use:
54
55 .. code-block:: bash
56
57 pytest
58
59 You can also run the tests with `coverage <https://coverage.readthedocs.io/>`_
60 to see which lines are covered by the tests.
61 This is useful for writing new tests to cover any uncovered lines:
62
63 .. code-block:: bash
64
65 pytest --cov=fastkml --cov-report=term
66
67 To get a report on the individual lines that are not covered, use the
68 ``--cov-report=term-missing`` option, or generate an HTML report with
69 ``--cov-report=html``.
70 Some editor extensions can also show the coverage directly in the editor, notably
71 `coverage-gutter <https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters>`_
72 for VSCode, which needs the output to be in the ``xml`` format produced with
73 ``--cov-report=xml``.
74
75 Building the Documentation
76 -------------------------
77
78 To build and preview the documentation locally:
79
80 1. **Install documentation dependencies** (if not already installed):
81
82 .. code-block:: bash
83
84 pip install -r docs/requirements.txt
85
86 2. **Build the HTML documentation**:
87
88 .. code-block:: bash
89
90 cd docs
91 make html
92
93 The generated HTML files will be in `docs/_build/html`. Open `index.html` in your browser to preview.
94
95 If you encounter issues, ensure you have Sphinx and the required extensions installed, and that your virtual environment is activated.
96
97 Submitting Changes
98 ------------------
99
100 Once you've made your changes and ensured that all tests pass, you can submit a pull request.
101
102 Tips:
103
104 * Write clear and concise commit messages.
105 * Follow the existing code style and conventions.
106 * Reference any related issues in your pull request description.
107 * Ensure your changes are well-tested.
108 * Commit to the ``develop`` branch, not ``main``.
109 * Avoid large, monolithic pull requests; smaller, focused PRs are easier to review.
110 * Commit often with logical chunks of work.
111 * Open a draft pull request early to get feedback.
112 * Be patient and responsive to feedback on your pull request.
113 * Celebrate your contribution to the project! Add a line to the ``HISTORY.rst`` file
114 in the "unreleased" section, following the existing format.
115
116 We appreciate your contributions and look forward to collaborating with you!