|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Bug report |
| 4 | + |
| 5 | +For now [GitHub bug traker](https://github.com/zefr0x/hash_identifier/issues) is used for this project. |
| 6 | + |
| 7 | +We aim to be user friendly, so if you have any issue or suggestion for the [UI](https://en.wikipedia.org/wiki/User_interface_design)/[UX](https://en.wikipedia.org/wiki/User_experience_design) or about the [application packging](<https://en.wikipedia.org/wiki/Package_(package_management_system)>), please tell us, we appreciate it. |
| 8 | + |
| 9 | +## Development |
| 10 | + |
| 11 | +- The 3rd version of the [Python](<https://en.wikipedia.org/wiki/Python_(programming_language)>) programming language is used mainly in this project. |
| 12 | +- Dependencies managment is handled using [requirements files](requirements) with [pip-tools](https://pip-tools.rtfd.io/). |
| 13 | + - `requirements.in` contain requirements for running the application and `requirements-dev.in` contain requirements for development. |
| 14 | + - `.txt` files are locked requirements with hashes generated using `pip-tools` to provide a reproducible environment. |
| 15 | + - For development you will need to use both files, while users just need to use the `requirements.txt` file. |
| 16 | + |
| 17 | +> `pre-commit` will take care about generating `.txt` files. You should just edit `.in` files or use `pip-tools` to upgrade locked requirements. |
| 18 | +
|
| 19 | +### Create a virtual environment and install dependencies |
| 20 | + |
| 21 | +First clone the git repository: |
| 22 | + |
| 23 | +``` |
| 24 | +git clone https://github.com/zefr0x/hash_identifier.git |
| 25 | +``` |
| 26 | + |
| 27 | +For development you are recomended to use [pip-tools](https://pip-tools.rtfd.io/) for reproducing the same environment. |
| 28 | + |
| 29 | +1. Create a virtual environment and activate it |
| 30 | + |
| 31 | +```shell |
| 32 | +virtualenv .env |
| 33 | + |
| 34 | +source .env/bin/activate |
| 35 | +``` |
| 36 | + |
| 37 | +2. Install `pip-tools` in the virtualenv |
| 38 | + |
| 39 | +```shell |
| 40 | +pip install pip-tools |
| 41 | +``` |
| 42 | + |
| 43 | +3. Run the folowing command in the project's root directory to install all the dependencies for development |
| 44 | + |
| 45 | +```shell |
| 46 | +pip-sync requirements/{requirements,requirements-dev}.txt |
| 47 | +``` |
| 48 | + |
| 49 | +4. Then you can run the application as a python module |
| 50 | + |
| 51 | +```shell |
| 52 | +python3 -m hash_identifier |
| 53 | +``` |
| 54 | + |
| 55 | +> You can use the [`justfile`](https://github.com/casey/just) if you want to. |
| 56 | +
|
| 57 | +### Style |
| 58 | + |
| 59 | +- You should [type hint](https://docs.python.org/3/library/typing.html) every thing as possible. |
| 60 | +- You should comment every thing to keep the code easy to read. Every file, every class, every function and any line that need a comment. |
| 61 | + |
| 62 | +You should use: |
| 63 | + |
| 64 | +- [mypy](http://www.mypy-lang.org/) `(Static Type Checker)` |
| 65 | +- [flake8](https://flake8.pycqa.org/) `(Style Enforcer)` |
| 66 | +- [pydocstyle](https://www.pydocstyle.org/) `(Checking compliance with Python docstring conventions)` |
| 67 | +- [black](https://black.readthedocs.io/) `(Code Formatter)` |
| 68 | + |
| 69 | +You can also use any tool that you want as long as it's compatable with the required style. |
| 70 | + |
| 71 | +#### Installing `pre-commit` |
| 72 | + |
| 73 | +To make every thing easy [**`pre-commit`**](https://pre-commit.com/) is used in this project, it should run in every commit, so you shouldn't commit any thing without checking it first. |
| 74 | + |
| 75 | +First install it: |
| 76 | + |
| 77 | +```shell |
| 78 | +pip install pre-commit |
| 79 | +``` |
| 80 | + |
| 81 | +> You can use another way to install it, maybe from your OS's package manager. |
| 82 | +
|
| 83 | +Then add it as a git hook while you are inside the repository: |
| 84 | + |
| 85 | +```shell |
| 86 | +pre-commit install |
| 87 | +``` |
| 88 | + |
| 89 | +## Testing |
| 90 | + |
| 91 | +TODO... |
| 92 | + |
| 93 | +## Translation |
| 94 | + |
| 95 | +The application's GUI is prepared for [internationalisation](https://en.wikipedia.org/wiki/Internationalization_and_localization) using [gettext](https://en.wikipedia.org/wiki/Gettext). |
| 96 | + |
| 97 | +Go to the [`./po`](./po) directory for more details. |
| 98 | + |
| 99 | +### Translating the application name |
| 100 | + |
| 101 | +The name of the application should be changed with respect to the target locale, but it must convey the same meaning. |
0 commit comments