Debian Codegraph @

CONTRIBUTING.md

raw symbols SCIP
1 # Contributing Guide
2
3 QtAwesome is part of the Spyder IDE Github org, and is developed with standard Github flow.
4
5 If you're not comfortable with at least the basics of ``git`` and GitHub, we recommend reading beginner tutorials such as [GitHub's Git Guide](https://github.com/git-guides/), its [introduction to basic Git commands](https://guides.github.com/introduction/git-handbook/#basic-git) and its [guide to the fork workflow](https://guides.github.com/activities/forking/), or (if you prefer) their [video equivalents](https://www.youtube.com/githubguides).
6 However, this contributing guide should fill you in on most of the basics you need to know.
7
8 Let us know if you have any further questions, and we look forward to your contributions!
9
10
11 ## Reporting Issues
12
13 Discover a bug?
14 Want a new feature?
15 [Open](https://github.com/spyder-ide/qtawesome/issues/new/choose) an [issue](https://github.com/spyder-ide/qtawesome/issues)!
16 Make sure to describe the bug or feature in detail, with reproducible examples and references if possible, what you are looking to have fixed/added.
17 While we can't promise we'll fix everything you might find, we'll certainly take it into consideration, and typically welcome pull requests to resolve accepted issues.
18
19
20 ## Setting Up a Development Environment
21
22 **Note**: You may need to substitute ``python3`` for ``python`` in the commands below on some Linux distros where ``python`` isn't mapped to ``python3`` (yet).
23
24 ### Fork and clone the repo
25
26 First, navigate to the [project repository](https://github.com/spyder-ide/qtawesome) in your web browser and press the ``Fork`` button to make a personal copy of the repository on your own Github account.
27 Then, click the ``Clone or Download`` button on your repository, copy the link and run the following on the command line to clone the repo:
28
29 ```bash
30 git clone <LINK-TO-YOUR-REPO>
31 ```
32
33 Finally, set the upstream remote to the official QtAwesome repo with:
34
35 ```bash
36 git remote add upstream https://github.com/spyder-ide/qtawesome.git
37 ```
38
39
40 ### Create and activate a fresh environment
41
42 Particularly for development installs, we highly recommend you create and activate a virtual environment to avoid any conflicts with other packages on your system or causing any other issues.
43 Of course, you're free to use any environment management tool of your choice (conda, virtualenvwrapper, pyenv, etc).
44
45 To do so with Conda (recommended), simply execute the following:
46
47 ```bash
48 conda create -c conda-forge -n qtawesome-env python=3.9
49 ```
50
51 And activate it with
52
53 ```bash
54 conda activate qtawesome-env
55 ```
56
57 With pip/venv, you can create a virtual environment with
58
59 ```bash
60 python -m venv qtawesome-env
61 ```
62
63 And activate it with the following on Linux and macOS,
64
65 ```bash
66 source qtawesome-env/bin/activate
67 ```
68
69 or on Windows (cmd),
70
71 ```cmd
72 .\qtawesome-env\Scripts\activate.bat
73 ```
74
75 Regardless of the tool you use, make sure to remember to always activate your environment before using it.
76
77
78 ### Install a Python Qt binding and QtAwesome in editable mode
79
80 Before installing QtAwesome itself, make sure you have the Qt binding(s) you wish to develop against.
81 For example, for PyQt5 on Conda, you'd run with created env activated:
82
83 ```bash
84 conda env update --file requirements/environment.yml
85 ```
86
87 And then install QtAwesome:
88
89 ```bash
90 python -m pip install -e . --no-deps
91 ```
92
93 Or for the same using pip, you'd execute:
94
95 ```bash
96 python -m pip install pyqt5==5.* PyQtWebEngine==5.*
97 ```
98
99 And then install QtAwesome:
100
101 ```bash
102 python -m pip install -e .[test]
103 ```
104
105 You can then import and use QtAwesome as normal.
106 When you make changes in your local copy of the git repository, they will be reflected in your installed copy as soon as you re-run Python.
107
108
109
110 ## Deciding Which Branch to Use
111
112 When you start to work on a new pull request (PR), you need to be sure that your work is done on top of the correct branch, and that you base your PR on Github against it.
113
114 To guide you, issues on Github are marked with a milestone that indicates the correct branch to use:
115
116 * `master` branch: Changes for versions >=`1.x`
117 * `0.x` branch: Maintainance for versions <= `0.x` (currently no work is being done here)
118
119 ## Making Your Changes
120
121 To start working on a new PR, you need to execute these commands, filling in the branch names where appropriate (``<BASE-BRANCH>`` is the branch you're basing your work against, e.g. ``master``, while ``<FEATURE-BRANCH>`` is the branch you'll be creating to store your changes, e.g. ``fix-icon-bug`` or ``add-icon-support``:
122
123 ```bash
124 git checkout <BASE-BRANCH>
125 git pull upstream <BASE-BRANCH>
126 git checkout -b <FEATURE-BRANCH>
127 ```
128
129 Once you've made and tested your changes, commit them with a descriptive, unique message of 74 characters or less written in the imperative tense, with a capitalized first letter and no period at the end.
130 Try to make your commit message understandable on its own, giving the reader a high-level idea of what your changes accomplished without having to dig into the diffs.
131 For example:
132
133 ```bash
134 git commit -am "Fix bug using custom font on Windows"
135 ```
136
137 If your changes are complex (more than a few dozen lines) and can be broken into discrete steps/parts, its often a good idea to make multiple commits as you work.
138 On the other hand, if your changes are fairly small (less than a dozen lines), its usually better to make them as a single commit, and then use the ``git -a --amend`` (followed by ``git push -f``, if you've already pushed your work) if you spot a bug or a reviewer requests a change.
139
140 These aren't hard and fast rules, so just use your best judgment, and if there does happen to be a significant issue we'll be happy to help.
141
142
143 ## Running the Tests
144
145 Once you've made your changes (or ideally, before), you'll want to run the full test suite and write new tests of your own, if you haven't already done so.
146
147 This package uses the [Pytest](https://pytest.org) framework for its unit and integration tests, which are located inside the package alongside the tested code, in the ``tests/`` subdirectory.
148 We **strongly** suggest you run the full test suite before every commit (it should only take a few seconds to run on most machines).
149
150 In general, any new major functionality should come with tests, and we welcome contributing to expand our coverage, increase reliability, and ensure we don't experience any regressions.
151 If you need help writing tests, please let us know, and we'll be happy to guide you.
152
153 To run the tests, install the development dependencies as above, and then simply execute
154
155 ```bash
156 pytest -vv -x
157 ```
158
159
160 ## Pushing your Changes
161
162 Now that your changes are ready to go, you'll need to push them to the appropriate remote.
163 All contributors, including core developers, should push to their personal fork and submit a PR from there, to avoid cluttering the upstream repo with feature branches.
164 To do so, run:
165
166 ```bash
167 git push -u origin <FEATURE-BRANCH>
168 ```
169
170 Where ``<FEATURE-BRANCH>`` is the name of your feature branch, e.g. ``fix-icon-bug``.
171
172
173
174 ## Submitting a Pull Request
175
176 Finally, create a pull request to the [spyder-ide/qtawesome repository](https://github.com/spyder-ide/qtawesome/) on Github.
177 Make sure to set the target branch to the one you based your PR off of (``master`` or ``X.x``).
178
179 We'll then review your changes, and after they're ready to go, your work will become an official part of Qtawesome.
180
181 Thanks for taking the time to read and follow this guide, and we look forward to your contributions!