DevelopersPython3Environment » History » Version 11
Dan Smith, 02/15/2023 02:29 AM
1 | 1 | Dan Smith | # Python 3 Developer Environment Setup |
---|---|---|---|
2 | |||
3 | 2 | Dan Smith | {{>toc}} |
4 | |||
5 | 1 | Dan Smith | ## Windows |
6 | |||
7 | ### Install Python |
||
8 | 1. Download and install from [python.org](https://www.python.org/downloads/windows/). At the time of this writing, "Python 3.10.8" is recommended. During install note these options: |
||
9 | 1. Choose *Add python.exe to PATH* |
||
10 | 1. Choose *Disable path length limit* |
||
11 | 1. In Windows settings, search "Manage app execution aliases" and: |
||
12 | 1. Disable *App Installer: python.exe* |
||
13 | 1. Disable *App Installer: python3.exe* |
||
14 | 1. Disable *App Installer: python3.7.exe* |
||
15 | 1. Browse in explorer to `%AppData%\Local\Programs\Python\Python310` and copy `python.exe` to `python3.exe` |
||
16 | |||
17 | ### Install Git |
||
18 | 1. Download and install from [git-scm.org](https://git-scm.com/download/win). During installation take the defaults except for: |
||
19 | 1. Configuring the line ending conversions: choose *Checkout as-is, commit Unix-style line endings* |
||
20 | |||
21 | ### Configure Git |
||
22 | From a command line: |
||
23 | 1. `git config --global user.name "FIRST_NAME LAST_NAME"` |
||
24 | 1. `git config --global user.email "MY_NAME@example.com"` |
||
25 | 7 | Dan Smith | 1. Optional, if you want to set an editor: `git config --global core.editor "PATH TO EDITOR"` |
26 | 1 | Dan Smith | |
27 | 9 | Dan Smith | ### Clone the chirp git repository (master branch) |
28 | 1 | Dan Smith | From a command line: |
29 | ``` |
||
30 | C:\Users\{user}\Documents> git clone https://github.com/kk7ds/chirp |
||
31 | C:\Users\{user}\Documents> cd chirp |
||
32 | ``` |
||
33 | |||
34 | ### Install the python dependencies |
||
35 | 8 | Tony Fuller | 1. `python3 -m pip install -r requirements.txt` |
36 | 1. `python3 -m pip install tox` |
||
37 | 1 | Dan Smith | |
38 | |||
39 | ### Optional, but recommended: Install GitHub CLI |
||
40 | Via winget: `winget install --id GitHub.cli` or manually from [github.com](https://cli.github.com/) |
||
41 | |||
42 | Note: {user} as shown in paths above is the logged in Windows user |
||
43 | Note: The steps above were done on Windows 10 Pro, version 22H2 |
||
44 | 2 | Dan Smith | |
45 | ## MacOS |
||
46 | |||
47 | ### Install command-line tools |
||
48 | ```shell |
||
49 | $ xcode-select --install |
||
50 | ``` |
||
51 | |||
52 | ### Clone the chirp git repository |
||
53 | ```shell |
||
54 | $ git clone https://github.com/kk7ds/chirp |
||
55 | $ cd chirp |
||
56 | ``` |
||
57 | |||
58 | ### Install python requirements |
||
59 | ```shell |
||
60 | 8 | Tony Fuller | $ python3 -m pip install -r requirements.txt |
61 | $ python3 -m pip install tox |
||
62 | 2 | Dan Smith | ``` |
63 | |||
64 | 6 | Dan Smith | (Note that `tox` is only needed for running tests, not for running chirp itself) |
65 | 3 | Dan Smith | |
66 | 2 | Dan Smith | ### Run chirp |
67 | ```shell |
||
68 | $ ./chirpwx.py |
||
69 | ``` |
||
70 | |||
71 | ## Linux |
||
72 | |||
73 | These instructions are for Debian/Ubuntu, but should be generally applicable to other distros, possibly with different package names. You can use all distro packages (recommended), or install the python requirements with `pip install -r requirements.txt` but you probably want to get wxPython from distro packages. |
||
74 | |||
75 | ### Install packages |
||
76 | |||
77 | ```shell |
||
78 | 5 | Dan Smith | $ sudo apt install git python3-wxgtk4.0 python3-serial python3-six python3-future python3-requests python3-pip |
79 | 8 | Tony Fuller | $ python3 -m pip install tox |
80 | 1 | Dan Smith | ``` |
81 | 5 | Dan Smith | |
82 | (Note that `tox` is only needed for running tests, not for running chirp itself) |
||
83 | 2 | Dan Smith | |
84 | ### Clone the chirp git repository |
||
85 | ``` |
||
86 | $ git clone https://github.com/kk7ds/chirp |
||
87 | ``` |
||
88 | |||
89 | ### Run chirp |
||
90 | ```shell |
||
91 | $ cd chirp |
||
92 | $ ./chirpwx.py |
||
93 | ``` |
||
94 | 10 | Dan Smith | |
95 | ## Running tests |
||
96 | |||
97 | Below are some examples for running tests using tox. This is required to pass the CI checks on submissions before things can be merged. |
||
98 | |||
99 | Running everything: |
||
100 | ``` |
||
101 | $ tox |
||
102 | ``` |
||
103 | |||
104 | Running just style checks: |
||
105 | ``` |
||
106 | $ tox -e style |
||
107 | ``` |
||
108 | |||
109 | Running just driver tests for only drivers with changes since `origin/master`: |
||
110 | ``` |
||
111 | 11 | Dan Smith | $ tox -e fast-driver |
112 | 10 | Dan Smith | ``` |
113 | |||
114 | Running just one driver test by module name: |
||
115 | ``` |
||
116 | 11 | Dan Smith | $ tox -e driver -- -k ic2820 |
117 | 10 | Dan Smith | ``` |
118 | |||
119 | Running all driver tests for a given vendor: |
||
120 | ``` |
||
121 | 11 | Dan Smith | $ tox -e driver -- -k Icom |
122 | 10 | Dan Smith | ``` |