DevelopersPython3Environment » History » Version 21
Dan Smith, 10/16/2024 09:43 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 | |||
16 | ### Install Git |
||
17 | 1. Download and install from [git-scm.org](https://git-scm.com/download/win). During installation take the defaults except for: |
||
18 | 1. Configuring the line ending conversions: choose *Checkout as-is, commit Unix-style line endings* |
||
19 | |||
20 | ### Configure Git |
||
21 | From a command line: |
||
22 | 1. `git config --global user.name "FIRST_NAME LAST_NAME"` |
||
23 | 1. `git config --global user.email "MY_NAME@example.com"` |
||
24 | 7 | Dan Smith | 1. Optional, if you want to set an editor: `git config --global core.editor "PATH TO EDITOR"` |
25 | 1 | Dan Smith | |
26 | 17 | Alexandre J. Raymond | ### Clone the CHIRP git repository (master branch) |
27 | 1 | Dan Smith | From a command line: |
28 | ``` |
||
29 | C:\Users\{user}\Documents> git clone https://github.com/kk7ds/chirp |
||
30 | C:\Users\{user}\Documents> cd chirp |
||
31 | ``` |
||
32 | |||
33 | ### Install the python dependencies |
||
34 | 8 | Tony Fuller | 1. `python3 -m pip install -r requirements.txt` |
35 | 1. `python3 -m pip install tox` |
||
36 | 1 | Dan Smith | |
37 | 17 | Alexandre J. Raymond | ### Run CHIRP |
38 | From inside the chirp git repo, type this to run CHIRP from source: |
||
39 | 15 | Dan Smith | ``` |
40 | chirpwx.py |
||
41 | ``` |
||
42 | 1 | Dan Smith | |
43 | ### Optional, but recommended: Install GitHub CLI |
||
44 | Via winget: `winget install --id GitHub.cli` or manually from [github.com](https://cli.github.com/) |
||
45 | |||
46 | Note: {user} as shown in paths above is the logged in Windows user |
||
47 | Note: The steps above were done on Windows 10 Pro, version 22H2 |
||
48 | 2 | Dan Smith | |
49 | ## MacOS |
||
50 | |||
51 | ### Install command-line tools |
||
52 | ```shell |
||
53 | $ xcode-select --install |
||
54 | ``` |
||
55 | |||
56 | 17 | Alexandre J. Raymond | ### Clone the CHIRP git repository |
57 | 2 | Dan Smith | ```shell |
58 | $ git clone https://github.com/kk7ds/chirp |
||
59 | $ cd chirp |
||
60 | ``` |
||
61 | |||
62 | ### Install python requirements |
||
63 | ```shell |
||
64 | 8 | Tony Fuller | $ python3 -m pip install -r requirements.txt |
65 | $ python3 -m pip install tox |
||
66 | 2 | Dan Smith | ``` |
67 | |||
68 | 17 | Alexandre J. Raymond | (Note that `tox` is only needed for running tests, not for running CHIRP itself) |
69 | 3 | Dan Smith | |
70 | 17 | Alexandre J. Raymond | ### Run CHIRP |
71 | 2 | Dan Smith | ```shell |
72 | $ ./chirpwx.py |
||
73 | ``` |
||
74 | |||
75 | ## Linux |
||
76 | |||
77 | 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. |
||
78 | |||
79 | ### Install packages |
||
80 | |||
81 | ```shell |
||
82 | 20 | Dan Smith | $ sudo apt install git python3-requests python3-serial python3-six python3-suds python3-wxgtk4.0 python3-yattag python3-pip |
83 | 8 | Tony Fuller | $ python3 -m pip install tox |
84 | 1 | Dan Smith | ``` |
85 | 5 | Dan Smith | |
86 | 1 | Dan Smith | (Note that `tox` is only needed for running tests, not for running CHIRP itself) |
87 | 20 | Dan Smith | |
88 | Alternately, and especially if your distro is using managed python, you may want to just create a virtualenv for development. You will still want wxPython from the distro though: |
||
89 | |||
90 | ```shell |
||
91 | $ sudo apt install python3-wxgtk4.0 python3-virtualenv |
||
92 | $ virtualenv --system-site-packages venv |
||
93 | $ source venv/bin/activate |
||
94 | $ pip install -r requirements.txt |
||
95 | 21 | Dan Smith | $ pip install tox |
96 | 20 | Dan Smith | ``` |
97 | 2 | Dan Smith | |
98 | 17 | Alexandre J. Raymond | ### Clone the CHIRP git repository |
99 | 2 | Dan Smith | ``` |
100 | $ git clone https://github.com/kk7ds/chirp |
||
101 | ``` |
||
102 | |||
103 | 17 | Alexandre J. Raymond | ### Run CHIRP |
104 | 2 | Dan Smith | ```shell |
105 | $ cd chirp |
||
106 | $ ./chirpwx.py |
||
107 | ``` |
||
108 | 10 | Dan Smith | |
109 | 12 | Dan Smith | ## Python 3.11 Notes |
110 | |||
111 | 13 | Dan Smith | Python 3.11 breaks a lot of things by removing some compatibility with previous releases. Right now (as of 9-March-2023), the main CHIRP builds are done on <= 3.10 and will continue that way until the wxPython team provides pre-built 3.11 wheels for macOS and Windows. |
112 | 12 | Dan Smith | |
113 | For `attrdict` related issues, see [this github issue](https://github.com/wxWidgets/Phoenix/issues/2296). |
||
114 | |||
115 | 10 | Dan Smith | ## Running tests |
116 | |||
117 | Below are some examples for running tests using tox. This is required to pass the CI checks on submissions before things can be merged. |
||
118 | |||
119 | Running everything: |
||
120 | ``` |
||
121 | $ tox |
||
122 | ``` |
||
123 | |||
124 | Running just style checks: |
||
125 | ``` |
||
126 | $ tox -e style |
||
127 | ``` |
||
128 | |||
129 | Running just driver tests for only drivers with changes since `origin/master`: |
||
130 | ``` |
||
131 | 11 | Dan Smith | $ tox -e fast-driver |
132 | 10 | Dan Smith | ``` |
133 | |||
134 | Running just one driver test by module name: |
||
135 | ``` |
||
136 | 11 | Dan Smith | $ tox -e driver -- -k ic2820 |
137 | 10 | Dan Smith | ``` |
138 | |||
139 | Running all driver tests for a given vendor: |
||
140 | ``` |
||
141 | 11 | Dan Smith | $ tox -e driver -- -k Icom |
142 | 10 | Dan Smith | ``` |