Skip to content

TYP: Inline typing annotations #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
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
34 changes: 34 additions & 0 deletions .github/workflows/type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Type-check

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
type-check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"

- name: env setup
run: |
uv venv .venv
source .venv/bin/activate
uv pip install . numpy mypy

- name: run mypy
run: mypy --no-incremental --cache-dir=/dev/null .

- name: run pyright
uses: jakebailey/pyright-action@v2
16 changes: 16 additions & 0 deletions numpy_financial/_cfinancial.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import TypeAlias

import numpy as np
import numpy.typing as npt

_ArrayF64: TypeAlias = npt.NDArray[np.float64]

def nper(
rates: _ArrayF64,
pmts: _ArrayF64,
pvs: _ArrayF64,
fvs: _ArrayF64,
whens: _ArrayF64,
out: _ArrayF64,
) -> None: ...
def npv(rates: _ArrayF64, values: _ArrayF64, out: _ArrayF64) -> None: ...
Loading
Loading