Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .github/workflows/dependency-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Dependency Audit

on:
workflow_dispatch:
schedule:
- cron: "0 10 * * 1"

permissions:
contents: read

jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python 3.12
run: uv python install 3.12

- name: Export locked dependencies
run: >-
uv export --frozen --format requirements-txt --all-groups
--no-emit-project --no-hashes -o requirements-audit.txt

- name: Run dependency audit
run: uvx pip-audit --requirement requirements-audit.txt
29 changes: 29 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Integration Tests

on:
workflow_dispatch:
schedule:
- cron: "0 9 * * 1"

permissions:
contents: read

jobs:
integration:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python 3.12
run: uv python install 3.12

- name: Install dependencies
run: uv sync --frozen --group test

- name: Run integration tests
run: uv run pytest -m integration
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: uv python install 3.10

- name: Install dependencies
run: uv sync --group dev
run: uv sync --frozen --group dev

- name: Check formatting
run: uv run ruff format --check bcb/ tests/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: uv python install 3.10

- name: Install dependencies
run: uv sync --group docs
run: uv sync --frozen --group docs

- name: Build docs
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --group test --group dev
run: uv sync --frozen --group test --group dev

- name: Run tests
run: uv run pytest --cov=bcb --cov-report=xml -m "not integration"
Expand Down
6 changes: 3 additions & 3 deletions bcb/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _get_symbol(
df1 = df.set_index("Date")
n = ["bid", "ask"]
df1 = df1[n]
tuples = list(zip([symbol] * len(n), n))
tuples = list(zip([symbol] * len(n), n, strict=True))
df1.columns = pd.MultiIndex.from_tuples(tuples)
return df1

Expand Down Expand Up @@ -867,7 +867,7 @@ async def _async_get_symbol(
df1 = df.set_index("Date")
n = ["bid", "ask"]
df1 = df1[n]
tuples = list(zip([symbol] * len(n), n))
tuples = list(zip([symbol] * len(n), n, strict=True))
df1.columns = pd.MultiIndex.from_tuples(tuples)
return df1

Expand Down Expand Up @@ -927,7 +927,7 @@ async def async_get(
*[_async_get_symbol_text(symbol, start, end) for symbol in symbols],
return_exceptions=True,
)
for symbol, text in zip(symbols, texts):
for symbol, text in zip(symbols, texts, strict=True):
if isinstance(text, CurrencyNotFoundError):
continue
if isinstance(text, BaseException):
Expand Down
7 changes: 5 additions & 2 deletions bcb/sgs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,17 @@ async def async_get(
)

if output == "text":
results: Dict[int, str] = {c.value: t for c, t in zip(code_list, texts)}
results: Dict[int, str] = {
c.value: t for c, t in zip(code_list, texts, strict=True)
}
values = list(results.values())
if len(values) == 1:
return values[0]
return results

dfs = [
_format_df(pd.read_json(StringIO(t)), c, freq) for c, t in zip(code_list, texts)
_format_df(pd.read_json(StringIO(t)), c, freq)
for c, t in zip(code_list, texts, strict=True)
]
if len(dfs) == 1:
return dfs[0]
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ omit = ["tests/*"]

[tool.coverage.report]
show_missing = true
fail_under = 75
fail_under = 80

[tool.mypy]
python_version = "3.10"
Expand All @@ -66,7 +66,7 @@ line-length = 88
target-version = "py310"

[tool.ruff.lint]
select = ["E", "W", "F"]
select = ["E", "W", "F", "B904", "B905", "RUF100"]
ignore = ["E501"]

[tool.ruff.lint.per-file-ignores]
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def make_currency_list_csv(

header = "Codigo;Nome;Simbolo;CodPais;NomePais;Tipo;DataExclusao\n"
rows = []
for symbol, code in zip(symbols, codes):
for symbol, code in zip(symbols, codes, strict=True):
rows.append(f"{code};{symbol.upper()} CURRENCY;{symbol};999;COUNTRY;A;\n")
return header + "".join(rows)

Expand Down
506 changes: 249 additions & 257 deletions uv.lock

Large diffs are not rendered by default.

Loading