Skip to content

Commit

Permalink
Use override from typing_extensions
Browse files Browse the repository at this point in the history
Instead of a having a custom implementation, use the `override` implementation
from the `typing_extensions` module which properly handles Python versions
before 3.12 which don't yet include support for `typing.override`.

Add latest `typing-extensions` to `requirements.txt`.

Instead of using `/usr/bin/python` runline from each Python file, use `python`
or `python3` runner which will pick up the earliest appearing Python binary
which we also previously used when we installed `typing-extensions` module via
`python -m pip install`. On GitHub Actions, this is not `/usr/bin/python`, so if
we install using the default Python, then `/usr/bin/python` will complain of a
missing package.

This only appears to fail on Ubuntu 22.04, but was still annoying to track down.
  • Loading branch information
mbrukman committed Nov 22, 2024
1 parent e729187 commit 86d047a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jobs:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Install general Python deps
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run tests
run: make test VERBOSE=1

Expand Down
2 changes: 1 addition & 1 deletion csv2txf_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fi
declare -i num_failures=0

# macOS 12+ doesn't provide /usr/bin/python, but provides /usr/bin/python3
PYTHON=""
PYTHON="python"
if ! [[ -f "/usr/bin/python" ]] && [[ -f "/usr/bin/python3" ]]; then
PYTHON="python3"
fi
Expand Down
33 changes: 0 additions & 33 deletions decorators.py

This file was deleted.

2 changes: 1 addition & 1 deletion interactive_brokers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from typing import Optional

from broker import Broker
from decorators import override
from typing_extensions import override
import utils


Expand Down
9 changes: 1 addition & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
# We don't need any content here, but the absence of this file breaks
# actions/setup-python in GitHub Actions, e.g.,
#
# https://github.com/mbrukman/csv2txf/actions/runs/10437183622/job/28903088310?pr=29
#
# > Error: No file in /Users/runner/work/csv2txf/csv2txf matched to
# > [**/requirements.txt or **/pyproject.toml], make sure you have checked out
# > the target repository
typing-extensions ~= 4.12.2
2 changes: 1 addition & 1 deletion run_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
declare -i success=0

# macOS 12+ doesn't provide /usr/bin/python, but provides /usr/bin/python3
PYTHON=""
PYTHON="python"
if ! [[ -f "/usr/bin/python" ]] && [[ -f "/usr/bin/python3" ]]; then
PYTHON="python3"
fi
Expand Down
2 changes: 1 addition & 1 deletion tdameritrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from typing import Optional

from broker import Broker
from decorators import override
from typing_extensions import override
import utils


Expand Down
2 changes: 1 addition & 1 deletion vanguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from typing import Optional

from broker import Broker
from decorators import override
from typing_extensions import override
import utils


Expand Down

0 comments on commit 86d047a

Please sign in to comment.