@@ -6,18 +6,20 @@ SCHEMA := test-schema.json
66LOG_CLI := # --log-cli
77TMP := .testtmp
88
9- unexport VIRTUAL_ENV
10-
11- POETRY := env -u VIRTUAL_ENV PATH="$(PATH ) " poetry
12- POETRYRUN := $(POETRY ) run
9+ UV := uv
10+ UVRUN := $(UV ) run
11+ UVSYNC := $(UV ) sync
12+ # PYANG_PLUGIN_BASE := .venv/pyang-json-schema-plugin
13+ PYANG_PLUGIN_DIR := $(PYANG_PLUGIN_BASE ) /jsonschema
14+ PYANG_PLUGIN := $(PYANG_PLUGIN_DIR ) /jsonschema.py
1315
1416MAKE_DIR: =$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
1517
1618all : $(TMP ) $(YANG ) $(YANG_SCHEMA ) doc ci-lint test yang-test
1719
1820.PHONY : doc
1921doc :
20- $(POETRYRUN ) $(MAKE ) -C doc html
22+ $(UVRUN ) $(MAKE ) -C doc html
2123
2224doc-start :
2325 sudo podman run -it --rm -p 8088:80 -d --volume $(MAKE_DIR ) /doc/build/html:/usr/share/nginx/html --name sphinx docker.io/nginx
@@ -27,31 +29,32 @@ doc-stop:
2729
2830# We hand craft this to keep things cleaner
2931doc-apidoc :
30- $(POETRYRUN ) sphinx-apidoc -f --module-first --ext-doctest --extensions sphinx-prompt -o doc/source/apidoc munet
32+ $(UVRUN ) sphinx-apidoc -f --module-first --ext-doctest --extensions sphinx-prompt -o doc/source/apidoc munet
3133
3234prepare-publish : $(YANG_SCHEMA )
3335
3436lint :
35- $(POETRYRUN ) pydocstyle ./munet
36- $(POETRYRUN ) pylint ./munet $(shell find ./tests/* /* -name '* .py')
37+ $(UVRUN ) pydocstyle ./munet
38+ $(UVRUN ) pylint ./munet $(shell find ./tests/* /* -name '* .py')
3739
3840ci-lint :
39- $(POETRYRUN ) pydocstyle ./munet
40- $(POETRYRUN ) pylint --disable=" fixme" ./munet ./tests
41+ $(UVRUN ) pydocstyle ./munet
42+ $(UVRUN ) pylint --disable=" fixme" ./munet ./tests
4143
4244test : test-validate ci-lint
43- sudo -E $( POETRYRUN ) mutest tests
44- sudo -E $( POETRYRUN ) pytest -s -v --cov=munet --cov-report=xml tests
45+ $( UVRUN ) sudo -E mutest tests
46+ $( UVRUN ) sudo -E pytest -s -v --cov=munet --cov-report=xml tests
4547
4648clean :
4749 rm -f * .yang coverage.xml err.out ox-rfc.el
4850 rm -rf .testtmp/schema
51+ rm -rf $(PYANG_PLUGIN_BASE )
4952
5053run :
51- sudo -E $( POETRYRUN ) python3 -m munet
54+ $( UVRUN ) sudo -E python3 -m munet
5255
5356install :
54- $(POETRY ) install --all-extras
57+ $(UVSYNC ) --all-groups
5558
5659# ====
5760# YANG
@@ -62,7 +65,7 @@ install:
6265# -------------------------
6366
6467ajv = $(or $(and $(shell which ajv) ,ajv $(1 ) ) ,)
65- y2j = $(POETRYRUN ) python -c 'import sys; import json; import yaml; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=2)' < $(1 ) > $(2 )
68+ y2j = $(UVRUN ) python -c 'import sys; import json; import yaml; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=2)' < $(1 ) > $(2 )
6669
6770$(YANG ) : $(ORG )
6871 sed -n ' /#+begin_src yang :exports code/,/^#+end_src/p' $< | sed ' /^#/d' > $@
@@ -94,8 +97,11 @@ ox-rfc.el:
9497# YANG data validation
9598# --------------------
9699
97- $(YANG_SCHEMA ) : $(YANG )
98- $(POETRYRUN ) pyang --plugindir .venv/src/pyang-json-schema-plugin/jsonschema/jsonschema.py --format jsonschema -o $@ $<
100+ # $(PYANG_PLUGIN):
101+ # $(UV) pip install --no-deps --target $(PYANG_PLUGIN_BASE) git+https://github.com/LabNConsulting/pyang-json-schema-plugin.git@labn-master
102+
103+ $(YANG_SCHEMA ) : $(YANG ) # $(PYANG_PLUGIN)
104+ $(UVRUN ) pyang --format jsonschema -o $@ $<
99105
100106$(TMP ) :
101107 mkdir -p .testtmp
@@ -111,8 +117,8 @@ KINDS_DATA := .testtmp/kinds.json
111117test-validate : $(YANG_SCHEMA ) $(KINDS_DATA ) .testtmp/basic.json $(TMP )
112118 @echo " testing basic with yang generated schema"
113119 $(call ajv,--spec=draft2020 -d .testtmp/basic.json -s $(YANG_SCHEMA ) )
114- $(POETRYRUN ) jsonschema --instance .testtmp/basic.json $(YANG_SCHEMA )
120+ $(UVRUN ) jsonschema --instance .testtmp/basic.json $(YANG_SCHEMA )
115121
116122 @echo "testing kinds with yang generated schema"
117123 $(call ajv,--spec=draft2020 -d .testtmp/kinds.json -s $(YANG_SCHEMA))
118- $(POETRYRUN ) jsonschema --instance .testtmp/kinds.json $(YANG_SCHEMA)
124+ $(UVRUN ) jsonschema --instance .testtmp/kinds.json $(YANG_SCHEMA)
0 commit comments