From 484501617a48639f66ab1b854803f785810cab07 Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Thu, 23 Feb 2023 11:20:53 +0000 Subject: [PATCH 1/8] initial --- src/csvcubed/cli/error_mapping.py | 34 +++++++++---------- src/csvcubed/models/cube/qb/__init__.py | 4 --- .../models/cube/qb/components/__init__.py | 28 --------------- .../models/cube/qb/validationerrors.py | 13 ++++--- .../cli/inspect/test_inspectdatasetmanager.py | 1 + .../unit/cli/inspect/test_metadataprinter.py | 1 + .../test_skoscodelistwriter.py | 5 ++- 7 files changed, 29 insertions(+), 57 deletions(-) diff --git a/src/csvcubed/cli/error_mapping.py b/src/csvcubed/cli/error_mapping.py index 0c8c37952..2774f58e0 100644 --- a/src/csvcubed/cli/error_mapping.py +++ b/src/csvcubed/cli/error_mapping.py @@ -3,25 +3,15 @@ from os import linesep from typing import Type, Union -from csvcubed.models.cube.qb import ( - BothMeasureTypesDefinedError, - BothUnitTypesDefinedError, - CsvColumnUriTemplateMissingError, - EmptyQbMultiMeasureDimensionError, - MoreThanOneMeasureColumnError, - MoreThanOneUnitsColumnError, - NoDimensionsDefinedError, - NoMeasuresDefinedError, - NoObservedValuesColumnDefinedError, - NoUnitsDefinedError, - QbAttribute, - QbCodeList, - QbDimension, - QbMultiMeasureDimension, - QbMultiUnits, - QbObservationValue, +from csvcubed.models.cube.qb.components.attribute import QbAttribute +from csvcubed.models.cube.qb.components.codelist import QbCodeList +from csvcubed.models.cube.qb.components.datastructuredefinition import ( QbStructuralDefinition, ) +from csvcubed.models.cube.qb.components.dimension import QbDimension +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension +from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits from csvcubed.models.cube.qb.components.validationerrors import ( ConflictingUriSafeValuesError, EmptyQbMultiUnitsError, @@ -32,10 +22,20 @@ ) from csvcubed.models.cube.qb.validationerrors import ( AttributeNotLinkedError, + BothMeasureTypesDefinedError, + BothUnitTypesDefinedError, + CsvColumnUriTemplateMissingError, DuplicateMeasureError, + EmptyQbMultiMeasureDimensionError, HybridShapeError, LinkedObsColumnDoesntExistError, LinkedToNonObsColumnError, + MoreThanOneMeasureColumnError, + MoreThanOneUnitsColumnError, + NoDimensionsDefinedError, + NoMeasuresDefinedError, + NoObservedValuesColumnDefinedError, + NoUnitsDefinedError, PivotedObsValColWithoutMeasureError, PivotedShapeMeasureColumnsExistError, ) diff --git a/src/csvcubed/models/cube/qb/__init__.py b/src/csvcubed/models/cube/qb/__init__.py index 2ba1fe495..e69de29bb 100644 --- a/src/csvcubed/models/cube/qb/__init__.py +++ b/src/csvcubed/models/cube/qb/__init__.py @@ -1,4 +0,0 @@ -from .catalog import CatalogMetadata -from .columns import QbColumn -from .components import * -from .validationerrors import * diff --git a/src/csvcubed/models/cube/qb/components/__init__.py b/src/csvcubed/models/cube/qb/components/__init__.py index 5d3c25f0b..e69de29bb 100644 --- a/src/csvcubed/models/cube/qb/components/__init__.py +++ b/src/csvcubed/models/cube/qb/components/__init__.py @@ -1,28 +0,0 @@ -from .arbitraryrdf import RdfSerialisationHint -from .attribute import ( - ExistingQbAttribute, - ExistingQbAttributeLiteral, - NewQbAttribute, - NewQbAttributeLiteral, - QbAttribute, - QbAttributeLiteral, -) -from .attributevalue import NewQbAttributeValue -from .codelist import ( - CompositeQbCodeList, - ExistingQbCodeList, - NewQbCodeList, - NewQbCodeListInCsvW, - QbCodeList, -) -from .concept import DuplicatedQbConcept, ExistingQbConcept, NewQbConcept -from .datastructuredefinition import ( - QbColumnStructuralDefinition, - QbStructuralDefinition, -) -from .dimension import ExistingQbDimension, NewQbDimension, QbDimension -from .measure import ExistingQbMeasure, NewQbMeasure, QbMeasure -from .measuresdimension import QbMultiMeasureDimension -from .observedvalue import QbObservationValue -from .unit import ExistingQbUnit, NewQbUnit, QbUnit -from .unitscolumn import QbMultiUnits diff --git a/src/csvcubed/models/cube/qb/validationerrors.py b/src/csvcubed/models/cube/qb/validationerrors.py index c8508d2a4..a3d79fdc0 100644 --- a/src/csvcubed/models/cube/qb/validationerrors.py +++ b/src/csvcubed/models/cube/qb/validationerrors.py @@ -10,15 +10,14 @@ from dataclasses import dataclass, field from typing import List, Optional, Type, Union -from csvcubed.models.validationerror import SpecificValidationError - -from ..qb import ( - QbDimension, - QbMultiMeasureDimension, - QbMultiUnits, - QbObservationValue, +from csvcubed.models.cube.qb.components.datastructuredefinition import ( QbStructuralDefinition, ) +from csvcubed.models.cube.qb.components.dimension import QbDimension +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension +from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits +from csvcubed.models.validationerror import SpecificValidationError ComponentTypeDescription = Union[str, Type[QbStructuralDefinition]] diff --git a/tests/unit/cli/inspect/test_inspectdatasetmanager.py b/tests/unit/cli/inspect/test_inspectdatasetmanager.py index 073ae946d..8f679f32f 100644 --- a/tests/unit/cli/inspect/test_inspectdatasetmanager.py +++ b/tests/unit/cli/inspect/test_inspectdatasetmanager.py @@ -18,6 +18,7 @@ ) from csvcubed.models.csvwtype import CSVWType from csvcubed.models.cube.cube_shape import CubeShape +from csvcubed.models.cube.qb.validationerrors import BothMeasureTypesDefinedError from csvcubed.models.inspectdataframeresults import ( DatasetObservationsByMeasureUnitInfoResult, DatasetObservationsInfoResult, diff --git a/tests/unit/cli/inspect/test_metadataprinter.py b/tests/unit/cli/inspect/test_metadataprinter.py index ff0417fa5..57da98df1 100644 --- a/tests/unit/cli/inspect/test_metadataprinter.py +++ b/tests/unit/cli/inspect/test_metadataprinter.py @@ -4,6 +4,7 @@ from csvcubed.cli.inspect.metadataprinter import MetadataPrinter from csvcubed.models.csvwtype import CSVWType from csvcubed.models.cube.cube_shape import CubeShape +from csvcubed.models.cube.qb.validationerrors import BothMeasureTypesDefinedError from csvcubed.models.inspectdataframeresults import ( DatasetObservationsByMeasureUnitInfoResult, DatasetObservationsInfoResult, diff --git a/tests/unit/writers/skoscodelistwriter/test_skoscodelistwriter.py b/tests/unit/writers/skoscodelistwriter/test_skoscodelistwriter.py index 67eed6f4a..c19dd3729 100644 --- a/tests/unit/writers/skoscodelistwriter/test_skoscodelistwriter.py +++ b/tests/unit/writers/skoscodelistwriter/test_skoscodelistwriter.py @@ -8,7 +8,10 @@ RdfSerialisationHint, TripleFragment, ) -from csvcubed.models.cube.qb.components.codelist import NewQbCodeList +from csvcubed.models.cube.qb.components.codelist import ( + CompositeQbCodeList, + NewQbCodeList, +) from csvcubed.models.cube.qb.components.concept import NewQbConcept from csvcubed.models.cube.uristyle import URIStyle from csvcubed.writers.skoscodelistwriter import SkosCodeListWriter From 0ca38d34f4de62661431c8bbae2f557b2ce694d0 Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 08:46:08 +0000 Subject: [PATCH 2/8] f --- .../models/codelistconfig/code_list_config.py | 3 +- .../readers/cubeconfig/v1/columnschema.py | 28 ++++++++++--------- src/csvcubed/utils/qb/cube.py | 13 ++++----- src/csvcubed/utils/qb/standardise.py | 20 ++++++------- src/csvcubed/utils/qb/validation/cube.py | 5 ++-- src/csvcubed/writers/skoscodelistwriter.py | 2 +- 6 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/csvcubed/models/codelistconfig/code_list_config.py b/src/csvcubed/models/codelistconfig/code_list_config.py index e97f905fc..5bb2965de 100644 --- a/src/csvcubed/models/codelistconfig/code_list_config.py +++ b/src/csvcubed/models/codelistconfig/code_list_config.py @@ -12,8 +12,7 @@ from csvcubedmodels.dataclassbase import DataClassBase from csvcubed.models.cube.qb.catalog import CatalogMetadata -from csvcubed.models.cube.qb.components import NewQbConcept -from csvcubed.models.cube.qb.components.concept import DuplicatedQbConcept +from csvcubed.models.cube.qb.components.concept import DuplicatedQbConcept, NewQbConcept from csvcubed.readers.catalogmetadata.v1.catalog_metadata_reader import ( metadata_from_dict, ) diff --git a/src/csvcubed/readers/cubeconfig/v1/columnschema.py b/src/csvcubed/readers/cubeconfig/v1/columnschema.py index f7c48e924..e9708d374 100644 --- a/src/csvcubed/readers/cubeconfig/v1/columnschema.py +++ b/src/csvcubed/readers/cubeconfig/v1/columnschema.py @@ -19,28 +19,30 @@ from csvcubed.inputs import PandasDataTypes, pandas_input_to_columnar_optional_str from csvcubed.models.codelistconfig.code_list_config import CodeListConfig from csvcubed.models.cube.cube import CatalogMetadata -from csvcubed.models.cube.qb.components import ( - CompositeQbCodeList, - DuplicatedQbConcept, +from csvcubed.models.cube.qb.components.attribute import ( ExistingQbAttribute, ExistingQbAttributeLiteral, - ExistingQbCodeList, - ExistingQbDimension, - ExistingQbMeasure, - ExistingQbUnit, NewQbAttribute, NewQbAttributeLiteral, NewQbAttributeValue, +) +from csvcubed.models.cube.qb.components.codelist import ( + CompositeQbCodeList, + DuplicatedQbConcept, + ExistingQbCodeList, NewQbCodeList, - NewQbDimension, - NewQbMeasure, - NewQbUnit, QbCodeList, - QbMultiMeasureDimension, - QbMultiUnits, - QbObservationValue, ) from csvcubed.models.cube.qb.components.concept import NewQbConcept +from csvcubed.models.cube.qb.components.dimension import ( + ExistingQbDimension, + NewQbDimension, +) +from csvcubed.models.cube.qb.components.measure import ExistingQbMeasure, NewQbMeasure +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension +from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unit import ExistingQbUnit, NewQbUnit +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits from csvcubed.models.jsonvalidationerrors import JsonSchemaValidationError from csvcubed.readers.cubeconfig.utils import load_resource from csvcubed.utils.file import code_list_config_json_exists diff --git a/src/csvcubed/utils/qb/cube.py b/src/csvcubed/utils/qb/cube.py index 8e50d2e4f..001d0650b 100644 --- a/src/csvcubed/utils/qb/cube.py +++ b/src/csvcubed/utils/qb/cube.py @@ -9,20 +9,19 @@ from csvcubed.models.cube.cube import Cube from csvcubed.models.cube.cube_shape import CubeShape -from csvcubed.models.cube.qb.components import ( +from csvcubed.models.cube.qb.components.datastructuredefinition import ( QbColumnStructuralDefinition, - QbMeasure, - QbMultiMeasureDimension, - QbMultiUnits, - QbObservationValue, - QbUnit, ) +from csvcubed.models.cube.qb.components.measure import QbMeasure +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension +from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits, QbUnit _logger = logging.getLogger(__name__) QbColumnarDsdType = TypeVar("QbColumnarDsdType", bound=QbColumnStructuralDefinition) -"""Anything which inherits from :class:`ColumnarQbDataStructureDefinition +"""Anything which inherits from :class:`ColumnarQbDataStructureDefinition `.""" diff --git a/src/csvcubed/utils/qb/standardise.py b/src/csvcubed/utils/qb/standardise.py index dec2fa475..dc802eefc 100644 --- a/src/csvcubed/utils/qb/standardise.py +++ b/src/csvcubed/utils/qb/standardise.py @@ -10,18 +10,14 @@ from pandas.core.arrays.categorical import Categorical from csvcubed.models.cube.cube import QbColumn, QbCube -from csvcubed.models.cube.qb.components import ( - NewQbCodeList, - NewQbDimension, - NewQbMeasure, - NewQbUnit, - QbAttribute, - QbAttributeLiteral, - QbDimension, - QbMultiMeasureDimension, - QbMultiUnits, - QbObservationValue, -) +from csvcubed.models.cube.qb.components.attribute import QbAttribute, QbAttributeLiteral +from csvcubed.models.cube.qb.components.codelist import NewQbCodeList +from csvcubed.models.cube.qb.components.dimension import NewQbDimension, QbDimension +from csvcubed.models.cube.qb.components.measure import NewQbMeasure +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension +from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unit import NewQbUnit +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits from .cube import get_all_measures, get_all_units diff --git a/src/csvcubed/utils/qb/validation/cube.py b/src/csvcubed/utils/qb/validation/cube.py index 4fc8535ef..f817b7ffc 100644 --- a/src/csvcubed/utils/qb/validation/cube.py +++ b/src/csvcubed/utils/qb/validation/cube.py @@ -2,10 +2,9 @@ from csvcubed.models.cube.cube import Cube from csvcubed.models.cube.qb.columns import QbColumn -from csvcubed.models.cube.qb.components import ( +from csvcubed.models.cube.qb.components.attribute import QbAttribute, QbAttributeLiteral +from csvcubed.models.cube.qb.components.dimension import ( ExistingQbDimension, - QbAttribute, - QbAttributeLiteral, QbDimension, ) from csvcubed.models.cube.qb.validationerrors import ( diff --git a/src/csvcubed/writers/skoscodelistwriter.py b/src/csvcubed/writers/skoscodelistwriter.py index d815d3561..aeaca32b4 100644 --- a/src/csvcubed/writers/skoscodelistwriter.py +++ b/src/csvcubed/writers/skoscodelistwriter.py @@ -13,7 +13,7 @@ import pandas as pd from csvcubedmodels.rdf import ExistingResource -from csvcubed.models.cube.qb.components import ( +from csvcubed.models.cube.qb.components.codelist import ( CompositeQbCodeList, DuplicatedQbConcept, NewQbCodeList, From ebe8a8caba11b42d53b9047204b45f45078178a9 Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 08:57:24 +0000 Subject: [PATCH 3/8] f --- tests/unit/cube/qb/test_qb_dimension.py | 3 ++- tests/unit/cube/qb/test_qb_unit.py | 2 +- .../v1_0/test_cube_from_config_json.py | 26 +++++++++---------- .../v1_0/test_cube_from_convention.py | 17 +++++------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/tests/unit/cube/qb/test_qb_dimension.py b/tests/unit/cube/qb/test_qb_dimension.py index e76dbda8e..fce3207eb 100644 --- a/tests/unit/cube/qb/test_qb_dimension.py +++ b/tests/unit/cube/qb/test_qb_dimension.py @@ -1,6 +1,7 @@ import pandas as pd -from csvcubed.models.cube.qb.components import NewQbCodeList, NewQbDimension +from csvcubed.models.cube.qb.components.codelist import NewQbCodeList +from csvcubed.models.cube.qb.components.dimension import NewQbDimension def test_newqbdimension_extracts_newqbcodelist_newqbconcept(): diff --git a/tests/unit/cube/qb/test_qb_unit.py b/tests/unit/cube/qb/test_qb_unit.py index a12b67917..bc394633f 100644 --- a/tests/unit/cube/qb/test_qb_unit.py +++ b/tests/unit/cube/qb/test_qb_unit.py @@ -6,7 +6,7 @@ import pytest from csvcubed.definitions import APP_ROOT_DIR_PATH -from csvcubed.models.cube.qb import QbColumn +from csvcubed.models.cube.qb.columns import QbColumn from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue from csvcubed.models.cube.qb.components.unit import ExistingQbUnit, NewQbUnit from csvcubed.readers.cubeconfig.v1.columnschema import ( diff --git a/tests/unit/readers/cubeconfig/v1_0/test_cube_from_config_json.py b/tests/unit/readers/cubeconfig/v1_0/test_cube_from_config_json.py index 70627bc67..2c879ab46 100644 --- a/tests/unit/readers/cubeconfig/v1_0/test_cube_from_config_json.py +++ b/tests/unit/readers/cubeconfig/v1_0/test_cube_from_config_json.py @@ -10,33 +10,31 @@ from csvcubed.cli.build import build as cli_build from csvcubed.definitions import APP_ROOT_DIR_PATH from csvcubed.models.cube.cube import Cube -from csvcubed.models.cube.qb import QbColumn from csvcubed.models.cube.qb.catalog import CatalogMetadata -from csvcubed.models.cube.qb.components import ( - NewQbAttribute, - NewQbCodeList, - NewQbConcept, - NewQbDimension, - NewQbMeasure, - NewQbUnit, - QbMultiMeasureDimension, - QbMultiUnits, -) +from csvcubed.models.cube.qb.columns import QbColumn from csvcubed.models.cube.qb.components.attribute import ( ExistingQbAttribute, ExistingQbAttributeLiteral, + NewQbAttribute, NewQbAttributeLiteral, ) from csvcubed.models.cube.qb.components.attributevalue import NewQbAttributeValue from csvcubed.models.cube.qb.components.codelist import ( CompositeQbCodeList, ExistingQbCodeList, + NewQbCodeList, + NewQbConcept, ) from csvcubed.models.cube.qb.components.concept import DuplicatedQbConcept -from csvcubed.models.cube.qb.components.dimension import ExistingQbDimension -from csvcubed.models.cube.qb.components.measure import ExistingQbMeasure +from csvcubed.models.cube.qb.components.dimension import ( + ExistingQbDimension, + NewQbDimension, +) +from csvcubed.models.cube.qb.components.measure import ExistingQbMeasure, NewQbMeasure +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue -from csvcubed.models.cube.qb.components.unit import ExistingQbUnit +from csvcubed.models.cube.qb.components.unit import ExistingQbUnit, NewQbUnit +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits from csvcubed.readers.catalogmetadata.v1.catalog_metadata_reader import ( metadata_from_dict, ) diff --git a/tests/unit/readers/cubeconfig/v1_0/test_cube_from_convention.py b/tests/unit/readers/cubeconfig/v1_0/test_cube_from_convention.py index f797f2bf6..3d6bf81e8 100644 --- a/tests/unit/readers/cubeconfig/v1_0/test_cube_from_convention.py +++ b/tests/unit/readers/cubeconfig/v1_0/test_cube_from_convention.py @@ -12,18 +12,15 @@ from csvcubed.models.csvcubedexception import UnsupportedColumnDefinitionException from csvcubed.models.cube.columns import SuppressedCsvColumn from csvcubed.models.cube.cube import Cube -from csvcubed.models.cube.qb import QbColumn from csvcubed.models.cube.qb.catalog import CatalogMetadata -from csvcubed.models.cube.qb.components import ( - NewQbCodeList, - NewQbConcept, - NewQbDimension, - NewQbMeasure, - NewQbUnit, - QbMultiMeasureDimension, - QbMultiUnits, -) +from csvcubed.models.cube.qb.columns import QbColumn +from csvcubed.models.cube.qb.components.codelist import NewQbCodeList, NewQbConcept +from csvcubed.models.cube.qb.components.dimension import NewQbDimension +from csvcubed.models.cube.qb.components.measure import NewQbMeasure +from csvcubed.models.cube.qb.components.measuresdimension import QbMultiMeasureDimension from csvcubed.models.cube.qb.components.observedvalue import QbObservationValue +from csvcubed.models.cube.qb.components.unit import NewQbUnit +from csvcubed.models.cube.qb.components.unitscolumn import QbMultiUnits from csvcubed.readers.cubeconfig.v1.configdeserialiser import get_deserialiser from csvcubed.utils.iterables import first from tests.unit.test_baseunit import get_test_cases_dir From c20c5046ae2c905c2c6ee1099d90206bfed7a7ad Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 13:20:39 +0000 Subject: [PATCH 4/8] f --- tests/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index b5b0222cf..e69de29bb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,2 +0,0 @@ -from .behaviour import * -from .unit import * From 12f239e9948b616622b66af97f4c5e6ba90d71f4 Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 13:37:04 +0000 Subject: [PATCH 5/8] f --- src/csvcubed/__init__.py | 3 --- src/csvcubed/cli/entrypoint.py | 6 ++++-- src/csvcubed/utils/version.py | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/csvcubed/__init__.py b/src/csvcubed/__init__.py index d9208bc48..b3bd03767 100644 --- a/src/csvcubed/__init__.py +++ b/src/csvcubed/__init__.py @@ -1,6 +1,3 @@ -from importlib.metadata import version - -__version__ = version("csvcubed") """ __version__ is following pep-0396 guidance - https://peps.python.org/pep-0396/ The underlying value is set in `pyproject.toml`. diff --git a/src/csvcubed/cli/entrypoint.py b/src/csvcubed/cli/entrypoint.py index 7113852a9..24ec680c8 100644 --- a/src/csvcubed/cli/entrypoint.py +++ b/src/csvcubed/cli/entrypoint.py @@ -5,11 +5,13 @@ """ import logging import sys +from importlib.metadata import version from pathlib import Path import click -from csvcubed import __version__ +__version__ = version("csvcubed") + from csvcubed.cli.build import build from csvcubed.cli.inspect.inspect import inspect from csvcubed.models.errorurl import HasErrorUrl @@ -26,7 +28,7 @@ def entry_point(): @entry_point.command("version") -def version(): +def get_version(): """ Output the current version of csvcubed """ diff --git a/src/csvcubed/utils/version.py b/src/csvcubed/utils/version.py index c69948fae..315940df0 100644 --- a/src/csvcubed/utils/version.py +++ b/src/csvcubed/utils/version.py @@ -4,7 +4,9 @@ Utility to return csvcubed version specific infomation. """ -from csvcubed.__init__ import __version__ +from importlib.metadata import version + +__version__ = version("csvcubed") def get_csvcubed_version_uri(): From 02b1ef56beed4ee2932483d1e86c37a6d32358d2 Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:02:04 +0000 Subject: [PATCH 6/8] f --- src/csvcubed/__init__.py | 4 ---- src/csvcubed/models/rdf/__init__.py | 3 --- src/csvcubed/utils/__init__.py | 3 --- src/csvcubed/utils/qb/__init__.py | 3 --- src/csvcubed/utils/sparql_handler/__init__.py | 3 --- src/csvcubed/utils/validators/__init__.py | 3 --- src/csvcubed/writers/__init__.py | 6 ------ 7 files changed, 25 deletions(-) diff --git a/src/csvcubed/__init__.py b/src/csvcubed/__init__.py index b3bd03767..e69de29bb 100644 --- a/src/csvcubed/__init__.py +++ b/src/csvcubed/__init__.py @@ -1,4 +0,0 @@ -""" - __version__ is following pep-0396 guidance - https://peps.python.org/pep-0396/ - The underlying value is set in `pyproject.toml`. -""" diff --git a/src/csvcubed/models/rdf/__init__.py b/src/csvcubed/models/rdf/__init__.py index 3d7696f38..e69de29bb 100644 --- a/src/csvcubed/models/rdf/__init__.py +++ b/src/csvcubed/models/rdf/__init__.py @@ -1,3 +0,0 @@ -""" -Contains Models for mapping data to RDF which are unique to the `csvcubed` package. -""" diff --git a/src/csvcubed/utils/__init__.py b/src/csvcubed/utils/__init__.py index b5fe887cb..e69de29bb 100644 --- a/src/csvcubed/utils/__init__.py +++ b/src/csvcubed/utils/__init__.py @@ -1,3 +0,0 @@ -""" -General utility functions for the :mod:`csvcubed` project. -""" diff --git a/src/csvcubed/utils/qb/__init__.py b/src/csvcubed/utils/qb/__init__.py index c382c5331..e69de29bb 100644 --- a/src/csvcubed/utils/qb/__init__.py +++ b/src/csvcubed/utils/qb/__init__.py @@ -1,3 +0,0 @@ -""" -Utilities which are qb-specific. -""" diff --git a/src/csvcubed/utils/sparql_handler/__init__.py b/src/csvcubed/utils/sparql_handler/__init__.py index 783348f12..e69de29bb 100644 --- a/src/csvcubed/utils/sparql_handler/__init__.py +++ b/src/csvcubed/utils/sparql_handler/__init__.py @@ -1,3 +0,0 @@ -""" -General utility functions sparql query handling for the :mod:`csvcubed` project. -""" diff --git a/src/csvcubed/utils/validators/__init__.py b/src/csvcubed/utils/validators/__init__.py index 7e2ee3885..e69de29bb 100644 --- a/src/csvcubed/utils/validators/__init__.py +++ b/src/csvcubed/utils/validators/__init__.py @@ -1,3 +0,0 @@ -""" -pydantic validators for attributes on models. -""" diff --git a/src/csvcubed/writers/__init__.py b/src/csvcubed/writers/__init__.py index c3fab2e85..e69de29bb 100644 --- a/src/csvcubed/writers/__init__.py +++ b/src/csvcubed/writers/__init__.py @@ -1,6 +0,0 @@ -""" -Writers -------- - -Write to output formats like CSV-qb. -""" From 5a331c466a91fdcdfd45830a1482984249e3b2db Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:06:51 +0000 Subject: [PATCH 7/8] f --- src/csvcubed/__init__.py | 7 +++++++ src/csvcubed/cli/entrypoint.py | 6 ++---- src/csvcubed/readers/__init__.py | 6 ------ src/csvcubed/utils/version.py | 4 +--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/csvcubed/__init__.py b/src/csvcubed/__init__.py index e69de29bb..d9208bc48 100644 --- a/src/csvcubed/__init__.py +++ b/src/csvcubed/__init__.py @@ -0,0 +1,7 @@ +from importlib.metadata import version + +__version__ = version("csvcubed") +""" + __version__ is following pep-0396 guidance - https://peps.python.org/pep-0396/ + The underlying value is set in `pyproject.toml`. +""" diff --git a/src/csvcubed/cli/entrypoint.py b/src/csvcubed/cli/entrypoint.py index 24ec680c8..7113852a9 100644 --- a/src/csvcubed/cli/entrypoint.py +++ b/src/csvcubed/cli/entrypoint.py @@ -5,13 +5,11 @@ """ import logging import sys -from importlib.metadata import version from pathlib import Path import click -__version__ = version("csvcubed") - +from csvcubed import __version__ from csvcubed.cli.build import build from csvcubed.cli.inspect.inspect import inspect from csvcubed.models.errorurl import HasErrorUrl @@ -28,7 +26,7 @@ def entry_point(): @entry_point.command("version") -def get_version(): +def version(): """ Output the current version of csvcubed """ diff --git a/src/csvcubed/readers/__init__.py b/src/csvcubed/readers/__init__.py index 94c4ebd4e..e69de29bb 100644 --- a/src/csvcubed/readers/__init__.py +++ b/src/csvcubed/readers/__init__.py @@ -1,6 +0,0 @@ -""" -Readers -------- - -Read from the outputs generated by this tool (e.g. CSV-W skos codelists or CSV-qbs). -""" diff --git a/src/csvcubed/utils/version.py b/src/csvcubed/utils/version.py index 315940df0..c69948fae 100644 --- a/src/csvcubed/utils/version.py +++ b/src/csvcubed/utils/version.py @@ -4,9 +4,7 @@ Utility to return csvcubed version specific infomation. """ -from importlib.metadata import version - -__version__ = version("csvcubed") +from csvcubed.__init__ import __version__ def get_csvcubed_version_uri(): From 795076410ec0419f1274940e7a44899311c6de8f Mon Sep 17 00:00:00 2001 From: Jozsef K <43893201+nimshi89@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:23:44 +0000 Subject: [PATCH 8/8] put the requested changes back --- src/csvcubed/models/rdf/__init__.py | 3 +++ src/csvcubed/readers/__init__.py | 6 ++++++ src/csvcubed/utils/__init__.py | 3 +++ src/csvcubed/utils/qb/__init__.py | 3 +++ src/csvcubed/utils/sparql_handler/__init__.py | 3 +++ src/csvcubed/utils/validators/__init__.py | 3 +++ src/csvcubed/writers/__init__.py | 6 ++++++ 7 files changed, 27 insertions(+) diff --git a/src/csvcubed/models/rdf/__init__.py b/src/csvcubed/models/rdf/__init__.py index e69de29bb..3d7696f38 100644 --- a/src/csvcubed/models/rdf/__init__.py +++ b/src/csvcubed/models/rdf/__init__.py @@ -0,0 +1,3 @@ +""" +Contains Models for mapping data to RDF which are unique to the `csvcubed` package. +""" diff --git a/src/csvcubed/readers/__init__.py b/src/csvcubed/readers/__init__.py index e69de29bb..94c4ebd4e 100644 --- a/src/csvcubed/readers/__init__.py +++ b/src/csvcubed/readers/__init__.py @@ -0,0 +1,6 @@ +""" +Readers +------- + +Read from the outputs generated by this tool (e.g. CSV-W skos codelists or CSV-qbs). +""" diff --git a/src/csvcubed/utils/__init__.py b/src/csvcubed/utils/__init__.py index e69de29bb..b5fe887cb 100644 --- a/src/csvcubed/utils/__init__.py +++ b/src/csvcubed/utils/__init__.py @@ -0,0 +1,3 @@ +""" +General utility functions for the :mod:`csvcubed` project. +""" diff --git a/src/csvcubed/utils/qb/__init__.py b/src/csvcubed/utils/qb/__init__.py index e69de29bb..c382c5331 100644 --- a/src/csvcubed/utils/qb/__init__.py +++ b/src/csvcubed/utils/qb/__init__.py @@ -0,0 +1,3 @@ +""" +Utilities which are qb-specific. +""" diff --git a/src/csvcubed/utils/sparql_handler/__init__.py b/src/csvcubed/utils/sparql_handler/__init__.py index e69de29bb..783348f12 100644 --- a/src/csvcubed/utils/sparql_handler/__init__.py +++ b/src/csvcubed/utils/sparql_handler/__init__.py @@ -0,0 +1,3 @@ +""" +General utility functions sparql query handling for the :mod:`csvcubed` project. +""" diff --git a/src/csvcubed/utils/validators/__init__.py b/src/csvcubed/utils/validators/__init__.py index e69de29bb..7e2ee3885 100644 --- a/src/csvcubed/utils/validators/__init__.py +++ b/src/csvcubed/utils/validators/__init__.py @@ -0,0 +1,3 @@ +""" +pydantic validators for attributes on models. +""" diff --git a/src/csvcubed/writers/__init__.py b/src/csvcubed/writers/__init__.py index e69de29bb..c3fab2e85 100644 --- a/src/csvcubed/writers/__init__.py +++ b/src/csvcubed/writers/__init__.py @@ -0,0 +1,6 @@ +""" +Writers +------- + +Write to output formats like CSV-qb. +"""