Skip to content

Commit e968e98

Browse files
authored
Update to python 3.10 (#684)
* Upgrade black to remove need for typed-ast * Simplify workflow and install wheel * Upgrade to python 3.10 * Update documentation
1 parent d4678ef commit e968e98

File tree

13 files changed

+35
-27
lines changed

13 files changed

+35
-27
lines changed

.github/actions/setup/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ runs:
6767
sudo chown root:root shellcheck
6868
sudo mv shellcheck "$install_dir"
6969
fi
70+
- name: Setup Python
71+
uses: actions/setup-python@v4
72+
with:
73+
python-version: '3.10'
7074
- name: Cache Python environment
7175
uses: actions/cache@v3
7276
id: cache-python
@@ -80,5 +84,6 @@ runs:
8084
run: |
8185
if [[ "$CACHE_HIT" != 'true' ]]; then
8286
python -m pip install --upgrade pip
87+
pip install wheel
8388
pip install -r requirements.txt
8489
fi

.github/workflows/pr.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ jobs:
88
steps:
99
- name: Checkout the Git repository
1010
uses: actions/checkout@v3
11-
- name: Setup Python
12-
uses: actions/setup-python@v4
13-
with:
14-
python-version: '3.8'
1511
- name: Setup Toltec dependencies
1612
uses: ./.github/actions/setup
1713
- name: Check formatting
@@ -25,10 +21,6 @@ jobs:
2521
steps:
2622
- name: Checkout the Git repository
2723
uses: actions/checkout@v3
28-
- name: Setup Python
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: '3.8'
3224
- name: Setup Toltec dependencies
3325
uses: ./.github/actions/setup
3426
- name: Build packages

.github/workflows/stable.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ jobs:
1010
steps:
1111
- name: Checkout the Git repository
1212
uses: actions/checkout@v3
13-
- name: Setup Python
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: '3.8'
1713
- name: Setup Toltec dependencies
1814
uses: ./.github/actions/setup
1915
- name: Build packages

.github/workflows/testing.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ jobs:
1010
steps:
1111
- name: Checkout the Git repository
1212
uses: actions/checkout@v3
13-
- name: Setup Python
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: '3.8'
1713
- name: Setup Toltec dependencies
1814
uses: ./.github/actions/setup
1915
- name: Build packages

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Before running the build, make sure you have all the required dependencies:
1818

1919
* Docker
2020
* bsdtar
21-
* Python ⩾ 3.8
21+
* Python 3.10
2222

2323
You’ll also need all the Python modules listed in [requirements.txt](../requirements.txt) (install them by running `pip install --user -r requirements.txt` or using a [virtual environment](https://docs.python.org/3/tutorial/venv.html)).
2424

requirements.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
appdirs==1.4.4
2-
astroid==2.4.2
3-
black==20.8b1
2+
astroid==2.15.4
3+
black==23.3.0
44
certifi==2020.12.5
55
chardet==4.0.0
6-
click==7.1.2
6+
click==8.1.3
77
docker==4.4.1
88
idna==2.10
99
isort==5.7.0
@@ -13,16 +13,15 @@ MarkupSafe==1.1.1
1313
mccabe==0.6.1
1414
mypy==0.790
1515
mypy-extensions==0.4.3
16-
pathspec==0.8.1
16+
pathspec==0.11.1
1717
pyelftools==0.27
18-
pylint==2.6.0
18+
pylint==2.17.4
1919
python-dateutil==2.8.1
2020
regex==2020.11.13
2121
requests==2.25.1
2222
six==1.15.0
2323
toml==0.10.2
24-
typed-ast==1.4.2
25-
typing-extensions==3.7.4.3
24+
typing-extensions==4.5.0
2625
urllib3==1.26.2
2726
websocket-client==0.57.0
2827
wrapt==1.12.1

scripts/toltec/bash.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ def run_script(variables: Variables, script: str) -> LogGenerator:
334334
:returns: generator yielding output lines from the script
335335
:raises ScriptError: if the script exits with a non-zero code
336336
"""
337+
# pylint: disable-next=consider-using-with
337338
process = subprocess.Popen(
338339
["/usr/bin/env", "bash"],
339340
stdin=subprocess.PIPE,

scripts/toltec/builder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def __init__(self, work_dir: str, repo_dir: str) -> None:
9696
self.context: Dict[str, str] = {}
9797
self.adapter = BuildContextAdapter(logger, self.context)
9898

99+
# pylint: disable-next=unspecified-encoding
99100
with open(install_lib_path, "r") as file:
100101
for line in file:
101102
if not line.strip().startswith("#"):
@@ -201,7 +202,7 @@ def _fetch_sources(
201202
)
202203
else:
203204
# Fetch source file from the network
204-
req = requests.get(source.url)
205+
req = requests.get(source.url, timeout=5)
205206

206207
if req.status_code != 200:
207208
raise BuildError(
@@ -215,7 +216,7 @@ def _fetch_sources(
215216

216217
# Verify checksum
217218
file_sha = util.file_sha256(local_path)
218-
if source.checksum != "SKIP" and file_sha != source.checksum:
219+
if source.checksum not in ("SKIP", source.checksum):
219220
raise BuildError(
220221
f"Invalid checksum for source file {source.url}:\n"
221222
f" expected {source.checksum}\n"
@@ -381,6 +382,7 @@ def _postprocessing(self, recipe: Recipe, src_dir: str) -> None:
381382
script = []
382383
mount_src = "/src"
383384

385+
# pylint: disable-next=unnecessary-lambda-assignment
384386
docker_file_path = lambda file_path: shlex.quote(
385387
os.path.join(mount_src, os.path.relpath(file_path, src_dir))
386388
)

scripts/toltec/graphlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def _find_cycle(self) -> Optional[List[_T]]:
225225
seen = set()
226226
node2stacki: MutableMapping[_T, int] = {}
227227

228+
# pylint: disable-next=consider-using-dict-items
228229
for node in n2i:
229230
if node in seen:
230231
continue

scripts/toltec/ipk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _targz_open(fileobj: IO[bytes], epoch: int) -> tarfile.TarFile:
2222
)
2323

2424
try:
25+
# pylint: disable-next=consider-using-with
2526
archive = tarfile.TarFile(
2627
mode="w",
2728
fileobj=gzipobj, # type:ignore

0 commit comments

Comments
 (0)