Skip to content

addresses #103 #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install requirements
run: |
sudo apt-get update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: '3.7'
- name: Install dependencies
Expand Down
24 changes: 11 additions & 13 deletions circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import os
import os.path
import re
import shlex
import shutil
import subprocess
import sys
Expand All @@ -37,7 +36,11 @@
from circuitpython_build_tools import build
from circuitpython_build_tools import target_versions

import pkg_resources
if sys.version_info < (3, 8):
import importlib_metadata
else:
import importlib.metadata as importlib_metadata

Comment on lines +39 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes. maybe we should start by seeing if we can move relevant github actions workflows to newer python. For instance, the circuitpython bundle uses 3.10 presently: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/.github/workflows/build.yml#L24 and newly cookie-cut libs use 3.11 https://github.com/adafruit/workflows-circuitpython-libs/blob/main/build/action.yml#L11

Copy link
Contributor Author

@2bndy5 2bndy5 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since python v3.7 is deprecated, we could bump the minimum python version to 3.8 and the changes to requirements.txt and corresponding import here would get simplified.

Not sure what the motivation is behind bumping the minimum supported python version. Is it meant to keep the quantity of non-std deps low? Were you hoping for less complex imports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah specifically I was reacting to needing to add this version dependent code. I don't know why the workflows here are at 3.7 while we have 3.10 and 3.11 where it's actually being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if you upgrade the version used in workflows, the pkg supported version is still set to

python_requires='>=3.7',

Again, python 3.7 has reached end-of-life in 2023-06-27 (see PEP537).


BLINKA_LIBRARIES = [
"adafruit-blinka",
Expand Down Expand Up @@ -244,10 +247,10 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d

libs = _find_libraries(os.path.abspath(library_location), library_depth)

pkg = pkg_resources.get_distribution("circuitpython-build-tools")
build_tools_version = "devel"
if pkg:
build_tools_version = pkg.version
try:
build_tools_version = importlib_metadata.version("circuitpython-build-tools")
except importlib_metadata.PackageNotFoundError:
build_tools_version = "devel"

build_tools_fn = "z-build_tools_version-{}.ignore".format(
build_tools_version)
Expand All @@ -267,13 +270,8 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
if "mpy" not in ignore:
os.makedirs("build_deps", exist_ok=True)
for version in target_versions.VERSIONS:
# Use prebuilt mpy-cross on Travis, otherwise build our own.
if "TRAVIS" in os.environ:
mpy_cross = pkg_resources.resource_filename(
target_versions.__name__, "data/mpy-cross-" + version["name"])
else:
mpy_cross = "build_deps/mpy-cross-" + version["name"] + (".exe" * (os.name == "nt"))
build.mpy_cross(mpy_cross, version["tag"])
mpy_cross = "build_deps/mpy-cross-" + version["name"] + (".exe" * (os.name == "nt"))
build.mpy_cross(mpy_cross, version["tag"])
zip_filename = os.path.join(output_directory,
filename_prefix + '-{TAG}-mpy-{VERSION}.zip'.format(
TAG=version["name"],
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ requests
semver
wheel
tomli; python_version < "3.11"
importlib_metadata; python_version < "3.8"