Commit 3a21531a authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Merge branch 'v0.8.4' into encyclopedia-api

parents 9d74877c 36e681e3
Pipeline #79335 passed with stages
in 30 minutes and 2 seconds
......@@ -29,3 +29,4 @@ build/
dist/
setup.json
parser.osio.log
gui/src/metainfo.json
......@@ -62,6 +62,12 @@ gui_linting:
- cd gui
- yarn
- yarn run eslint 'src/**/*.js'
except:
refs:
- tags
variables:
- $CI_COMMIT_REF_NAME =~ /^dev-.*$/
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]tests?\]/i
tests:
stage: test
......@@ -111,6 +117,12 @@ install_tests:
- python -c "import nomad.datamodel, nomad.datamodel.metainfo, nomad.client"
- pip install `echo dist/nomad-lab-*.tar.gz`[parsing]
- python -m nomad.cli parse tests/data/parsers/vasp/vasp.xml
except:
refs:
- tags
variables:
- $CI_COMMIT_REF_NAME =~ /^dev-.*$/
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]tests?\]/i
dev_setup_tests:
stage: test
......@@ -119,6 +131,12 @@ dev_setup_tests:
- pip install --upgrade pip
- ./setup.sh
- python -m nomad.cli parse tests/data/parsers/vasp/vasp.xml
except:
refs:
- tags
variables:
- $CI_COMMIT_REF_NAME =~ /^dev-.*$/
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]tests?\]/i
deploy:
stage: deploy
......
Subproject commit 56e9412d0d322fd88240fe2af41716a0016831c7
Subproject commit e7077c9a824e01b45b0e4989858ecd35f59f4cc7
Subproject commit 7decbdcf25ef48b019bde17c472f54d65a124c9a
Subproject commit cc6c9545300cf6ea3347357fedffc6798415a299
Subproject commit 0a3e003535d12b987f5774fc631cb142b6d245c6
Subproject commit 1211d4b79907d9a987422193b3f97efd69962a3c
Subproject commit 059d4c7f1a452383d67f0ecf0c9bc267580083dc
Subproject commit fa54fe567a1250af3009ecc9692d14c64a399f29
Subproject commit f7f156204c16b54e4df998a8a275bcf4a5aaf901
Subproject commit 2310b63ff3904ddd6f912c32789568787c6ab250
Subproject commit 8d896ede93e794d0fdb905e42281ef7c871bc05d
Subproject commit b7d913f0d8f82a9bb564e346bb60f66008ac791b
Subproject commit 97b653e3fe695775f53a96249a0bb9ad694ef742
Subproject commit a741cfe607e9dfd1f2d65aeddbcc4bc5a15bbc13
Subproject commit 85cc99b320454f8c8a68bdf376e128c156cf2ac2
Subproject commit 7f5fc6a358dc7e40e716cc5205fa04e8cf9c6d6c
Subproject commit cf843eda3e4650bc240eb0d1a1ab5b0cea6dda96
Subproject commit afdd0937aab2681ca3912cfd9d95c7633fdcd7b9
import json
from nomad.datamodel.metainfo import public
# A simple example that demonstrates how to set references
run = public.section_run()
scc = run.m_create(public.section_single_configuration_calculation)
system = run.m_create(public.section_system)
scc.single_configuration_calculation_to_system_ref = system
assert scc.single_configuration_calculation_to_system_ref == system
print(json.dumps(run.m_to_dict(), indent=2))
......@@ -5,7 +5,7 @@ window.nomadEnv = {
'appBase': 'http://localhost:8000/fairdi/nomad/latest',
'debug': false,
'matomoEnabled': false,
'matomoUrl': 'https://nomad-lab.eu/prod/stat',
'matomoUrl': 'https://nomad-lab.eu/fairdi/stat',
'matomoSiteId': '2',
'version': {
"label": "0.8.4",
......
......@@ -102,21 +102,12 @@ class LegacyMetainfoResource(Resource):
Other required packages might also be returned, e.g. a parser might organize its
definitions in multiple packages.
'''
package = metainfo_package_name
if package.endswith('.nomadmetainfo.json'):
package = package[:-19]
if package.endswith('.json'):
package = package[:-5]
try:
python_package_name, _ = python_package_mapping(package)
python_package_name = '.'.join(python_package_name.split('.')[:-1])
python_module = importlib.import_module(python_package_name)
metainfo = getattr(python_module, 'm_env')
metainfo = LegacyMetainfoEnvironment.from_legacy_package_path(metainfo_package_name)
except (ImportError, KeyError, FileNotFoundError, AttributeError):
abort(404, message='Metainfo package %s does not exist.' % package)
abort(404, message='Metainfo package %s does not exist.' % metainfo_package_name)
if isinstance(metainfo, LegacyMetainfoEnvironment):
return metainfo.to_legacy_dict(metainfo.packages)
else:
abort(404, message='Metainfo package %s is not a legacy package.' % package)
abort(404, message='Metainfo package %s is not a legacy package.' % metainfo_package_name)
......@@ -123,7 +123,7 @@ class Meta():
self.more_data_available = available > returned if available is not None else False
self.provider = dict(
name=config.meta.name,
description=config.meta.name,
description=config.meta.description,
prefix='nomad',
homepage=config.meta.homepage,
index_base_url=url(version=None, prefix='index')
......@@ -200,10 +200,10 @@ json_api_data_object_model = api.model('DataObject', {
description='The id of the object.'),
'attributes': fields.Raw(
description='A dictionary, containing key-value pairs representing the entries properties')
description='A dictionary, containing key-value pairs representing the entries properties'),
# TODO
# further optional fields: links, meta, relationships
'relationships': fields.Raw(
description='In accordance with section Relationships, all entry types MAY use relationships to describe relations to other entries.')
})
......
......@@ -43,6 +43,22 @@ def qa(skip_tests: bool, exitfirst: bool):
sys.exit(ret_code)
@dev.command(help='Generates a JSON with all metainfo.')
def metainfo():
import json
from nomad.metainfo import Package
from nomad.parsing.parsers import parsers
# Ensure all metainfo is loaded
for parser in parsers:
_ = parser.metainfo_env
data = {key: value.m_to_dict() for key, value in Package.registry.items()}
print(json.dumps(data, indent=2))
@dev.command(help='Generates source-code for the new metainfo from .json files of the old.')
@click.argument('path', nargs=-1)
def legacy_metainfo(path):
......
......@@ -169,10 +169,14 @@ def api_url(ssl: bool = True):
services.api_base_path.strip('/'))
def gui_url():
def gui_url(page: str = None):
base = api_url(True)[:-3]
if base.endswith('/'):
base = base[:-1]
if page is not None:
return '%s/gui/%s' % (base, page)
return '%s/gui' % base
......@@ -269,7 +273,7 @@ meta = NomadConfig(
service='unknown nomad service',
name='novel materials discovery (NOMAD)',
description='A FAIR data sharing platform for materials science data',
homepage='https://https://nomad-lab.eu',
homepage='https://nomad-lab.eu',
source_url='https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR',
maintainer_email='markus.scheidgen@physik.hu-berlin.de'
)
......@@ -397,6 +401,7 @@ def load_config(config_file: str = os.environ.get('NOMAD_CONFIG', 'nomad.yaml'))
else:
logger.error('config key %s does not exist' % key)
if config_data is not None:
adapt(globals(), config_data)
# load env and override yaml and defaults
......
......@@ -293,4 +293,5 @@ from .metainfo import (
SectionAnnotation,
SectionProxy,
derived,
constraint)
constraint,
units)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment