Skip to content

Commit 3d0383f

Browse files
author
lukaspie
committed
re-enable schema caching
1 parent 6756632 commit 3d0383f

File tree

8 files changed

+10
-180
lines changed

8 files changed

+10
-180
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
- name: Build package
8383
run: |
8484
git reset --hard HEAD
85-
rm -f src/pynxtools/nomad/nxs_metainfo_package_*.json
85+
rm -f src/pynxtools/nomad/schema_packages/nxs_metainfo_package_*.json
8686
export PYNXTOOLS_BUILD_PACKAGE=1
8787
uv run --extra nomad scripts/generate_package.py
8888
uv build
@@ -117,7 +117,7 @@ jobs:
117117
EXPECTED=$(python -c "from pynxtools import get_nexus_version; print(f'nxs_metainfo_package_{get_nexus_version()}.json')")
118118
119119
# find the JSON file
120-
FOUND_FILE=$(find "$SITE_PACKAGES/pynxtools/nomad" -name 'nxs_metainfo_package_*.json' -print -quit)
120+
FOUND_FILE=$(find "$SITE_PACKAGES/pynxtools/nomad/schema_packages" -name 'nxs_metainfo_package_*.json' -print -quit)
121121
122122
if [ -z "$FOUND_FILE" ]; then
123123
echo "ERROR: nxs_metainfo_package_*.json not found in installed package."

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,6 @@ cython_debug/
206206
!src/pynxtools/units/constants_en.txt
207207
!src/pynxtools/units/default_en.txt
208208
build/
209-
src/pynxtools/nomad/nxs_metainfo_*.json
209+
src/pynxtools/nomad/schema_packages/nxs_metainfo_*.json
210210
nexusparser.egg-info/PKG-INFO
211211
.python-version

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ include src/pynxtools/remote_definitions_url.txt
1313
include src/pynxtools/definitions/NXDL_VERSION
1414
include src/pynxtools/units/*.txt
1515
graft src/pynxtools/nomad/example_uploads/iv_temp_example
16-
include src/pynxtools/nomad/nxs_metainfo_package_*.json
16+
include src/pynxtools/nomad/schema_packages/nxs_metainfo_package_*.json

scripts/clean_old_packages.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ project_dir=$(dirname "$(dirname "$(realpath "$0")")")
55
cd "$project_dir" || exit 1
66

77
# Get the full path of the file to keep
8-
nxs_file=$(python3 -c "from pynxtools.nomad.utils import get_package_filepath; print(get_package_filepath())")
8+
nxs_file=$(python3 -c "from pynxtools.nomad import get_package_filepath; print(get_package_filepath())")
99

1010
# Define the target directory
11-
target_dir="src/pynxtools/nomad"
11+
target_dir="src/pynxtools/nomad/schema_packages"
1212

1313
# Delete all matching files except nxs_file
1414
for file in "$target_dir"/nxs_metainfo_package_*.json; do

scripts/generate_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33

44
try:
5-
from pynxtools.nomad.utils import get_package_filepath
5+
from pynxtools.nomad import get_package_filepath
66
except ImportError as e:
77
raise ImportError(
88
"The 'pynxtools' package is required but not installed. "
@@ -14,6 +14,6 @@
1414

1515
if not os.path.exists(nxs_filepath):
1616
logger.info(f"Generating NeXus package at {nxs_filepath}.")
17-
import pynxtools.nomad.schema # noqa: F401
17+
import pynxtools.nomad.schema_packages.schema # noqa: F401
1818
else:
1919
logger.info(f"NeXus package already existed at {nxs_filepath}.")

src/pynxtools/nomad/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def get_quantity_base_name(quantity_name):
134134
)
135135

136136

137-
PACKAGE_DIR = Path(__file__).resolve().parent
137+
PACKAGE_DIR = Path(__file__).resolve().parent / "schema_packages"
138138
CACHE_DIR = Path(config.fs.tmp) / "pynxtools"
139139

140140

src/pynxtools/nomad/schema_packages/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ def init_nexus_metainfo():
11581158
if nexus_metainfo_package is not None:
11591159
return
11601160
try:
1161-
# load_nexus_schema()
1161+
load_nexus_schema()
11621162
raise Exception("test")
11631163

11641164
except Exception:

src/pynxtools/nomad/utils.py

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

0 commit comments

Comments
 (0)