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
18 changes: 9 additions & 9 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/ruff-action@v3
- uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0
with:
version: "latest"
args: "check"
src: "./compass"
- uses: astral-sh/ruff-action@v3
- uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0
with:
version: "latest"
args: "format --check"
Expand All @@ -52,7 +52,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand Down Expand Up @@ -141,14 +141,14 @@ jobs:

- name: Set up Python ${{ matrix.python-version }} (with cache)
if: github.ref == 'refs/heads/main'
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Set up Python ${{ matrix.python-version }} (no cache)
if: github.ref != 'refs/heads/main'
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -172,7 +172,7 @@ jobs:
python -m pip install pdftotext

- name: Load tox cache
uses: actions/cache/restore@v5
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .tox/
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-v1-${{ hashFiles('**/pyproject.toml') }}
Expand All @@ -186,7 +186,7 @@ jobs:

- name: Save tox cache only on main
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v5
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .tox/
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-v1-${{ hashFiles('**/pyproject.toml') }}
24 changes: 12 additions & 12 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
# Don't save cache for cargo check!
Expand All @@ -59,15 +59,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
# Don't save cache for cargo fmt or clippy!
Expand All @@ -94,15 +94,15 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
save-if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -127,15 +127,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
save-if: false
Expand All @@ -158,15 +158,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
save-if: false
Expand All @@ -187,15 +187,15 @@ jobs:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
frozen: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: rdev

- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: "gha"
save-if: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand All @@ -44,7 +44,7 @@ jobs:
pixi run -e pdev --locked tests-p

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4
with:
category: "/language:${{matrix.language}}"
7 changes: 4 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Release Documentation

permissions: write-all
permissions:
contents: write

on:
pull_request:
Expand Down Expand Up @@ -34,7 +35,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand All @@ -45,7 +46,7 @@ jobs:
run: pixi run -e pdoc python-docs # This errors on warnings

- name: deploy
uses: peaceiris/[email protected]
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
if: startsWith(github.ref, 'refs/tags/v')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0
fetch-tags: true

- uses: prefix-dev/[email protected]
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.62.2
locked: true
Expand All @@ -32,4 +32,5 @@ jobs:
run: pixi run -e pbuild build-wheels

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.14.0

11 changes: 8 additions & 3 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ on:
- 'c*.*.*'
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: ${{ matrix.target }}
permissions:
contents: write
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -38,7 +43,7 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.6
with:
toolchain: stable
profile: minimal
Expand All @@ -62,7 +67,7 @@ jobs:
fi

- name: Build
uses: actions-rs/cargo@v1
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.6
with:
use-cross: ${{ matrix.use-cross }}
command: build
Expand All @@ -73,7 +78,7 @@ jobs:
run: ${{ matrix.strip }} target/${{ matrix.target }}/release/infra-compass-cli${{ matrix.binary_ext }}

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # v2.11.5
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/infra-compass-cli${{ matrix.binary_ext }}
Expand Down
6 changes: 3 additions & 3 deletions compass/_cli/finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"-c",
required=True,
type=click.Path(exists=True),
help="Path to ordinance configuration JSON or JSON5 file. This file "
help="Path to COMPASS run configuration JSON or JSON5 file. This file "
"should contain any/all the arguments to pass to "
":func:`compass.scripts.process.process_jurisdictions_with_openai`."
"The directory that this config points to will be finalized.",
":func:`compass.scripts.process.process_jurisdictions_with_openai`. "
"The output directory that this config points to will be finalized.",
)
def finalize(config):
"""Finalize a partially-completed COMPASS run"""
Expand Down
8 changes: 6 additions & 2 deletions compass/extraction/water/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def save_structured_data(cls, doc_infos, out_dir):
"""
db = []
for doc_info in doc_infos:
ord_db = pd.read_csv(doc_info["ord_db_fp"])
ord_db = pd.read_csv(doc_info["ord_db_fp"], encoding="utf-8-sig")
if len(ord_db) == 0:
continue

Expand All @@ -265,7 +265,11 @@ def save_structured_data(cls, doc_infos, out_dir):
return 0

db = pd.concat([df.dropna(axis=1, how="all") for df in db], axis=0)
db.to_csv(Path(out_dir) / "water_rights.csv", index=False)
db.to_csv(
Path(out_dir) / "water_rights.csv",
index=False,
encoding="utf-8-sig",
)
return len(db["WCD_ID"].unique())


Expand Down
2 changes: 1 addition & 1 deletion compass/services/threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _write_ord_db(extraction_context, out_dir, out_fn=None):
return None

out_fp = Path(out_dir) / out_fn
ord_db.to_csv(out_fp, index=False)
ord_db.to_csv(out_fp, index=False, encoding="utf-8-sig")
Comment thread
ppinchuk marked this conversation as resolved.
return out_fp


Expand Down
14 changes: 11 additions & 3 deletions compass/utilities/finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def doc_infos_to_db(doc_infos):
if ord_db_fp is None:
continue

ord_db = pd.read_csv(ord_db_fp)
ord_db = pd.read_csv(ord_db_fp, encoding="utf-8-sig")

if num_ordinances_dataframe(ord_db) == 0:
continue
Expand Down Expand Up @@ -217,8 +217,16 @@ def save_db(db, out_dir):
out_dir = Path(out_dir)
qual_db = db[~db["quantitative"]][QUAL_OUT_COLS]
quant_db = db[db["quantitative"]][QUANT_OUT_COLS]
qual_db.to_csv(out_dir / "qualitative_ordinances.csv", index=False)
quant_db.to_csv(out_dir / "quantitative_ordinances.csv", index=False)
qual_db.to_csv(
out_dir / "qualitative_ordinances.csv",
index=False,
encoding="utf-8-sig",
)
quant_db.to_csv(
out_dir / "quantitative_ordinances.csv",
index=False,
encoding="utf-8-sig",
)


def _db_results(results, jurisdiction):
Expand Down
3 changes: 1 addition & 2 deletions docs/source/_cli/cli.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.. _cli-docs:

Command Line Interface (CLI)
==============================
============================

.. toctree::

compass
compass process
5 changes: 0 additions & 5 deletions docs/source/_cli/compass process.rst

This file was deleted.

Loading
Loading