Skip to content

Commit

Permalink
Merge branch 'release/0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pmbarrett314 committed Sep 5, 2024
2 parents 2ca9afb + 91260b5 commit 4920d20
Show file tree
Hide file tree
Showing 24 changed files with 1,098 additions and 1,382 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
131 changes: 81 additions & 50 deletions .github/workflows/lint-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,101 +13,129 @@ jobs:
pre-commit:
name: Various quality checks with pre-commit
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pre-commit/[email protected].0
python-version: ${{ vars.MAIN_PYTHON }}
- uses: pre-commit/[email protected].1
env:
SKIP: "mypy,ruff,black,poetry-lock"
SKIP: "mypy,ruff"
ruff:
name: Lint with ruff
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
version: ${{ vars.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: "/tmp/.uv-cache"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- name: Ruff Lint
run: ruff check .
run: uv run ruff check .
- name: Ruff Format
run: ruff format .
run: uv run ruff format .
mypy:
name: Type check with mypy
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: '3.11'
cache: 'poetry'
- run: poetry install
- run: poetry run mypy .
version: ${{ vars.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: "/tmp/.uv-cache"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- run: uv run mypy .
initial-test:
name: Test One Version First
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: 3.11
cache: 'poetry'
- run: poetry --version
- run: poetry install
- run: poetry run pytest
version: ${{ vars.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: "/tmp/.uv-cache"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- name: Install the project
run: uv sync --all-extras --dev
- run: uv run pytest
name: Run tests
- run: poetry run coverage lcov
- run: uv run coverage lcov
name: Generate coverage report for this run
- name: Upload coverage report for this run to coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
parallel: true
test:
name: Pytest via poetry
name: Pytest via uv
env:
UV_CACHE_DIR: /tmp/.uv-cache
needs:
- pre-commit
- ruff
- mypy
- initial-test
strategy:
matrix:
python-version: ["3.11", "3.10", "3.9", "3.8", "3.12", "pypy3.8", "pypy3.9", "3.13.0-alpha.2"]
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "pypy3.10", "3.13.0-rc.1", "3.14.0-alpha.0"]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: windows-latest
python-version: pypy3.8
- os: windows-latest
python-version: pypy3.9
- os: ubuntu-latest
python-version: 3.11
python-version: ${{ vars.MAIN_PYTHON }}
#we already did this one
continue-on-error: ${{ contains(matrix.python-version,'3.13') || (contains(matrix.python-version, 'pypy') && matrix.os == 'windows-latest') || matrix.python-version == 'pypy3.8'}}
continue-on-error: ${{ contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14') || (contains(matrix.python-version, 'pypy') && matrix.os == 'windows-latest')}}
runs-on: ${{ matrix.os }}
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: "/tmp/.uv-cache"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
if: ${{ ! (contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14')) }}
run: uv python install ${{ matrix.python-version }}
- uses: actions/setup-python@v5
if: ${{ (contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14')) }}
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- run: poetry --version
- run: poetry install --only main,test
- run: poetry run pytest
- name: Install the project
run: uv sync --all-extras --dev
- run: uv run pytest
name: Run tests
- run: poetry run coverage lcov
- run: uv run coverage lcov
name: Generate coverage report for this run
- name: Upload coverage report for this run to coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
Expand All @@ -118,7 +146,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
Expand Down Expand Up @@ -149,12 +177,15 @@ jobs:
- test
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: 3.11
cache: 'poetry'
- run: poetry --version
- run: poetry build
version: ${{ vars.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: "/tmp/.uv-cache"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 15 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
default_language_version:
python: python3.11
python: python3.12
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand Down Expand Up @@ -34,7 +37,7 @@ repos:
- id: ssort
exclude: '^cursesmenu/curses_menu.py$'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.6.4
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -51,26 +54,22 @@ repos:
- id: blacken-docs
additional_dependencies: [black==22.6.0]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies: [types-Deprecated]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.371
rev: v1.1.379
hooks:
- id: pyright
additional_dependencies:
- types-Deprecated
- pytest
- pyte
- pexpect
- importlib-metadata
- deprecated
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.5
hooks:
- id: poetry-check
- id: poetry-lock
- id: uv-lock
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
Expand All @@ -79,3 +78,8 @@ repos:
rev: v0.13.0
hooks:
- id: yamlfmt
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-ini
args: [--autofix]
19 changes: 6 additions & 13 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,9 @@ formats:
build:
os: "ubuntu-22.04"
tools:
python: "3.11"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- poetry install --with docs
post_install:
- pip install "Sphinx<=8.0.0,>=7.0.0"
python: "3.12"
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv run python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs/source $READTHEDOCS_OUTPUT/html
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.9.0
-------------
* Use uv for packaging and building
* Drop Python 3.8
* Remove CursesMenu.append_item

Version 0.8.3
-------------
* Minor fixes
Expand Down
7 changes: 0 additions & 7 deletions cursesmenu/curses_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from collections import defaultdict
from typing import TYPE_CHECKING, Any, cast

from deprecated import deprecated

import cursesmenu.utils
from cursesmenu.item_group import ItemGroup

Expand Down Expand Up @@ -547,11 +545,6 @@ def adjust_screen_size(self) -> None:
self.screen.resize(self.menu_height, max_cols)
self.draw()

@deprecated(reason="Use self.items.append.", version="0.6.0")
def append_item(self, item: MenuItem) -> None:
"""Append an item to the list of items."""
self.items.append(item)

def __repr__(self) -> str:
"""Get a string representation of the menu."""
return f"<{self.title}: {self.subtitle}. {len(self.items)} items>"
11 changes: 3 additions & 8 deletions cursesmenu/item_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@

from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Any, Iterable, cast, overload

if sys.version_info >= (3, 9): # pragma: py-lt-39
from collections.abc import MutableSequence
else: # pragma: py-gte-39
from typing import MutableSequence
from collections.abc import Iterable, MutableSequence
from typing import TYPE_CHECKING, Any, cast, overload

if TYPE_CHECKING:
from typing import Iterator
from collections.abc import Iterator

from cursesmenu.curses_menu import CursesMenu
from cursesmenu.items.menu_item import MenuItem
Expand Down
1 change: 0 additions & 1 deletion docs/source/cursesmenu/CursesMenu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ CursesMenu --- Standard menu class

.. autoclass:: cursesmenu.CursesMenu

.. automethod:: cursesmenu.CursesMenu.append_item

.. raw:: html

Expand Down
4 changes: 2 additions & 2 deletions examples/issues/issue55.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
menu = CursesMenu("Title", "Subtitle")
item1 = MenuItem("这是一个中文菜单项", menu)
item2 = MenuItem("这是第二个中文菜单项", menu)
menu.append_item(item1)
menu.append_item(item2)
menu.items.append(item1)
menu.items.append(item2)
# Create some items
menu.start()
menu.join()
Loading

0 comments on commit 4920d20

Please sign in to comment.