Debian Codegraph @

CONTRIBUTING.md

raw symbols SCIP
1 # Contributing
2
3 Thank you for taking the interest to contribute! There is always aspects of the library we can improve, so any contributions are welcome!
4
5 ## Our tooling
6
7 If you're only here to find out what programs you need to use when contributing, here is a list:
8
9 ### Python-based
10
11 - [black](https://github.com/psf/black) - Python code formatter
12 - [pylint](https://github.com/PyCQA/pylint) - Python linter
13 - [mypy](https://github.com/python/mypy) - Static type checker
14
15 ### Other
16
17 - [prettier](https://github.com/prettier/prettier) - Formatter for various other formats
18
19 For a more detailed description on why each of these are needed, scroll down to their specific sections.
20
21 ## When should you contribute?
22
23 ### Found an issue you could fix?
24
25 Make sure no one has already started working on it. Once you do start working, it is good to add a comment to the issue to notify others.
26
27 ### No issue raised?
28
29 You don't wanna work hours on code only for it to be thrown out because the maintainers didn't agree with it. To avoid doing so, raise an issue about your ideas.
30
31 ## How should you contribute?
32
33 ### Make sure your contribution has a reason.
34
35 If you aren't fixing a reported issue, start by raising a ticket yourself to make sure your changes are wanted.
36
37 ### Use descriptive, imperative commit messages.
38
39 Commit frequently, with each commit following a single major theme. Commits like `made some changes` will **not** be accepted.
40
41 For your commit message, use a style that describes what it is _going to do_, not what it has already done.
42
43 For example:
44
45 ```bash
46 added a new slider widget # Bad
47 Add a new slider widget # Good!
48 ```
49
50 It is also important to capitalize the first letter of the text, and to not append a period to the end. Standard committing rules (50 character title, empty line separating title from body) apply.
51
52 ### Follow the rest of the guideline below
53
54 We take code style very seriously. Your code should use and apply the tooling describe below, otherwise we cannot accept it.
55
56 ## Formatting
57
58 PyTermGUI uses different formatters to keep the code consistent and improve readability.
59 Here are the formatters you need on your system to contribute to pytermgui:
60
61 | Formatter | Files |
62 | -----------------------------------------------: | :--------------------- |
63 | [prettier](https://github.com/prettier/prettier) | `.md`, `.yml`, `.yaml` |
64 | [black](https://github.com/psf/black) | `.py` |
65
66 ### Installation
67
68 prettier:
69
70 1. Install nodejs and npm (npx comes with it)
71
72 black:
73
74 1. Install python and pip
75 2. Run the following command
76
77 ```bash
78 pip install black
79 ```
80
81 ### Usage
82
83 Run these commands to format your files.
84
85 It is common for developers to configure their IDEs to automatically format files as they are saved. See each tool for instructions on how to do so.
86
87 **WARNING**: These commands will overwrite your files.
88
89 prettier:
90
91 ```bash
92 npx prettier --write .
93 ```
94
95 black:
96
97 ```bash
98 black .
99 ```
100
101 ## Linting
102
103 PyTermGUI uses [pylint](https://github.com/PyCQA/pylint) to ensure any code is up to our standards. Any pushed code will be tested against the program in a GitHub action, and your changes will **not** be merged as long as the score is below 10.0.
104
105 ### Installation
106
107 1. Install python and pip
108 2. Run the following command
109 ```bash
110 pip install pylint
111 ```
112
113 ### Usage
114
115 ```bash
116 pylint pytermgui
117 ```
118
119 ## Typing
120
121 PyTermGUI uses Python's type hint system to improve readability and code stability. For this, we use the [mypy](https://github.com/python/mypy) static type checker. Your code needs to pass mypy with no errors in order to be merged.
122
123 ### Installation
124
125 1. Install python and pip
126 2. Install mypy using the following command
127 ```bash
128 pip install mypy
129 ```
130
131 ### Usage
132
133 ```bash
134 mypy pytermgui
135 ```