GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — mixs/Makefile at main · GenomicsStandardsConsortium/mixs Expand file tree/ Copy pathMakefileMore file actions 374 lines (323 loc) · 16.8 KB / Copy pathMakefileFile metadata and controls374 lines (323 loc) · 16.8 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 # RELEASE SOP: make install clean all all-contrib test MAKEFLAGS += --warn-undefined-variables SHELL := bash .SHELLFLAGS := -eu -o pipefail -c .DEFAULT_GOAL := help .DELETE_ON_ERROR: .SUFFIXES: .SECONDARY: RUN = poetry run SCHEMA_NAME = mixs SOURCE_SCHEMA_PATH = src/mixs/schema/mixs.yaml SOURCE_SCHEMA_DIR = $(dir $(SOURCE_SCHEMA_PATH)) SRC = src DEST = project PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel DOCDIR = docs TEMPLATEDIR = $(SRC)/doc-templates TERM_LIST_FILE = $(DOCDIR)/term_list.md COMBINATIONS_FILE = $(DOCDIR)/combinations.md ENUMERATIONS_FILE = $(DOCDIR)/enumerations.md EXAMPLEDIR = examples SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml EXCEL_TEMPLATES_DIR = mixs-templates GEN_PARGS = --exclude excel --exclude graphql --exclude markdown --exclude prefixmap --exclude protobuf --exclude shacl --exclude shex GEN_DARGS = # note: "help" MUST be the first target in the file, # when the user types "make" they should get help info help: status @echo "" @echo "Core workflow: make install clean all test" @echo "" @echo "Main targets:" @echo " install -- install Python dependencies (used by all GH Actions)" @echo " clean -- remove all generated files (calls clean-contrib; used by main & docs GH Actions)" @echo " all -- complete build (calls site, qc, gen-excel, project/class-model-tsvs-organized, all-contrib, linkml-lint, yaml-lint; used by main GH Action)" @echo " test -- validation & tests (calls qc, test-python, test-examples, linkml-lint, yaml-lint, tsv-roundtrip-test; used by main GH Action)" @echo "" @echo "Output to directories:" @echo " site -- build website (called by all; calls gen-project, gendoc)" @echo " gen-project -- generate project/ artifacts, plus project/mixs.yaml (called by all via site)" @echo " owl -- generate project/owl/mixs.owl.ttl with OLS-oriented options (called by all via site)" @echo " gendoc -- generate docs/ website files (called by all via site, testdoc; used by docs GH Actions)" @echo " gen-excel -- generate mixs-templates/ Excel files (called by all)" @echo " project/class-model-tsvs-organized -- generate organized TSV files (called by all)" @echo " all-contrib -- generate contrib/ schema transformation pipeline (called by all; used by main GH Action):" @echo " 1. structured-patterns-preferred (remove pattern field)" @echo " 2. normalized-minimized (yq cleanup, no imports)" @echo " 3. patterns-materialized (expand patterns from step 2)" @echo " + schemasheets, dendrograms, slot usage reports" @echo " test-examples -- generate examples/output/ validated data (called by test)" @echo "" @echo "Quality checks:" @echo " qc -- dependency validation with deptry (called by all, test; can fail)" @echo " linkml-lint -- schema validation (called by all, test; fails on problems; has GH Action)" @echo " yaml-lint -- YAML format checks (called by all, test; fails on problems; has GH Action)" @echo " fix-whitespace -- strip trailing whitespace from src/mixs/schema (fixes a common yaml-lint failure)" @echo "" @echo "Individual tests:" @echo " test-python -- Python unit tests (called by test)" @echo " tsv-roundtrip-test -- check a record survives YAML to TSV and back (called by test)" @echo "" @echo "Cleanup:" @echo " clean-contrib -- remove contrib/ files (called by clean)" @echo "" @echo "Standalone utilities:" @echo " help -- show this help" @echo " status -- show project info (called by help)" @echo " testdoc -- build & serve docs locally (calls gendoc, serve)" @echo " serve -- serve existing docs locally via mkdocs (called by testdoc)" @echo " check-published -- compare the three artifacts served at w3id.org; REF=<tag> checks a tag instead" @echo " purge-diff -- remove a generated comparison; DIFF=<old>_to_<new>" @echo " tsv-roundtrip -- write the YAML to TSV and back, leaving both for inspection" @echo " yamlfmt-beta -- experimental YAML formatter" @echo " create-data-harmonizer -- experimental; currently broken, see issue 1244" @echo "" .PHONY: all all-contrib clean install help status linkml-lint yaml-lint fix-whitespace yamlfmt-beta test testdoc serve gen-project gendoc site owl test-python test-examples ensure-dirs clean-contrib project/class-model-tsvs-organized ensure-dirs: mkdir -p contrib mkdir -p $(DEST) mkdir -p $(DOCDIR) mkdir -p $(PYMODEL) mkdir -p $(EXCEL_TEMPLATES_DIR) mkdir -p $(DOCDIR)/javascripts status: @echo "Project: $(SCHEMA_NAME)" @echo "Source: $(SOURCE_SCHEMA_PATH)" # install any dependencies required for building install: poetry install --all-extras # EXPERIMENTAL, and currently broken. The upstream create-data-harmonizer npm # package is frozen at 0.0.3 (2023-03-23) and crashes in its own readline before # it produces anything, so this cannot succeed from a Make target regardless of # how it is invoked. Kept rather than deleted pending a decision: see issue 1244 # for removal and issue 648 for generating a DataHarmonizer interface properly. create-data-harmonizer: npm init data-harmonizer $(SOURCE_SCHEMA_PATH) all: ensure-dirs site qc gen-excel project/class-model-tsvs-organized all-contrib linkml-lint yaml-lint all-contrib: ensure-dirs contrib/mixs_structured_patterns_preferred.yaml contrib/mixs-normalized-minimized.yaml contrib/mixs_derived_class_term_schemasheet.tsv contrib/required_and_recommended_slot_usages.tsv contrib/extensions-dendrogram.pdf contrib/soil-vs-water-slot-usage.yaml contrib/class_summary_results.tsv contrib/mixs-schemasheets-concise.tsv contrib/mixs-schemasheets-concise-global-slots.tsv contrib/mixs-patterns-materialized.yaml site: gen-project owl gendoc %.yaml: gen-project # generates all project files gen-project: ensure-dirs $(PYMODEL) $(RUN) linkml generate project --log_level WARNING --config-file project-generator-config.yaml $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) # The source schema is copied in beside the artifacts generated from it, so every # file a consumer can fetch under project/ comes from the same build. Without this, # https://w3id.org/mixs/mixs.yaml has to resolve to the working copy on main while # the other w3id URLs resolve to project/, which is how they came to report the same # version while describing different schemas. cp $(SOURCE_SCHEMA_PATH) $(DEST)/mixs.yaml OLS_SPARQL_DIR = src/sparql/ols # The published MIxS OWL is generated with OLS-oriented options (the ols metadata # profile, and a resolvable ontology IRI at https://w3id.org/mixs/mixs.owl.ttl) and # post-processed with SPARQL (src/sparql/ols/). Built here rather than via # `linkml generate project` because metadata_profile must be passed on the gen-owl # CLI: owlgen compares it against an enum and ignores a YAML config string. owl: project/owl/mixs.owl.ttl project/owl/mixs.owl.ttl: $(SOURCE_SCHEMA_PATH) $(wildcard $(OLS_SPARQL_DIR)/*.ru) mkdir -p project/owl $(RUN) gen-owl --mergeimports --no-metaclasses --no-type-objects --add-root-classes --mixins-as-expressions --no-use-native-uris --metadata-profile ols --ontology-uri-suffix /mixs.owl.ttl $(SOURCE_SCHEMA_PATH) > project/owl/mixs.owl.ttl $(RUN) apply-sparql-updates --owl project/owl/mixs.owl.ttl --sparql-dir $(OLS_SPARQL_DIR) test: qc test-python test-examples linkml-lint yaml-lint tsv-roundtrip-test test-python: $(RUN) python -m unittest discover linkml-lint: # was previously just "lint" $(RUN) linkml lint $(SOURCE_SCHEMA_PATH) yaml-lint: # Run yamllint on schema files @echo "Running yamllint on src/mixs/schema..." $(RUN) yamllint -c .yamllint src/mixs/schema fix-whitespace: # Strip trailing whitespace from the schema sources @echo "Stripping trailing whitespace from src/mixs/schema..." @find src/mixs/schema -name '*.yaml' -exec sed -i.bak -e 's/[[:space:]]*$$//' {} \; -exec rm -f {}.bak \; test-examples: examples/output examples/output: contrib/mixs-patterns-materialized.yaml mkdir -p $@ $(RUN) linkml examples \ --output-formats json \ --output-formats yaml \ --counter-example-input-directory src/data/examples/invalid \ --input-directory src/data/examples/valid \ --output-directory $@ \ --schema $< > $@/README.md contrib/mixs_structured_patterns_preferred.yaml: src/mixs/schema/mixs.yaml mkdir -p contrib yq '(.slots[] | select(has("structured_pattern") and has("pattern"))) |= del(.pattern)' $< > $@ contrib/mixs-normalized-minimized.yaml: contrib/mixs_structured_patterns_preferred.yaml mkdir -p contrib $(RUN) linkml generate linkml \ --format yaml \ --no-mergeimports \ --no-materialize-attributes \ --no-materialize-patterns $< |\ yq eval '(.. | select(has("from_schema")) | .from_schema) style="" | del(.. | select(has("from_schema")).from_schema)' |\ yq eval '.classes[] |= select(has("annotations")).annotations |= map_values(.value)' |\ yq eval '.prefixes |= map_values(.prefix_reference)' |\ yq eval '.settings |= map_values(.setting_value)' |\ yq eval '.slots[] |= select(has("annotations")).annotations |= map_values(.value)' |\ yq eval 'del(.classes.[].name)' |\ yq eval 'del(.classes.[].slot_usage.[].name)' |\ yq eval 'del(.enums.[].name)' |\ yq eval 'del(.enums.[].permissible_values.[].text)' |\ yq eval 'del(.slots[] | select(.domain != "MixsCompliantData") | .domain)' |\ yq eval 'del(.slots.[].name)' |\ yq eval 'del(.source_file)' |\ yq eval 'del(.subsets.[].name)' > $@ contrib/mixs-patterns-materialized.yaml: contrib/mixs-normalized-minimized.yaml mkdir -p contrib $(RUN) gen-linkml \ --format yaml \ --materialize-patterns \ --no-materialize-attributes $< |\ yq eval '(.. | select(has("from_schema")) | .from_schema) style="" | del(.. | select(has("from_schema")).from_schema)' |\ yq eval '.classes[] |= select(has("annotations")).annotations |= map_values(.value)' |\ yq eval '.prefixes |= map_values(.prefix_reference)' |\ yq eval '.settings |= map_values(.setting_value)' |\ yq eval '.slots[] |= select(has("annotations")).annotations |= map_values(.value)' |\ yq eval 'del(.classes.[].name)' |\ yq eval 'del(.classes.[].slot_usage.[].name)' |\ yq eval 'del(.enums.[].name)' |\ yq eval 'del(.enums.[].permissible_values.[].text)' |\ yq eval 'del(.slots[] | select(.domain != "MixsCompliantData") | .domain)' |\ yq eval 'del(.slots.[].name)' |\ yq eval 'del(.source_file)' |\ yq eval 'del(.subsets.[].name)' > $@ .PHONY: gen-excel gen-excel: $(SOURCE_SCHEMA_PATH) mkdir -p $(DEST)/excel $(RUN) gen-excel $< \ --include-mixins \ --split-workbook-by-class \ --output $(DEST)/excel mkdir -p $(EXCEL_TEMPLATES_DIR) $(RUN) organize-files \ --mixs-schema-file $< \ --source-directory $(DEST)/excel \ --base-destination-folder $(EXCEL_TEMPLATES_DIR) \ --extensions xlsx project/class-model-tsvs-organized: src/mixs/schema/mixs.yaml $(RUN) linkml2class-tsvs \ --eligible-parent-classes Checklist \ --eligible-parent-classes Extension \ --output-dir project/class-model-tsvs \ --schema-file src/mixs/schema/mixs.yaml mkdir -p project/class-model-tsvs-organized $(RUN) organize-files \ --mixs-schema-file $< \ --source-directory project/class-model-tsvs \ --base-destination-folder project/class-model-tsvs-organized \ --extensions tsv rm -rf project/class-model-tsvs mv project/class-model-tsvs-organized project/class-model-tsvs yamlfmt-beta: # was test1 echo $$PATH yamlfmt -conf .yamlfmt src/mixs/schema/mixs.yaml > src/mixs/schema/mixs_standardized.yaml # Test documentation locally serve: mkd-serve # Python datamodel $(PYMODEL): mkdir -p $@ $(DOCDIR): mkdir -p $@ gendoc: ensure-dirs $(DOCDIR) cp $(SRC)/docs/*md $(DOCDIR) ; \ rm -f $(DOCDIR)/README.md ; \ $(RUN) linkml generate doc ${GEN_DARGS} $(SOURCE_SCHEMA_PATH) -d $(DOCDIR) --template-directory $(TEMPLATEDIR) --use-slot-uris --use-class-uris --include src/mixs/schema/deprecated.yaml $(RUN) generate-term-list --output-file $(TERM_LIST_FILE) $(RUN) generate-combinations --output-file $(COMBINATIONS_FILE) $(RUN) generate-enumerations --output-file $(ENUMERATIONS_FILE) mkdir -p $(DOCDIR)/javascripts $(RUN) cp $(SRC)/scripts/javascripts/* $(DOCDIR)/javascripts/ # Publish each committed version-diff's summaries (agent + tool) as site pages. mkdir -p $(DOCDIR)/version-changes @for d in assets/diff_results/*/; do \ [ -d "$$d" ] || continue; \ name=$$(basename "$$d"); \ if [ -f "$$d/agent_summary.md" ]; then cp "$$d/agent_summary.md" "$(DOCDIR)/version-changes/$$name.md"; fi; \ if [ -f "$$d/tool_summary.md" ]; then cp "$$d/tool_summary.md" "$(DOCDIR)/version-changes/$$name-counts.md"; fi; \ done testdoc: gendoc serve MKDOCS = $(RUN) mkdocs mkd-%: $(MKDOCS) $* PROJECT_FOLDERS = sqlschema shex shacl protobuf prefixmap owl jsonschema jsonld graphql excel clean: clean-contrib rm -rf $(DEST) rm -rf tmp rm -fr docs/* rm -fr $(PYMODEL)/* rm -rf $(EXCEL_TEMPLATES_DIR) rm -rf examples/output .PHONY: qc clean-assets qc: poetry run deptry . --ignore DEP004 clean-contrib: rm -rf contrib/class_summary_results.* \ contrib/mixs_derived_class_term_schemasheet.* \ contrib/mixs-patterns-materialized.yaml \ contrib/mixs_structured_patterns_preferred.yaml \ contrib/mixs-normalized-minimized.yaml \ contrib/mixs-schemasheets-concise* \ contrib/required_and_recommended_slot_usages.tsv \ contrib/mixs_derived_class_term_schemasheet_* \ contrib/extensions-dendrogram.pdf \ contrib/soil-vs-water-slot-usage.yaml # Purge one diff's output folder. You must name which diff, so a purge can never # remove more than you asked for. Example: # make purge-diff DIFF=v5_to_v6.0.0 # The outputs are committed, so if you purge one by mistake, get it back with: # git restore assets/diff_results/<name> DIFF ?= .PHONY: check-published # Checks the artifacts served at w3id.org against each other. These are the URLs # EBI OLS and BioPortal follow, and separate redirects serve them, so nothing # otherwise guarantees they describe the same schema. Pass REF to check a tag's # raw URLs instead: make check-published REF=v7.0.0 check-published: $(RUN) python src/scripts/check_published_consistency.py $(if $(REF),--ref '$(REF)',) .PHONY: purge-diff purge-diff: @test -n "$(DIFF)" || { echo "Say which diff to purge, for example: make purge-diff DIFF=v5_to_v6.0.0"; echo "Diffs you can purge:"; find assets/diff_results -mindepth 1 -maxdepth 1 -type d -exec basename {} \; ; exit 1; } @test -d "assets/diff_results/$(DIFF)" || { echo "No diff folder assets/diff_results/$(DIFF). Diffs you can purge:"; find assets/diff_results -mindepth 1 -maxdepth 1 -type d -exec basename {} \; ; exit 1; } rm -rf "assets/diff_results/$(DIFF)" @echo "Purged assets/diff_results/$(DIFF). Undo with: git restore assets/diff_results/$(DIFF)" # ============================================================================= # Multivalued TSV round-trip (demonstration + equivalence test) # ============================================================================= # Proves that multivalued MIxS data survives a YAML -> TSV -> YAML round-trip # using only the standard `linkml-convert` tool (no custom conversion code), now # that linkml can serialize and parse pipe-delimited multivalued cells (linkml # #3134 list formatting and #3251 empty-cell load, both released in linkml 1.11). .PHONY: tsv-roundtrip tsv-roundtrip-test TSV_DIR = src/data/examples/tsv-normalization # Round-trip input is a standard valid example, so it is schema-validated by # test-examples and reused here. TSV_YAML = src/data/examples/valid/MixsCompliantData-MimsSoil-multivalued-example.yaml TSV_TSV = $(TSV_DIR)/roundtrip.tsv TSV_RELOADED = $(TSV_DIR)/roundtrip.reloaded.yaml # YAML -> bare-pipe TSV, standard linkml-convert. $(TSV_TSV): $(TSV_YAML) contrib/mixs-patterns-materialized.yaml $(RUN) linkml-convert \ -s contrib/mixs-patterns-materialized.yaml \ -C MixsCompliantData -S mims_soil_data \ -f yaml -t tsv --no-validate --list-wrapper none \ $(TSV_YAML) > $(TSV_TSV) # bare-pipe TSV -> YAML, standard linkml-convert. $(TSV_RELOADED): $(TSV_TSV) contrib/mixs-patterns-materialized.yaml $(RUN) linkml-convert \ -s contrib/mixs-patterns-materialized.yaml \ -C MixsCompliantData -S mims_soil_data \ -f tsv -t yaml --no-validate --list-wrapper none \ $(TSV_TSV) > $(TSV_RELOADED) tsv-roundtrip: $(TSV_RELOADED) # Equivalence test (runs in CI via `make test`): the reloaded YAML must equal the # original after YAML -> TSV -> YAML. Compare with standard tools only: sort keys # with yq so ordering is not significant, then diff. diff exits non-zero (and # prints the difference) if they are not equivalent, failing the target. tsv-roundtrip-test: $(TSV_RELOADED) @echo "=== TSV round-trip equivalence check ===" @if diff <(yq -P 'sort_keys(..)' $(TSV_YAML)) <(yq -P 'sort_keys(..)' $(TSV_RELOADED)); then \ echo "round-trip equivalence OK: $(TSV_YAML) == $(TSV_RELOADED)"; \ else \ echo "ROUND-TRIP MISMATCH: $(TSV_YAML) != $(TSV_RELOADED) (see diff above)"; exit 1; \ fi include contrib.Makefile |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |