forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2d81c0
commit 968b5ab
Showing
6 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
# erdantic outputs | ||
erd-*.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# Targets for DEVELOPMENT of common Library | ||
# | ||
include ../../scripts/common.Makefile | ||
include ../../scripts/common-package.Makefile | ||
|
||
.PHONY: requirements | ||
requirements: ## compiles pip requirements (.in -> .txt) | ||
@$(MAKE_C) requirements reqs | ||
|
||
|
||
.PHONY: install-dev install-prod install-ci | ||
install-dev install-prod install-ci: _check_venv_active ## install app in development/production or CI mode | ||
# installing in $(subst install-,,$@) mode | ||
@uv pip sync requirements/$(subst install-,,$@).txt | ||
|
||
|
||
.PHONY: tests tests-ci | ||
tests: ## runs unit tests | ||
# running unit tests | ||
@pytest \ | ||
--asyncio-mode=auto \ | ||
--color=yes \ | ||
--cov-config=../../.coveragerc \ | ||
--cov-report=term-missing \ | ||
--cov=common_library \ | ||
--durations=10 \ | ||
--exitfirst \ | ||
--failed-first \ | ||
--pdb \ | ||
-vv \ | ||
$(CURDIR)/tests | ||
|
||
tests-ci: ## runs unit tests [ci-mode] | ||
# running unit tests | ||
@pytest \ | ||
--asyncio-mode=auto \ | ||
--color=yes \ | ||
--cov-append \ | ||
--cov-config=../../.coveragerc \ | ||
--cov-report=term-missing \ | ||
--cov-report=xml \ | ||
--cov=common_library \ | ||
--durations=10 \ | ||
--log-date-format="%Y-%m-%d %H:%M:%S" \ | ||
--log-format="%(asctime)s %(levelname)s %(message)s" \ | ||
--verbose \ | ||
-m "not heavy_load" \ | ||
$(CURDIR)/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# simcore pydantic common library | ||
|
||
## Installation | ||
|
||
```console | ||
make help | ||
make install-dev | ||
``` | ||
|
||
## Test | ||
|
||
```console | ||
make help | ||
make test-dev | ||
``` | ||
|
||
|
||
## Diagnostics | ||
|
||
How run diagnostics on the service metadata published in a docker registry? | ||
|
||
1. Setup environment | ||
```bash | ||
make devenv | ||
source .venv/bin/activate | ||
|
||
cd packages/common-library | ||
make install-dev | ||
``` | ||
2. Set ``REGISTRY_*`` env vars in ``.env`` (in the repository base folder) | ||
3. Download test data, run diagnostics, archive tests-data, and cleanup | ||
```bash | ||
export DEPLOY_NAME=my-deploy | ||
|
||
make pull_test_data >$DEPLOY_NAME-registry-diagnostics.log 2>&1 | ||
pytest -vv -m diagnostics >>$DEPLOY_NAME-registry-diagnostics.log 2>&1 | ||
zip -r $DEPLOY_NAME-registry-test-data.zip tests/data/.downloaded-ignore | ||
rm -r tests/data/.downloaded-ignore | ||
``` | ||
4. Move all ``$DEPLOY_NAME-*`` files to an archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
message = packages/common-library version: {current_version} → {new_version} | ||
tag = False | ||
commit_args = --no-verify | ||
|
||
[bumpversion:file:VERSION] | ||
|
||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[aliases] | ||
test = pytest | ||
|
||
[tool:pytest] | ||
asyncio_mode = auto | ||
markers = | ||
diagnostics: "can be used to run diagnostics against deployed data (e.g. database, registry etc)" | ||
testit: "marks test to run during development" | ||
|
||
[mypy] | ||
plugins = | ||
pydantic.mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import re | ||
import sys | ||
from pathlib import Path | ||
|
||
from setuptools import find_packages, setup | ||
|
||
|
||
def read_reqs(reqs_path: Path) -> set[str]: | ||
return { | ||
r | ||
for r in re.findall( | ||
r"(^[^#\n-][\w\[,\]]+[-~>=<.\w]*)", | ||
reqs_path.read_text(), | ||
re.MULTILINE, | ||
) | ||
if isinstance(r, str) | ||
} | ||
|
||
|
||
CURRENT_DIR = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent | ||
|
||
|
||
INSTALL_REQUIREMENTS = tuple( | ||
read_reqs(CURRENT_DIR / "requirements" / "_base.in") | ||
) # WEAK requirements | ||
|
||
TEST_REQUIREMENTS = tuple( | ||
read_reqs(CURRENT_DIR / "requirements" / "_test.txt") | ||
) # STRICK requirements | ||
|
||
|
||
SETUP = { | ||
"name": "simcore-common-library", | ||
"version": Path(CURRENT_DIR / "VERSION").read_text().strip(), | ||
"author": "Sylvain Anderegg (sanderegg)", | ||
"description": "Core service library for simcore pydantic common", | ||
"python_requires": "~=3.10", | ||
"classifiers": [ | ||
"Development Status :: 2 - Pre-Alpha", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 3.10", | ||
], | ||
"long_description": Path(CURRENT_DIR / "README.md").read_text(), | ||
"license": "MIT license", | ||
"install_requires": INSTALL_REQUIREMENTS, | ||
"packages": find_packages(where="src"), | ||
"package_data": {"": ["py.typed"]}, | ||
"package_dir": {"": "src"}, | ||
"include_package_data": True, | ||
"test_suite": "tests", | ||
"tests_require": TEST_REQUIREMENTS, | ||
"extras_require": {"test": TEST_REQUIREMENTS}, | ||
"zip_safe": False, | ||
} | ||
|
||
|
||
if __name__ == "__main__": | ||
setup(**SETUP) |