Skip to content

Commit

Permalink
use packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Verhoog committed Sep 26, 2023
1 parent cc8af27 commit 54509c4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Build wheels
run: |
pip install wheel
pip install wheel packaging
pip wheel --no-deps -w dist .
- uses: actions/upload-artifact@v2
Expand All @@ -47,6 +47,7 @@ jobs:

- name: Build sdist
run: |
pip install packaging
python setup.py sdist
- uses: actions/upload-artifact@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
python-version: '3.11'
- name: Check formatting
run: |
python -m pip install riot==0.18.0
python -m pip install .[test]
riot -v run -s black -- --check .
mypy:
runs-on: ubuntu-latest
Expand All @@ -27,7 +27,7 @@ jobs:
run: pip install .
- name: Run command
run: |
python -m pip install riot==0.18.0
python -m pip install .[test]
riot -v run -s mypy
flake8:
runs-on: ubuntu-latest
Expand All @@ -38,7 +38,7 @@ jobs:
python-version: '3.11'
- name: Run command
run: |
python -m pip install riot==0.18.0
python -m pip install .[test]
riot -v run -s flake8
test:
runs-on: ubuntu-22.04
Expand All @@ -52,4 +52,4 @@ jobs:
-v $PWD:/work/envier \
-w /work/envier \
ghcr.io/datadog/envier/test:3f7d59e9cdb7b31259a3b1202b89fd0df3c2a3bc \
bash -c "riot -v run smoke-test && riot -v run tests"
bash -c "pip install .[test] && riot -v run smoke-test && riot -v run tests"
19 changes: 14 additions & 5 deletions riotfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from packaging.version import Version
from riot import Venv
from riot import latest


with open("tests/.python-version", "r") as f:
SUPPORTED_PYTHON_VERSIONS = [
"%s.%s" % (v[0], v[1])
for v in [v.split(".") for v in sorted(f.read().splitlines())]
"%s.%s" % (v.major, v.minor)
for v in sorted(map(Version, f.read().splitlines()))
]


venv = Venv(
pkgs={"packaging": latest},
venvs=[
Venv(
name="tests",
Expand All @@ -20,10 +21,18 @@
"sphinx": "==5.1.1",
"alabaster": "==0.7.12",
},
pys=[p for p in SUPPORTED_PYTHON_VERSIONS if p >= "3.6"],
pys=[
p
for p in SUPPORTED_PYTHON_VERSIONS
if Version(p) >= Version("3.6")
],
),
Venv(
pys=[p for p in SUPPORTED_PYTHON_VERSIONS if p <= "3.5"],
pys=[
p
for p in SUPPORTED_PYTHON_VERSIONS
if Version(p) <= Version("3.5")
],
),
],
pkgs={"pytest": latest},
Expand Down
24 changes: 17 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from packaging import version
from setuptools import find_packages
from setuptools import setup

Expand All @@ -7,9 +8,13 @@


with open("tests/.python-version", "r") as f:
python_versions = sorted(f.read().splitlines())
python_versions = list(map(version.Version, f.read().splitlines()))

min_python_version = python_versions[0].split(".")

test_deps = [
"packaging",
"riot==0.18.0",
]

setup(
name="envier",
Expand All @@ -21,17 +26,22 @@
"Programming Language :: Python",
]
+ [
"Programming Language :: Python :: %s.%s" % (v[0], v[1])
for v in [v.split(".") for v in python_versions]
"Programming Language :: Python :: %s.%s" % (v.major, v.minor)
for v in sorted(python_versions)
],
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
packages=find_packages(exclude=["tests*"]),
python_requires=">=%s.%s" % (min_python_version[0], min_python_version[1]),
python_requires=">=%s.%s"
% (min(python_versions).major, min(python_versions).minor),
install_requires=["typing; python_version<'3.5'"],
extras_require={"mypy": ["mypy"]},
setup_requires=["setuptools_scm"],
extras_require={
"mypy": ["mypy"],
"test": test_deps,
},
setup_requires=["setuptools_scm", "packaging"],
tests_require=test_deps,
use_scm_version=True,
# Required for mypy compatibility, see
# https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages
Expand Down

0 comments on commit 54509c4

Please sign in to comment.