summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml39
-rw-r--r--.github/CODEOWNERS (renamed from CODEOWNERS)12
-rw-r--r--.github/CODE_OF_CONDUCT.md (renamed from CODE_OF_CONDUCT.md)0
-rw-r--r--.github/CONTRIBUTING.md (renamed from CONTRIBUTING.md)3
-rw-r--r--.github/workflows/ci.yml30
-rw-r--r--.github/workflows/doc.yml28
-rw-r--r--.github/workflows/lint.yml28
-rw-r--r--.travis.yml61
-rw-r--r--MANIFEST.in4
-rwxr-xr-xREADME.md3
-rw-r--r--azure-pipelines.yml6
-rw-r--r--cmd2/cmd2.py57
-rw-r--r--noxfile.py4
-rw-r--r--plugins/template/README.md8
-rw-r--r--pyproject.toml2
-rwxr-xr-xtests/test_completion.py2
16 files changed, 141 insertions, 146 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
deleted file mode 100644
index 33f48d91..00000000
--- a/.appveyor.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-# AppVeyor (https://www.appveyor.com) continous integration configuration file for Windows unit tests
-build: off
-
-environment:
- PYTHONUNBUFFERED: 1
- matrix:
- - PYTHON: "C:\\Miniconda36-x64"
- PYTHON_VERSION: "3.6.x"
- PYTHON_ARCH: "64"
- NOXSESSION: "tests-3.6"
-
- - PYTHON: "C:\\Miniconda37-x64"
- PYTHON_VERSION: "3.7.x"
- PYTHON_ARCH: "64"
- NOXSESSION: "tests-3.7"
-
-init:
- - "%PYTHON%/python -V"
- - mkdir C:\Users\appveyor\.conda
- - call %PYTHON%\Scripts\activate.bat
-
-install:
- # Prepend the right Python version to the PATH of this build
- - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
-
- # Check that we have the expected version and architecture for Python
- - "python --version"
- - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
-
- # Update conda stuff to make sure pip, setuptools, wheel etc are up to date
- - "conda update --all -y"
-
- # Install nox
- - "python -m pip install --upgrade nox"
-
-
-
-test_script:
-- "nox --non-interactive --session %NOXSESSION%"
diff --git a/CODEOWNERS b/.github/CODEOWNERS
index 442e08d9..1693b82c 100644
--- a/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,3 +1,12 @@
+# -------------------------------------------------
+# CODEOWNERS - For automated review request for
+# high impact files.
+#
+# Important: The order in this file cascades.
+#
+# https://help.github.com/articles/about-codeowners
+# -------------------------------------------------
+
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# Owners of code are automatically nominated to review PRs involving that code.
@@ -60,7 +69,8 @@ tests/test_transcript.py @kotfu
tests_isolated/test_commandset/* @anselor
# Top-level project stuff
-CONTRIBUTING.md @tleonhardt @kotfu
setup.py @tleonhardt @kotfu
tasks.py @kotfu
+# GitHub stuff
+.github/* @tleonhardt
diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index bdd7a3e3..bdd7a3e3 100644
--- a/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 1175618a..6e5e7b9b 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -458,7 +458,8 @@ how to do it.
7. Creating the PR causes our continuous integration (CI) systems to automatically run all of the
unit tests on all supported OSes and all supported versions of Python. You should watch your PR
- to make sure that all unit tests pass on TravisCI (Linux), AppVeyor (Windows), and VSTS (macOS).
+ to make sure that all unit tests pass on every version of Python for each of Linux, Windows, and
+ macOS.
8. If any unit tests fail, you should look at the details and fix the failures. You can then push
the fix to the same branch in your fork. The PR will automatically get updated and the CI system
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..8f90bdc1
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,30 @@
+# For documentation on GitHub Actions Workflows, see:
+# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+ ci:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ python-version: [3.6, 3.7, 3.8, 3.9]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2 # https://github.com/actions/checkout
+ with:
+ # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
+ # Set fetch-depth: 0 to fetch all history for all branches and tags.
+ fetch-depth: 0 # Needed for setuptools_scm to work correctly
+ - name: Set up Python
+ uses: actions/setup-python@v2 # https://github.com/actions/setup-python
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install python prerequisites
+ run: pip install -U --user pip setuptools setuptools-scm nox
+ - name: Run tests and post coverage results
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: python -m nox --non-interactive --session tests-${{ matrix.python-version }} # Run nox for a single version of Python
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
new file mode 100644
index 00000000..778a8aa4
--- /dev/null
+++ b/.github/workflows/doc.yml
@@ -0,0 +1,28 @@
+# For documentation on GitHub Actions Workflows, see:
+# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
+name: Doc
+
+on: [push, pull_request]
+
+jobs:
+ doc:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ python-version: [3.9]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2 # https://github.com/actions/checkout
+ with:
+ # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
+ # Set fetch-depth: 0 to fetch all history for all branches and tags.
+ fetch-depth: 0 # Needed for setuptools_scm to work correctly
+ - name: Set up Python
+ uses: actions/setup-python@v2 # https://github.com/actions/setup-python
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install python prerequisites
+ run: pip install -U --user pip setuptools setuptools-scm nox
+ - name: Sphinx documentation build
+ run: python -m nox --non-interactive --session docs
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..38ce75a8
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,28 @@
+# For documentation on GitHub Actions Workflows, see:
+# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
+name: Lint
+
+on: [push, pull_request]
+
+jobs:
+ lint:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ python-version: [3.9]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2 # https://github.com/actions/checkout
+ with:
+ # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
+ # Set fetch-depth: 0 to fetch all history for all branches and tags.
+ fetch-depth: 0 # Needed for setuptools_scm to work correctly
+ - name: Set up Python
+ uses: actions/setup-python@v2 # https://github.com/actions/setup-python
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install python prerequisites
+ run: pip install -U --user pip setuptools setuptools-scm flake8
+ - name: Lint
+ run: python -m flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6a9cdac2..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-language: python
-
-matrix:
- include:
- - os: linux
- python: 3.5.2
- env: NOXSESSION=tests-3.5.2
- - os: linux
- python: 3.5.3
- env: NOXSESSION=tests-3.5.3
- - os: linux
- python: 3.5
- env: NOXSESSION=tests-3.5
- - os: linux
- python: 3.6
- env: NOXSESSION=tests-3.6
- - os: linux
- python: 3.7
- dist: xenial
- env: NOXSESSION=tests-3.7
- - os: linux
- python: 3.8
- dist: xenial
- env: NOXSESSION=tests-3.8
- - os: linux
- python: 3.9-dev
- dist: xenial
- env: NOXSESSION=tests-3.9
- - os: linux
- python: 3.7
- env: NOXSESSION=docs
-# # Warning: Don't try to use code coverage analysis with pypy as it is insanely slow
-# - os: linux
-# python: pypy3
-# env: TOXENV=pypy3
-# # Latest Python 3.x from Homebrew
-# - os: osx
-# language: generic
-# env:
-# - TOXENV=py36
-# - BREW_INSTALL=python3
-
-install:
- - if [[ $TRAVIS_PYTHON_VERSION == 3.5.2 ]]; then pip install flake8 nox==2019.11.9; else pip install flake8 nox; fi
-# - |
-# if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
-# if [[ -n "$BREW_INSTALL" ]]; then
-# brew update
-# brew install "$BREW_INSTALL"
-# fi
-# fi
-
-before_script:
- # stop the build if there are Python syntax errors or undefined names
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- if [[ $NOXSESSION == tests-3.8 ]]; then
- flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;
- fi
-
-script:
- - echo "$NOXSESSION"; nox --non-interactive --session "$NOXSESSION"
diff --git a/MANIFEST.in b/MANIFEST.in
index f0b53367..9e12de27 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,6 @@
-include LICENSE README.md CHANGELOG.md CONTRIBUTING.md noxfile.py Pipfile
+include LICENSE README.md CHANGELOG.md noxfile.py Pipfile
recursive-include examples *
recursive-include tests *
recursive-include docs *
recursive-exclude docs/_build *
-exclude .appveyor.yml .gitignore .travis.yml azure-pipelines.yml CODEOWNERS tasks.py
+exclude .github .gitignore azure-pipelines.yml tasks.py
diff --git a/README.md b/README.md
index 946e2d1f..aff3174f 100755
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
cmd2: a tool for building interactive command line apps
=======================================================
[![Latest Version](https://img.shields.io/pypi/v/cmd2.svg?style=flat-square&label=latest%20stable%20version)](https://pypi.python.org/pypi/cmd2/)
-[![Build status](https://img.shields.io/travis/python-cmd2/cmd2.svg?style=flat-square&label=unix%20build)](https://travis-ci.org/python-cmd2/cmd2)
-[![Appveyor build status](https://img.shields.io/appveyor/ci/FedericoCeratto/cmd2.svg?style=flat-square&label=windows%20build)](https://ci.appveyor.com/project/FedericoCeratto/cmd2)
+[![GitHub Actions](https://github.com/python-cmd2/cmd2/workflows/CI/badge.svg)](https://github.com/python-cmd2/cmd2/actions?query=workflow%3ACI)
[![Azure Build status](https://python-cmd2.visualstudio.com/cmd2/_apis/build/status/python-cmd2.cmd2?branch=master)](https://python-cmd2.visualstudio.com/cmd2/_build/latest?definitionId=1&branch=master)
[![codecov](https://codecov.io/gh/python-cmd2/cmd2/branch/master/graph/badge.svg)](https://codecov.io/gh/python-cmd2/cmd2)
[![Documentation Status](https://readthedocs.org/projects/cmd2/badge/?version=latest)](http://cmd2.readthedocs.io/en/latest/?badge=latest)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 5f58bc0d..8e5e170d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -14,9 +14,6 @@ jobs:
# Run the pipeline with multiple Python versions
strategy:
matrix:
- Python35:
- python.version: '3.5'
- NOXSESSION: 'tests-3.5'
Python36:
python.version: '3.6'
NOXSESSION: 'tests-3.6'
@@ -26,6 +23,9 @@ jobs:
Python38:
python.version: '3.8'
NOXSESSION: 'tests-3.8'
+ Python39:
+ python.version: '3.9'
+ NOXSESSION: 'tests-3.9'
# Increase the maxParallel value to simultaneously run the job for all versions in the matrix (max 10 for free open-source)
maxParallel: 4
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 51670235..66b9055f 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -4001,36 +4001,11 @@ class Cmd(cmd.Cmd):
readline.clear_history()
return
- # If an argument was supplied, then retrieve partial contents of the history
- cowardly_refuse_to_run = False
- if args.arg:
- # If a character indicating a slice is present, retrieve
- # a slice of the history
- arg = args.arg
- arg_is_int = False
- try:
- int(arg)
- arg_is_int = True
- except ValueError:
- pass
-
- if '..' in arg or ':' in arg:
- # Get a slice of history
- history = self.history.span(arg, args.all)
- elif arg_is_int:
- history = [self.history.get(arg)]
- elif arg.startswith(r'/') and arg.endswith(r'/'):
- history = self.history.regex_search(arg, args.all)
- else:
- history = self.history.str_search(arg, args.all)
- else:
- # If no arg given, then retrieve the entire history
- cowardly_refuse_to_run = True
- # Get a copy of the history so it doesn't get mutated while we are using it
- history = self.history.span(':', args.all)
+ # If an argument was supplied, then retrieve partial contents of the history, otherwise retrieve it all
+ history = self._get_history(args)
if args.run:
- if cowardly_refuse_to_run:
+ if not args.arg:
self.perror("Cowardly refusing to run all previously entered commands.")
self.perror("If this is what you want to do, specify '1:' as the range of history.")
else:
@@ -4070,6 +4045,32 @@ class Cmd(cmd.Cmd):
for hi in history:
self.poutput(hi.pr(script=args.script, expanded=args.expanded, verbose=args.verbose))
+ def _get_history(self, args: argparse.Namespace) -> List[HistoryItem]:
+ """If an argument was supplied, then retrieve partial contents of the history; otherwise retrieve entire history."""
+ if args.arg:
+ # If a character indicating a slice is present, retrieve a slice of the history
+ arg = args.arg
+ arg_is_int = False
+ try:
+ int(arg)
+ arg_is_int = True
+ except ValueError:
+ pass
+
+ if '..' in arg or ':' in arg:
+ # Get a slice of history
+ history = self.history.span(arg, args.all)
+ elif arg_is_int:
+ history = [self.history.get(arg)]
+ elif arg.startswith(r'/') and arg.endswith(r'/'):
+ history = self.history.regex_search(arg, args.all)
+ else:
+ history = self.history.str_search(arg, args.all)
+ else:
+ # Get a copy of the history so it doesn't get mutated while we are using it
+ history = self.history.span(':', args.all)
+ return history
+
def _initialize_history(self, hist_file):
"""Initialize history using history related attributes
diff --git a/noxfile.py b/noxfile.py
index a46c008e..ce7a287a 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -1,7 +1,7 @@
import nox
-@nox.session(python=['3.7'])
+@nox.session(python=['3.9'])
def docs(session):
session.install('sphinx',
'sphinx-rtd-theme',
@@ -15,7 +15,7 @@ def docs(session):
'-d', '{}/doctrees'.format(tmpdir), '.', '{}/html'.format(tmpdir))
-@nox.session(python=['3.5.2', '3.5.3', '3.5', '3.6', '3.7', '3.8', '3.9'])
+@nox.session(python=['3.6', '3.7', '3.8', '3.9'])
@nox.parametrize('plugin', [None,
'ext_test',
'template',
diff --git a/plugins/template/README.md b/plugins/template/README.md
index 8a423f06..1944f1c7 100644
--- a/plugins/template/README.md
+++ b/plugins/template/README.md
@@ -210,8 +210,8 @@ tiered testing strategy to accomplish this objective.
- [pytest](https://pytest.org) runs the unit tests
- [nox](https://nox.thea.codes/en/stable/) runs the unit tests on multiple versions
of python
-- [AppVeyor](https://www.appveyor.com/) and [TravisCI](https://travis-ci.com)
- run the tests on the various supported platforms
+- [GitHub Actions](https://github.com/features/actions) runs the tests on the various
+ supported platforms
This plugin template is set up to use the same strategy.
@@ -307,9 +307,7 @@ $ nox
### Run unit tests on multiple platforms
-[AppVeyor](https://github.com/marketplace/appveyor) and
-[TravisCI](https://docs.travis-ci.com/user/getting-started/) offer free plans
-for open source projects.
+[GitHub Actions](https://github.com/features/actions) offers free plans for open source projects
## Packaging and Distribution
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000..51000e45
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,2 @@
+[build-system]
+requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
diff --git a/tests/test_completion.py b/tests/test_completion.py
index 0d8f6eb1..d56c035f 100755
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -491,8 +491,6 @@ def test_path_completion_doesnt_match_wildcards(cmd2_app, request):
# Currently path completion doesn't accept wildcards, so will always return empty results
assert cmd2_app.path_complete(text, line, begidx, endidx) == []
-@pytest.mark.skipif(sys.platform == 'win32', reason="getpass.getuser() does not work on Windows in AppVeyor because "
- "no user name environment variables are set")
def test_path_completion_complete_user(cmd2_app):
import getpass
user = getpass.getuser()