Skip to content

Commit

Permalink
Support for Python ^3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
joce committed Jan 3, 2024
1 parent 63dbc8d commit e975ddb
Show file tree
Hide file tree
Showing 23 changed files with 153 additions and 48 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"getcrumb",
"guce",
"gucs",
"pytz",
"quotetable",
"referer",
"stockyardapp",
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.7.1"]
steps:
- uses: actions/checkout@v3
Expand All @@ -29,11 +29,9 @@ jobs:
shell: bash
run: poetry install

- name:
Checking imports with isort
# change to python 3.12 when isort supports it
- name: Checking imports with isort
run: |
poetry run isort -c --python-version 3 .
poetry run isort -c --profile black --python-version 3 .
- name: Checking formatting with black
run: |
poetry run black --check .
Expand All @@ -45,7 +43,7 @@ jobs:
poetry run pylint $(git ls-files '*.py')
- name: Analysing typing with pyright
run: |
poetry run pyright --version ${{ matrix.python-version }}
poetry run pyright --pythonversion ${{ matrix.python-version }}
- name: Run pytest
uses: pavelzw/pytest-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ docs/_build/
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
/.venv
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"program": "${workspaceFolder}/src/stockyard.py",
//"console": "integratedTerminal",
"console": "externalTerminal",
"justMyCode": true
"justMyCode": false
}
]
}
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
Expand All @@ -13,5 +12,14 @@
"python.analysis.completeFunctionParens": true,
"python.analysis.diagnosticMode": "workspace",
"python.analysis.importFormat": "relative",
"python.analysis.autoImportCompletions": true
"python.analysis.autoImportCompletions": true,
"todo.embedded.provider": "rg",
"todo.embedded.providers.rg.args": "-S",
"todo.file.name": "*.todo",
"pylint.importStrategy": "fromEnvironment",
"python.globalModuleInstallation": false,
"todo.timekeeping.created.enabled": true,
"python.analysis.inlayHints.pytestParameters": false,
"todo.embedded.providers.rg.regex": "(?:#|// @|//|/\\*+|<!--|--|\\* @|\\{!|\\{\\{!--|\\{\\{!) *(TODO|FIXME|FIX|BUG|UGLY|HACK|IDEA|REVIEW|DEBUG|OPTIMIZE)",
"todo.embedded.regexFlags": "g"
}
48 changes: 30 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.8.1"
pytz = { version = "2023.3", python = "<3.11" }
requests = "^2.23.0"
textual = "^0.40"
tzdata = "^2023.3"
typing_extensions = { version = "^4.9", python = "<3.12" }

[tool.poetry.group.dev.dependencies]
black = "^23.11.0"
Expand All @@ -24,13 +26,16 @@ pyright = "^1.1"
pytest = "^7.4"
pytest-timeout = "^2.2.0"
pytest-md = "^0.2"
textual-dev = "^1.2"

[tool.black]
target-version = ["py312"]
target-version = ["py38", "py39", "py310", "py311", "py312"]
line-length = 88

[tool.isort]
profile = "black"
py_version = "3"
skip = ["__pycache__", ".venv", ".git", ".pytest_cache"]

[tool.pyright]
include = ["src", "tests"]
Expand Down
2 changes: 2 additions & 0 deletions src/appui/_quote_column_definitions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Definitions of the available columns for the quote table."""

from __future__ import annotations

from math import inf
from typing import Final, Optional, TypeVar

Expand Down
12 changes: 11 additions & 1 deletion src/appui/_quote_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
This module contains the QuoteTable class which is a DataTable for displaying quotes.
"""

from __future__ import annotations

import sys
from enum import Enum
from typing import Any, Final, override
from typing import Any, Final

from rich.style import Style
from rich.text import Text
Expand All @@ -17,6 +20,11 @@
from ._quote_table_data import QuoteCell, QuoteColumn, QuoteRow
from .quote_table_state import QuoteTableState

if sys.version_info < (3, 12):
from typing_extensions import override
else:
from typing import override


class QuoteTable(DataTable[Text]):
"""A DataTable for displaying quotes."""
Expand Down Expand Up @@ -354,6 +362,8 @@ def action_order_move_left(self) -> None:

# We need the check here cause hovered_column can go to -1 (which signifies
# the hovered column is inactive)
# TODO Maybe we should just use a different variable for the hovered state
# on/off
if self._state.hovered_column > 0:
self._state.hovered_column -= 1

Expand Down
2 changes: 2 additions & 0 deletions src/appui/_quote_table_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
row and a column in the quote table respectively.
"""

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Callable

Expand Down
2 changes: 2 additions & 0 deletions src/appui/quote_table_state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""The state of the quote table."""

from __future__ import annotations

import logging
from threading import Lock, Thread
from time import monotonic, sleep
Expand Down
10 changes: 9 additions & 1 deletion src/appui/stockyardapp.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""The stockyard application"""

from __future__ import annotations

import json
import logging
import sys
from io import TextIOWrapper
from typing import Any, ClassVar, Optional, override
from typing import Any, ClassVar, Optional

from textual import work
from textual.app import App, ComposeResult
Expand All @@ -20,6 +23,11 @@
from ._quote_table import QuoteTable
from .stockyardapp_state import StockyardAppState

if sys.version_info < (3, 12):
from typing_extensions import override
else:
from typing import override

logging.basicConfig(
level="NOTSET",
handlers=[TextualHandler()],
Expand Down
2 changes: 2 additions & 0 deletions src/appui/stockyardapp_state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""The state of the whole stockyard application."""

from __future__ import annotations

import logging
from typing import Any, Final, Optional

Expand Down
2 changes: 2 additions & 0 deletions src/yfinance/_yclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# pylint: disable=line-too-long

from __future__ import annotations

import json
import logging
from datetime import datetime, timedelta
Expand Down
2 changes: 2 additions & 0 deletions src/yfinance/yfinance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""A Python interface to the Yahoo! Finance API."""

from __future__ import annotations

import logging
from typing import Any, Final

Expand Down
Loading

0 comments on commit e975ddb

Please sign in to comment.