Skip to content

Commit 5bff471

Browse files
authored
Merge pull request #40 from ArcInstitute/setup-ci
Setup ci
2 parents 8492c61 + b637ce7 commit 5bff471

File tree

6 files changed

+135
-7
lines changed

6 files changed

+135
-7
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: "CI"
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
all_jobs:
7+
runs-on: ubuntu-latest
8+
needs: [formatting, type-checking, pytest]
9+
steps:
10+
- name: Complete
11+
run: echo "Complete"
12+
13+
install-job:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: install uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
enable-cache: true
23+
cache-dependency-glob: "pyproject.toml"
24+
25+
- name: install dependencies
26+
run: |
27+
uv sync --all-extras --dev
28+
29+
formatting:
30+
runs-on: ubuntu-latest
31+
32+
needs: [install-job]
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: install uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
enable-cache: true
41+
cache-dependency-glob: "pyproject.toml"
42+
43+
- name: install dependencies
44+
run: |
45+
uv sync --all-extras --dev
46+
47+
- name: run formatting
48+
run: |
49+
uv run ruff format --check
50+
51+
type-checking:
52+
runs-on: ubuntu-latest
53+
54+
needs: [install-job]
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: install uv
60+
uses: astral-sh/setup-uv@v5
61+
with:
62+
enable-cache: true
63+
cache-dependency-glob: "pyproject.toml"
64+
65+
- name: install dependencies
66+
run: |
67+
uv sync --all-extras --dev
68+
69+
- name: run type checking
70+
run: |
71+
uv run ty check
72+
73+
pytest:
74+
runs-on: ubuntu-latest
75+
76+
needs: [install-job]
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: install uv
82+
uses: astral-sh/setup-uv@v5
83+
with:
84+
enable-cache: true
85+
cache-dependency-glob: "pyproject.toml"
86+
87+
- name: install dependencies
88+
run: |
89+
uv sync --all-extras --dev
90+
91+
- name: run pytest
92+
run: |
93+
uv run pytest -v

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
environment: pypi
11+
permissions:
12+
id-token: write # Required for trusted publishing
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v4
19+
with:
20+
version: "latest"
21+
22+
- name: Set up Python
23+
run: uv python install
24+
25+
- name: Install build dependencies
26+
run: uv sync --all-extras
27+
28+
- name: Build the project
29+
run: uv build
30+
31+
- name: Publish to PyPI
32+
run: uv publish

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ dev = [
3636
"marimo>=0.16.5",
3737
"pytest>=8.4.2",
3838
"ruff>=0.12.9",
39+
"ty>=0.0.16",
3940
]

src/pycyto/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def convert(
5656
adata = convert_mtx_to_anndata(
5757
mtx_path, feature_path, barcode_path, dtype="int32" if integer else "float32"
5858
)
59-
adata.write(output, compression="gzip" if compress else None)
59+
adata.write( # type: ignore[misc]
60+
filename=output, compression="gzip" if compress else None
61+
)
6062

6163

6264
@app.command()

src/pycyto/aggregate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def _write_h5ad(
3232
sample: str,
3333
compress: bool = False,
3434
mode: str = "gex",
35-
):
35+
) -> None:
3636
adata.obs_names_make_unique() # always make unique
37-
output_path = os.path.join(sample_outdir, f"{sample}_{mode}.h5ad")
38-
adata.write_h5ad(
39-
output_path,
37+
output_path: str = os.path.join(sample_outdir, f"{sample}_{mode}.h5ad")
38+
adata.write_h5ad( # type: ignore[misc]
39+
filename=output_path,
4040
compression="gzip" if compress else None,
4141
)
4242
logger.debug(

src/pycyto/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def convert_mtx_to_anndata(
5757
feature_path, sep="\t", header=None, index_col=0
5858
).index.astype(str)
5959
features.name = "feature"
60-
adata.obs_names = features # type: ignore
60+
adata.obs_names = features
6161

6262
barcodes = pd.read_csv(
6363
barcode_path, sep="\t", header=None, index_col=0
6464
).index.astype(str)
6565
barcodes.name = "barcode"
66-
adata.var_names = barcodes # type: ignore
66+
adata.var_names = barcodes
6767

6868
# convert to cell x gene
6969
adata = adata.T

0 commit comments

Comments
 (0)