Skip to content

Commit c74c977

Browse files
committed
Enhance PIP dependency declarations // Resolve platformio#4819
1 parent f2d16e7 commit c74c977

File tree

6 files changed

+71
-45
lines changed

6 files changed

+71
-45
lines changed

.github/workflows/deployment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
tox -e testcore
3636
3737
- name: Build Python source tarball
38-
run: python setup.py sdist bdist_wheel
38+
# run: python setup.py sdist bdist_wheel
39+
run: python setup.py sdist
3940

4041
- name: Publish package to PyPI
4142
if: ${{ github.ref == 'refs/heads/master' }}

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
2525
* Drastically enhanced the speed of project building when operating in verbose mode (`issue #4783 <https://github.com/platformio/platformio-core/issues/4783>`_)
2626
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)
2727
* Enhanced the handling of built-in variables in |PIOCONF| during |INTERPOLATION| (`issue #4695 <https://github.com/platformio/platformio-core/issues/4695>`_)
28+
* Enhanced PIP dependency declarations for improved reliability and extended support to include Python 3.6 (`issue #4819 <https://github.com/platformio/platformio-core/issues/4819>`_)
2829
* Implemented a fail-safe mechanism to terminate a debugging session if an unknown CLI option is passed (`issue #4699 <https://github.com/platformio/platformio-core/issues/4699>`_)
2930
* Rectified an issue where ``${platformio.name}`` erroneously represented ``None`` as the default `project name <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/generic/name.html>`__ (`issue #4717 <https://github.com/platformio/platformio-core/issues/4717>`_)
3031
* Resolved an issue where the ``COMPILATIONDB_INCLUDE_TOOLCHAIN`` setting was not correctly applying to private libraries (`issue #4762 <https://github.com/platformio/platformio-core/issues/4762>`_)

platformio/__init__.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,3 @@
5252
"88.198.170.159", # platformio.org
5353
"github.com",
5454
] + __registry_mirror_hosts__
55-
56-
__install_requires__ = [
57-
# Core requirements
58-
"bottle == 0.12.*",
59-
"click >=8.0.4, <=8.2",
60-
"colorama",
61-
"marshmallow == 3.*",
62-
"pyelftools == 0.30",
63-
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
64-
"requests == 2.*",
65-
"semantic_version == 2.10.*",
66-
"tabulate == 0.*",
67-
] + [
68-
# PIO Home requirements
69-
"ajsonrpc == 1.2.*",
70-
"starlette >=0.19, <=0.34",
71-
"uvicorn >=0.16, <=0.25",
72-
"wsproto == 1.*",
73-
]

platformio/commands/upgrade.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
import click
2020

21-
from platformio import VERSION, __install_requires__, __version__, app, exception
21+
from platformio import VERSION, __version__, app, exception
2222
from platformio.http import fetch_remote_content
2323
from platformio.package.manager.core import update_core_packages
24+
from platformio.pipdeps import get_pip_dependencies
2425
from platformio.proc import get_pythonexe_path
2526

2627
PYPI_JSON_URL = "https://pypi.org/pypi/platformio/json"
@@ -37,7 +38,7 @@
3738
@click.option("--verbose", "-v", is_flag=True)
3839
def cli(dev, only_dependencies, verbose):
3940
if only_dependencies:
40-
return upgrade_pypi_dependencies(verbose)
41+
return upgrade_pip_dependencies(verbose)
4142

4243
update_core_packages()
4344

@@ -102,7 +103,7 @@ def cli(dev, only_dependencies, verbose):
102103
return True
103104

104105

105-
def upgrade_pypi_dependencies(verbose):
106+
def upgrade_pip_dependencies(verbose):
106107
subprocess.run(
107108
[
108109
get_pythonexe_path(),
@@ -111,7 +112,7 @@ def upgrade_pypi_dependencies(verbose):
111112
"install",
112113
"--upgrade",
113114
"pip",
114-
*__install_requires__,
115+
*get_pip_dependencies(),
115116
],
116117
check=True,
117118
stdout=subprocess.PIPE if not verbose else None,

platformio/pipdeps.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import platform
16+
import sys
17+
18+
PY36 = sys.version_info[0:2] == (3, 6)
19+
20+
21+
def get_pip_dependencies():
22+
core = [
23+
"bottle == 0.12.*",
24+
"click >=8.0.4, <9",
25+
"colorama",
26+
"marshmallow == 3.*",
27+
"pyelftools == 0.30",
28+
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
29+
"requests == 2.*",
30+
"semantic_version == 2.10.*",
31+
"tabulate == 0.*",
32+
]
33+
34+
home = [
35+
# PIO Home requirements
36+
"ajsonrpc == 1.2.*",
37+
"starlette >=0.19, <0.35",
38+
"uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.26"),
39+
"wsproto == 1.*",
40+
]
41+
42+
extra = []
43+
44+
# issue #4702; Broken "requests/charset_normalizer" on macOS ARM
45+
if platform.system() == "Darwin" and "arm" in platform.machine().lower():
46+
extra.append("chardet>=3.0.2,<6")
47+
48+
# issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+
49+
try:
50+
import ssl # pylint: disable=import-outside-toplevel
51+
52+
if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < (
53+
1,
54+
1,
55+
1,
56+
):
57+
extra.append("urllib3<2")
58+
except ImportError:
59+
pass
60+
61+
return core + home + extra

setup.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import platform
1615
from setuptools import find_packages, setup
1716

1817
from platformio import (
@@ -23,26 +22,8 @@
2322
__title__,
2423
__url__,
2524
__version__,
26-
__install_requires__,
2725
)
28-
29-
# issue #4702; Broken "requests/charset_normalizer" on macOS ARM
30-
if platform.system() == "Darwin" and "arm" in platform.machine().lower():
31-
__install_requires__.append("chardet>=3.0.2,<4")
32-
33-
# issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+
34-
try:
35-
import ssl
36-
37-
if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < (
38-
1,
39-
1,
40-
1,
41-
):
42-
__install_requires__.append("urllib3<2")
43-
except ImportError:
44-
pass
45-
26+
from platformio.pipdeps import get_pip_dependencies
4627

4728
setup(
4829
name=__title__,
@@ -53,7 +34,7 @@
5334
author_email=__email__,
5435
url=__url__,
5536
license=__license__,
56-
install_requires=__install_requires__,
37+
install_requires=get_pip_dependencies(),
5738
python_requires=">=3.6",
5839
packages=find_packages(include=["platformio", "platformio.*"]),
5940
package_data={

0 commit comments

Comments
 (0)