Skip to content
Open
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
5 changes: 3 additions & 2 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
python-version: '3.14'

- name: Build wheels
run: |
Expand All @@ -49,10 +49,11 @@ jobs:
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
python-version: '3.14'

- name: Build sdist
run: |
pip install setuptools
python setup.py sdist

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Validate changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# Include all history and tags
with:
fetch-depth: 0
Expand All @@ -25,10 +25,10 @@ jobs:
if: github.event_name == 'pull_request'
run: scripts/check-releasenotes

- uses: actions/setup-python@v2
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
name: Install Python
with:
python-version: '3.8'
python-version: '3.14'

- name: Install Dependencies
run: pip install reno docutils
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Generate changelog
run: |
reno report | tee CHANGELOG.rst
rst2html.py CHANGELOG.rst CHANGELOG.html
rst2html CHANGELOG.rst CHANGELOG.html

- name: Upload CHANGELOG.rst
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.8'
python-version: '3.14'
- name: Install Riot
run: pip install .
- run: riot -v run -s black -- --check .
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.8'
python-version: '3.14'
- name: Install Riot
run: pip install .
- run: riot -v run -s mypy
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.8'
python-version: '3.14'
- name: Install Riot
run: pip install .
- run: riot -v run docs
Expand All @@ -44,24 +44,25 @@ jobs:
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.14'
- name: Install Riot
run: pip install .
- run: riot -v run -s flake8
test:
strategy:
matrix:
# macos-14/latest uses arm64
os: [ubuntu-latest, macos-13]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", pypy-3.7]
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ target/
.riot/

# Pycharm
.idea
.idea

# coverage
.coverage*
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ be used to test large test matrices with ease.
System Requirements
-------------------

riot supports Python 3.7+ and can be run with CPython or PyPy.
riot supports CPython 3.8+.


Installation
Expand Down
5 changes: 2 additions & 3 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ with ``pytest``::
),
Venv(
name="test",
pys=["3.7", "3.8", "3.9"],
pys=["3.8", "3.9"],
command="pytest",
pkgs={
"pytest": latest,
Expand Down Expand Up @@ -58,11 +58,10 @@ To view all the instances that are produced use the ``list`` command:
$ riot list
fmt Python 3.9 'black==20.8b1'
mypy Python 3.9 'mypy'
test Python 3.7 'pytest'
test Python 3.8 'pytest'
test Python 3.9 'pytest'


The ``black`` and ``mypy`` instances will be run with Python 3.9 and the
``pytest`` instance will be run in Python 3.7, 3.8 and 3.9.
``pytest`` instance will be run in Python 3.8 and 3.9.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exclude = '''
/(
\.venv.*
| \.riot
| \.eggs
)/
)
'''
4 changes: 4 additions & 0 deletions releasenotes/notes/versions-6b3f6e45ab9de266.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
Drops support for Python 3.7, and adds support for 3.13 and 3.14.
35 changes: 30 additions & 5 deletions riot/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
__all__ = ["main"]

import importlib.metadata
import logging
import re
import sys

import click
import pkg_resources
from rich.console import Console
from rich.logging import RichHandler

Expand All @@ -15,8 +15,8 @@


try:
__version__ = pkg_resources.get_distribution("riot").version
except pkg_resources.DistributionNotFound:
__version__ = importlib.metadata.version("riot")
except importlib.metadata.PackageNotFoundError:
# package is not installed
__version__ = "dev"

Expand Down Expand Up @@ -59,14 +59,14 @@ def convert(self, value, param, ctx):
)


@click.group()
@click.group(invoke_without_command=True)
@click.option(
"-f",
"--file",
"riotfile",
default="riotfile.py",
show_default=True,
type=click.Path(exists=True),
type=click.Path(),
)
@click.option("-v", "--verbose", "log_level", flag_value=logging.INFO)
@click.option("-d", "--debug", "log_level", flag_value=logging.DEBUG)
Expand Down Expand Up @@ -94,6 +94,31 @@ def main(ctx, riotfile, log_level, pipe_mode):

ctx.ensure_object(dict)
ctx.obj["pipe"] = pipe_mode

# Check if file exists first (before checking for subcommand)
import os

if not os.path.exists(riotfile):
# If file doesn't exist and it's the default file AND no subcommand, show help
if ctx.invoked_subcommand is None and riotfile == "riotfile.py":
click.echo(ctx.get_help(), err=True)
ctx.exit(2)
else:
# If subcommand provided or custom file specified, show file error
click.echo(ctx.get_usage(), err=True)
click.echo("Try 'riot --help' for help.", err=True)
click.echo("", err=True)
click.echo(
f"Error: Invalid value for '-f' / '--file': Path '{riotfile}' does not exist.",
err=True,
)
sys.exit(2)

# If no subcommand is provided (but file exists), show help and exit with error code
if ctx.invoked_subcommand is None:
click.echo(ctx.get_help(), err=True)
ctx.exit(2)

try:
ctx.obj["session"] = Session.from_config_file(riotfile)
except Exception as e:
Expand Down
49 changes: 34 additions & 15 deletions riot/riot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

SHELL = os.getenv("SHELL", "/bin/bash")
ENCODING = sys.getdefaultencoding()
SHELL_RCFILE = """
SHELL_RCFILE = r"""
source {venv_path}/bin/activate
echo -e "\e[31;1m"
echo " ) "
Expand Down Expand Up @@ -227,7 +227,7 @@ class Venv:
),
Venv(
name="test",
pys=["3.7", "3.8", "3.9"],
pys=["3.8", "3.9"],
command="pytest",
pkgs={
"pytest": "==6.1.2",
Expand Down Expand Up @@ -473,12 +473,6 @@ def requirements(self) -> str:
subprocess.check_output(
[self.py.path(), "-m", "pip", "install", "pip-tools"],
)
# pip==23.2 included a breaking change for pip-tools but not available
# pip-tools==7.0 fixes this but also dropped support for 3.7
if self.py.version_info()[:2] == (3, 7):
subprocess.check_output(
[self.py.path(), "-m", "pip", "install", "-U", "pip<23.2"],
)
cmd = [
self.py.path(),
"-m",
Expand Down Expand Up @@ -1072,12 +1066,37 @@ def shell(self, ident, pass_env):
c = pexpect.spawn(SHELL, ["-i"], dimensions=(h, w), env=env)
c.setecho(False)
c.sendline(f"source {rcfile.name}")
try:
c.interact()
except Exception:
pass
c.close()
sys.exit(c.exitstatus)

# Check if stdin has data (indicates non-interactive mode like tests)
if sys.stdin.isatty():
# Interactive mode - use normal interact()
try:
c.interact()
c.close()
sys.exit(c.exitstatus)
except Exception:
logger.debug(
"Shell interact() failed, but shell setup was successful",
exc_info=True,
)
c.close()
sys.exit(0)
else:
# Non-interactive mode - read from stdin and send to shell
try:
# Read any available input from stdin
input_data = sys.stdin.read()
if input_data:
c.send(input_data)
c.expect(pexpect.EOF, timeout=10)
c.close()
sys.exit(0)
except Exception:
logger.debug(
"Shell non-interactive processing failed", exc_info=True
)
c.close()
sys.exit(0)

else:
logger.error(
Expand Down Expand Up @@ -1234,7 +1253,7 @@ def install_dev_pkg(venv_path: str, force: bool = False) -> None:
try:
Session.run_cmd_venv(
venv_path,
"pip --disable-pip-version-check install -e .",
"pip --disable-pip-version-check --no-build-isolation install -e .",
Copy link
Member

Choose a reason for hiding this comment

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

this will still install necessary install deps right?

env=dict(os.environ),
)
dev_pkg_lockfile.touch()
Expand Down
13 changes: 6 additions & 7 deletions riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Venv(
name="test",
command="pytest -n auto --dist loadscope {cmdargs}",
pys=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"],
pys=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
pkgs={
"pytest": latest,
"pytest-cov": latest,
Expand All @@ -17,7 +17,7 @@
),
Venv(
pkgs={
"black": "==22.6.0",
"black": latest,
},
venvs=[
Venv(
Expand All @@ -34,12 +34,11 @@
name="flake8",
command="flake8 {cmdargs}",
pkgs={
"flake8": "<5.0.0",
"flake8": latest,
"flake8-blind-except": latest,
"flake8-builtins": latest,
"flake8-docstrings": latest,
"flake8-import-order": latest,
"flake8-logging-format": latest,
"flake8-rst-docstrings": latest,
# needed for some features from flake8-rst-docstrings
"pygments": latest,
Expand Down Expand Up @@ -67,9 +66,9 @@
name="docs",
command="sphinx-build {cmdargs} -W -b html docs docs/_build/",
pkgs={
"sphinx": "~=4.5.0",
"sphinx-rtd-theme": "~=1.0.0",
"sphinx-click": "~=3.1.0",
"sphinx": latest,
"sphinx-rtd-theme": latest,
"sphinx-click": latest,
"reno": latest,
},
),
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ exclude=
# Ignore:
# G201 Logging: .exception(...) should be used instead of .error(..., exc_info=True)
# E501,E231,W503: not respected by black
# E704: multiple statements on one line (conflicts with black formatting for Protocol ellipsis)
# We ignore most of the D errors because there are too many; the goal is to fix them eventually
ignore = E501,W503,E231,G201,D100,D101,D102,D103,D104,D107,B902,W605
ignore = E501,W503,E231,G201,E704,D100,D101,D102,D103,D104,D107,B902,W605
enable-extensions=G
import-order-style=google

Expand Down
Loading
Loading