Skip to content

Commit fa88841

Browse files
authored
Merge pull request #92 from Point72/tkp/hm
Add client deps to default installation, add tests, swap yml for yaml
2 parents 58fc2e8 + 589e8b9 commit fa88841

File tree

8 files changed

+188
-123
lines changed

8 files changed

+188
-123
lines changed

.github/workflows/build.yaml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
paths-ignore:
10+
- LICENSE
11+
- README.md
12+
pull_request:
13+
branches:
14+
- main
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
permissions:
22+
contents: read
23+
checks: write
24+
pull-requests: write
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up Python
34+
uses: actions-ext/python/setup@main
35+
with:
36+
version: 3.11
37+
38+
- name: Set up NodeJS
39+
uses: actions-ext/node/setup@main
40+
41+
- name: Install dependencies
42+
run: make develop
43+
44+
- name: Lint
45+
run: make lint
46+
47+
- name: Checks
48+
run: make checks
49+
50+
- name: Build
51+
run: make build
52+
53+
- name: Make dist
54+
run: make dist
55+
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: dist
59+
path: dist
60+
61+
test:
62+
runs-on: ${{ matrix.os }}
63+
needs: build
64+
strategy:
65+
matrix:
66+
os: [ubuntu-latest, macos-latest]
67+
python-version: ["3.9", "3.10", "3.11"]
68+
exclude:
69+
# No CSP builds for python 3.9 / macos arm64
70+
- python-version: "3.9"
71+
os: macos-latest
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Set up Python
77+
uses: actions-ext/python/setup@main
78+
with:
79+
version: 3.11
80+
81+
- name: Set up NodeJS
82+
uses: actions-ext/node/setup@main
83+
84+
- name: Install JS dependencies
85+
run: make develop-js
86+
87+
- name: Download wheels
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: dist
91+
92+
- name: Install wheels
93+
run: uv pip install `ls csp_gateway-*.whl`[develop]
94+
95+
- name: Test
96+
run: make coverage
97+
98+
- name: Upload test results (Python)
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
102+
path: '**/junit.xml'
103+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
104+
105+
- name: Publish Unit Test Results
106+
uses: EnricoMi/publish-unit-test-result-action@v2
107+
with:
108+
files: '**/junit.xml'
109+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
110+
111+
- name: Upload coverage
112+
uses: codecov/codecov-action@v5
113+
with:
114+
token: ${{ secrets.CODECOV_TOKEN }}
115+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
116+
117+
import:
118+
runs-on: ubuntu-latest
119+
needs: build
120+
strategy:
121+
matrix:
122+
wheel: ["", "client"]
123+
124+
steps:
125+
- uses: actions/checkout@v4
126+
127+
- name: Set up Python
128+
uses: actions-ext/python/setup@main
129+
with:
130+
version: 3.11
131+
132+
- name: Download wheels
133+
uses: actions/download-artifact@v4
134+
with:
135+
name: dist
136+
137+
- name: Install wheels
138+
run: uv pip install `ls csp_gateway_${{ matrix.wheel }}-*.whl`
139+
if: matrix.wheel != ''
140+
141+
- name: Install wheels
142+
run: uv pip install `ls csp_gateway-*.whl`
143+
if: matrix.wheel == ''
144+
145+
- name: Import Client
146+
run: python -c "import csp_gateway.client"
147+
148+
- name: Import Utils
149+
run: |
150+
python -c "import csp_gateway.utils"
151+
python -c "import csp_gateway.utils.enums"
152+
python -c "import csp_gateway.utils.exceptions"
153+
python -c "import csp_gateway.utils.picklable_queue"
154+
python -c "import csp_gateway.utils.web.filter"
155+
python -c "import csp_gateway.utils.web.query"
156+
157+
- name: Import Server
158+
run: python -c "import csp_gateway.server"
159+
if: matrix.wheel != 'client'
160+
161+
- name: Import Utils
162+
run: |
163+
python -c "import csp_gateway.utils"
164+
python -c "import csp_gateway.utils.csp"
165+
python -c "import csp_gateway.utils.fastapi"
166+
python -c "import csp_gateway.utils.id_generator"
167+
python -c "import csp_gateway.utils.struct"
168+
python -c "import csp_gateway.utils.web.controls"
169+
if: matrix.wheel != 'client'

.github/workflows/build.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#########
44
.PHONY: develop-py develop-js develop
55
develop-py:
6-
python -m pip install -e .[develop]
6+
uv pip install -e .[develop]
77

88
develop-js:
99
cd js; pnpm install
@@ -15,19 +15,19 @@ build-py:
1515
python -m build -w -n
1616

1717
build-js:
18-
cd js; pnpm build
18+
cd js; pnpm run build
1919

2020
build: build-js build-py ## build the project
2121

2222
.PHONY: requirements
2323
requirements: ## install prerequisite python build requirements
24-
python -m pip install --upgrade pip toml
25-
python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'`
26-
python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print(" ".join(c["project"]["optional-dependencies"]["develop"]))'`
24+
uv pip install --upgrade pip toml
25+
uv pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'`
26+
uv pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print(" ".join(c["project"]["optional-dependencies"]["develop"]))'`
2727

2828
.PHONY: install
2929
install: ## install python library
30-
python -m pip install .
30+
uv pip install .
3131

3232
#########
3333
# LINTS #
@@ -38,7 +38,7 @@ lint-py: ## run python linter with ruff
3838
python -m ruff format --check csp_gateway examples
3939

4040
lint-js: ## run js linter
41-
cd js; pnpm lint
41+
cd js; pnpm run lint
4242

4343
lint: lint-js lint-py ## run project linters
4444

@@ -51,7 +51,7 @@ fix-py: ## fix python formatting with ruff
5151
python -m ruff format csp_gateway examples
5252

5353
fix-js: ## fix js formatting
54-
cd js; pnpm fix
54+
cd js; pnpm run fix
5555

5656
fix: fix-js fix-py ## run project autoformatters
5757

@@ -86,7 +86,7 @@ coverage-py: ## run python tests and collect test coverage
8686

8787
.PHONY: test-js tests-js coverage-js
8888
test-js: ## run js tests
89-
cd js; pnpm test
89+
cd js; pnpm run test
9090

9191
# alias
9292
tests-js: test-js

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
<br />
99

10-
[![Build Status](https://github.com/Point72/csp-gateway/actions/workflows/build.yml/badge.svg)](https://github.com/Point72/csp-gateway/actions/workflows/build.yml)
10+
[![Build Status](https://github.com/Point72/csp-gateway/actions/workflows/build.yaml/badge.svg)](https://github.com/Point72/csp-gateway/actions/workflows/build.yaml)
11+
[![codecov](https://codecov.io/gh/point72/csp-gateway/branch/main/graph/badge.svg)](https://codecov.io/gh/point72/csp-gateway)
1112
[![License](https://img.shields.io/badge/license-Apache--2.0-green)](https://github.com/Point72/csp-gateway/LICENSE)
1213
[![PyPI](https://img.shields.io/pypi/v/csp-gateway.svg?style=flat)](https://pypi.python.org/pypi/csp-gateway)
1314

csp_gateway/benchmarks/asv.conf.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
// Customizable commands for installing and uninstalling the project.
2525
// See asv.conf.json documentation.
26-
"install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"],
27-
"uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],
26+
"install_command": ["in-dir={env_dir} uv pip install {wheel_file}"],
27+
"uninstall_command": ["return-code=any uv pip uninstall -y {project}"],
2828

2929
// List of branches to benchmark. If not provided, defaults to "main"
3030
// (for git) or "default" (for mercurial).

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling>=1.3.1", "hatch-jupyter-builder", "hatch-multi"]
2+
requires = ["hatchling>=1.3.1", "hatch-jupyter-builder", "hatch-multi>=1"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -30,9 +30,9 @@ develop = [
3030
"asv",
3131
"bump-my-version",
3232
"check-manifest",
33-
"hatchling",
33+
"hatchling>=1.3.1",
3434
"hatch-jupyter-builder",
35-
"hatch-multi",
35+
"hatch-multi>=1",
3636
"mypy",
3737
"pytest",
3838
"pytest-aiohttp",
@@ -174,14 +174,14 @@ skip-if-exists = [
174174
]
175175
dependencies = ["hatch-jupyter-builder>=0.5.0"]
176176

177-
[tool.hatch.metadata.hooks.hatch-multi]
178-
primary = "server"
179-
180177
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
181178
path = "js"
182179
build_cmd = "build"
183180
npm = "pnpm"
184181

182+
[tool.hatch.metadata.hooks.hatch-multi]
183+
primary = ["server", "client"]
184+
185185
[tool.pytest.ini_options]
186186
addopts = ["-vvv", "--junitxml=junit.xml"]
187187
asyncio_mode = "strict"

0 commit comments

Comments
 (0)