Skip to content

Commit 60f7cc7

Browse files
committed
cleanup Makefile
1 parent f852ff4 commit 60f7cc7

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

clients/python/Makefile

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ artifacts_dir:
2424
-mkdir --parents $(ARTIFACTS_DIR)
2525

2626

27+
.PHONY: generator-help
28+
generator-help: ## help on client-api generator
29+
# generate help
30+
@docker run --rm $(OPENAPI_GENERATOR_IMAGE) help generate
31+
32+
33+
.PHONY: _postprocess_osparc_client_artifacts
34+
_postprocess_osparc_client_artifacts:
35+
black $(ARTIFACTS_DIR)/client/*.py
36+
@-rm -f $(ARTIFACTS_DIR)/client/README.md
37+
@echo "Please visit our [website](https://itisfoundation.github.io/osparc-simcore-clients/#/) for documentation" > $(ARTIFACTS_DIR)/client/README.md
38+
@-rm -rf $(CLIENTS_PYTHON_DIR)/src/osparc/data/
39+
@-mkdir $(CLIENTS_PYTHON_DIR)/src/osparc/data/
40+
@cp $(REPO_ROOT)/api/openapi.json $(CLIENTS_PYTHON_DIR)/src/osparc/data/
41+
42+
2743
# Generation of Python client
2844
.PHONY: python-client
2945
python-client: VERSION validate-api-specification artifacts_dir ## auto-generate python client
@@ -41,7 +57,7 @@ python-client: VERSION validate-api-specification artifacts_dir ## auto-generate
4157
--additional-properties=packageVersion=$(VERSION),$(subst $(space),$(comma),$(strip $(ADDITIONAL_PROPS))) \
4258
--package-name=osparc_client \
4359
--release-note="Updated to $(VERSION)"
44-
$(MAKE) postprocess-build
60+
$(MAKE) _postprocess_osparc_client_artifacts
4561

4662
.PHONY: python-client-from-templates
4763
python-client-from-templates: VERSION validate-api-specification artifacts_dir ## generate python client using templates in a specified directory (usage: 'make python-client-from-templates -e TEMPLATE_DIR=path/to/templates')
@@ -63,14 +79,11 @@ python-client-from-templates: VERSION validate-api-specification artifacts_dir #
6379
--package-name=osparc_client \
6480
--release-note="Updated to $(VERSION)" \
6581
--template-dir=/tmp/python_templates
66-
$(MAKE) postprocess-build
82+
$(MAKE) _postprocess_osparc_client_artifacts
6783

68-
.PHONY: generator-help
69-
generator-help: ## help on client-api generator
70-
# generate help
71-
@docker run --rm $(OPENAPI_GENERATOR_IMAGE) help generate
7284

73-
## Tools for "postprocessing" generated documentation --------------------------------------------
85+
86+
## DOCUMENTATION --------------------------------------------
7487

7588
ARTIFACTS_DOCS := artifacts/docs
7689

@@ -95,7 +108,7 @@ _check_venv_active:
95108
# checking whether virtual environment was activated
96109
@python3 -c "import sys; assert sys.base_prefix!=sys.prefix"
97110

98-
111+
# (0) Environment ---------------------
99112

100113
.PHONY: .install-dev-reqs
101114
.install-dev-reqs: _check_venv_active
@@ -120,6 +133,7 @@ install-doc: _check_venv_active .install-dev-reqs ## install packages for genera
120133
uv pip install -r $(CLIENTS_PYTHON_DIR)/requirements/doc.txt
121134

122135

136+
# (1) Linters ---------------------
123137

124138
.PHONY: pylint
125139
pylint: _check_venv_active ## runs linter (only to check errors. SEE .pylintrc enabled)
@@ -130,9 +144,10 @@ mypy: $(SCRIPTS_DIR)/mypy.bash $(CLIENTS_PYTHON_DIR)/mypy.ini ## runs mypy pytho
130144
@$(SCRIPTS_DIR)/mypy.bash src/osparc
131145

132146

147+
# (2) Testing ---------------------
133148

134-
.PHONY: test-dev
135-
test-dev: _check_venv_active ## runs tests during development
149+
.PHONY: tests
150+
tests: _check_venv_active ## runs tests during development
136151
# runs tests for development (e.g w/ pdb)
137152
python -m pytest \
138153
-vv \
@@ -142,7 +157,7 @@ test-dev: _check_venv_active ## runs tests during development
142157
--pdb \
143158
$(CLIENTS_PYTHON_DIR)/test/test_osparc
144159

145-
160+
# (3) Packaging -------------------
146161

147162
.PHONY: dist
148163
dist: artifacts_dir ## builds distribution wheel for `osparc_client` and `osparc` packages -> $(ARTIFACTS_DIR)/dist
@@ -162,15 +177,6 @@ dist: artifacts_dir ## builds distribution wheel for `osparc_client` and `osparc
162177

163178

164179

165-
.PHONY: postprocess-build
166-
postprocess-build:
167-
black $(ARTIFACTS_DIR)/client/*.py
168-
@-rm -f $(ARTIFACTS_DIR)/client/README.md
169-
@echo "Please visit our [website](https://itisfoundation.github.io/osparc-simcore-clients/#/) for documentation" > $(ARTIFACTS_DIR)/client/README.md
170-
@-rm -rf $(CLIENTS_PYTHON_DIR)/src/osparc/data/
171-
@-mkdir $(CLIENTS_PYTHON_DIR)/src/osparc/data/
172-
@cp $(REPO_ROOT)/api/openapi.json $(CLIENTS_PYTHON_DIR)/src/osparc/data/
173-
174180

175181
## e2e TEST ---------------------------------------------------------------------------------
176182

clients/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Changes to the client should not be performed within the generated python code,
2020
Tests are located in `PYDIR/test_osparc` and `PYDIR/test_osparc_client`. They can be run by executing the following commands from PYDIR:
2121
```bash
2222
make install-test
23-
make test-dev
23+
make tests
2424
```
2525
after the client has been generated (see the [workflow section](#workflow)). These tests should test the user-facing API. Jupyter notebooks in the PYDIR/docs folder are automatically run as part of the tests via `test_notebooks.py`. Hence, when writing a tutorial jupyter script, also think of it as a test. For this reason, any import of `osparc` in the notebook should be "guarded" by a `if importlib.util.find_spec('osparc') is None:` statement (see the [BasicTutorial](./docs/BasicTutorial.ipynb))
2626

0 commit comments

Comments
 (0)