bSDD workflow now uses VERSION

This commit is contained in:
Dion Moult
2024-06-12 18:44:51 +10:00
parent 6474552649
commit d192217e78
5 changed files with 88 additions and 67 deletions
-13
View File
@@ -1,21 +1,8 @@
name: ci-bsdd-pypi name: ci-bsdd-pypi
on: on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# * * * * *
- cron: "0 0 18 * *"
workflow_dispatch: workflow_dispatch:
env:
major: 0
minor: 0
name: ifcopenshell
jobs: jobs:
activate: activate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
+7 -3
View File
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with bSDD. If not, see <http://www.gnu.org/licenses/>. # along with bSDD. If not, see <http://www.gnu.org/licenses/>.
VERSION:=`date '+%y%m%d'` VERSION:=$(shell cat ../../VERSION)
SED:=sed -i SED:=sed -i
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
SED:=sed -i '' -e SED:=sed -i '' -e
@@ -29,6 +29,10 @@ test:
.PHONY: dist .PHONY: dist
dist: dist:
rm -rf dist rm -rf dist
$(SED) "s/999999/$(VERSION)/" pyproject.toml cp pyproject.toml pyproject.toml.bak
cp bsdd.py bsdd.py.bak
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' bsdd.py
python -m build python -m build
$(SED) "s/$(VERSION)/999999/" pyproject.toml mv pyproject.toml.bak pyproject.toml
mv bsdd.py.bak bsdd.py
-1
View File
@@ -1 +0,0 @@
from .bsdd import *
+69 -34
View File
@@ -25,6 +25,9 @@ import webbrowser
import http.server import http.server
from typing import TypedDict, Literal, Optional from typing import TypedDict, Literal, Optional
__version__ = version = "0.0.0"
Status = Literal["Preview", "Active", "Inactive"] Status = Literal["Preview", "Active", "Inactive"]
ClassTypes = Literal["Class", "GroupOfProperties", "AlternativeUse", "Material"] ClassTypes = Literal["Class", "GroupOfProperties", "AlternativeUse", "Material"]
@@ -517,14 +520,16 @@ class Client:
# deprecated # deprecated
def Property(self, namespaceUri, version="v2", languageCode=""): def Property(self, namespaceUri, version="v2", languageCode=""):
print(f"function 'Client.Property' is deprecated, use 'Client.get_property' instead") print(f"function 'Client.Property' is deprecated, use 'Client.get_property' instead")
return self._get_deprecated(f"api/Property/{version}", return self._get_deprecated(
{"namespaceUri": namespaceUri, "languageCode": languageCode}) f"api/Property/{version}", {"namespaceUri": namespaceUri, "languageCode": languageCode}
)
# deprecated # deprecated
def PropertyValue(self, namespaceUri, version="v1", languageCode=""): def PropertyValue(self, namespaceUri, version="v1", languageCode=""):
print(f"function 'Client.PropertyValue' is deprecated, use 'Client.get_property_value' instead") print(f"function 'Client.PropertyValue' is deprecated, use 'Client.get_property_value' instead")
return self._get_deprecated(f"api/PropertyValue/{version}", return self._get_deprecated(
{"namespaceUri": namespaceUri, "languageCode": languageCode}) f"api/PropertyValue/{version}", {"namespaceUri": namespaceUri, "languageCode": languageCode}
)
# deprecated # deprecated
def ReferenceDocument(self, version="v1"): def ReferenceDocument(self, version="v1"):
@@ -574,9 +579,16 @@ class Client:
} }
return self.get(endpoint, params) return self.get(endpoint, params)
def get_classes(self, dictionary_uri: str, use_nested_classes: bool = True, def get_classes(
class_type: ClassTypes = "Class", self,
language_code: str = "", version: int = 1, offset=0, limit=1000) -> DictionaryClassesResponseContractV1: dictionary_uri: str,
use_nested_classes: bool = True,
class_type: ClassTypes = "Class",
language_code: str = "",
version: int = 1,
offset=0,
limit=1000,
) -> DictionaryClassesResponseContractV1:
""" """
Get Dictionary with tree of classes Get Dictionary with tree of classes
This API replaces Domain This API replaces Domain
@@ -587,29 +599,32 @@ class Client:
"UseNestedClasses": use_nested_classes, "UseNestedClasses": use_nested_classes,
"ClassType": class_type, "ClassType": class_type,
"languageCode": language_code, "languageCode": language_code,
"offset" : offset, "offset": offset,
"limit" : limit "limit": limit,
} }
return self.get(endpoint, params) return self.get(endpoint, params)
def get_properties(self, dictionary_uri: str, offset: int = 0, limit: int = 100, language_code: str = "", def get_properties(
version: int = 1) -> DictionaryPropertiesResponseContractV1: self, dictionary_uri: str, offset: int = 0, limit: int = 100, language_code: str = "", version: int = 1
) -> DictionaryPropertiesResponseContractV1:
""" """
Get Dictionary with its properties Get Dictionary with its properties
""" """
endpoint = f"Dictionary/v{version}/Properties" endpoint = f"Dictionary/v{version}/Properties"
params = { params = {"Uri": dictionary_uri, "languageCode": language_code, "offset": offset, "limit": limit}
"Uri": dictionary_uri,
"languageCode": language_code,
"offset": offset,
"limit": limit
}
return self.get(endpoint, params) return self.get(endpoint, params)
def get_class(self, class_uri: str, include_class_properties: bool = True, def get_class(
include_child_class_reference: bool = True, include_class_relations: bool = True, self,
include_reverse_relations: bool = False, reverse_relation_dictionary_uris: Optional[list[str]]=None, class_uri: str,
language_code: str = "", version: int = 1) -> ClassContractV1: include_class_properties: bool = True,
include_child_class_reference: bool = True,
include_class_relations: bool = True,
include_reverse_relations: bool = False,
reverse_relation_dictionary_uris: Optional[list[str]] = None,
language_code: str = "",
version: int = 1,
) -> ClassContractV1:
""" """
Get Class details Get Class details
this API replaces Classification this API replaces Classification
@@ -627,8 +642,7 @@ class Client:
params = {k: v for k, v in params.items() if v is not None} params = {k: v for k, v in params.items() if v is not None}
return self.get(endpoint, params) return self.get(endpoint, params)
def get_property(self, uri, include_classes=False, language_code="", def get_property(self, uri, include_classes=False, language_code="", version: int = 4) -> PropertyContractV4:
version: int = 4) -> PropertyContractV4:
""" """
Get Property Detail Get Property Detail
this API replaces Property this API replaces Property
@@ -654,8 +668,15 @@ class Client:
} }
return self.get(endpoint, params) return self.get(endpoint, params)
def search_text(self, search_text: str, type_filter="All", dictionary_uris=None, def search_text(
version: int = 1, offset: int = 0, limit: int = 100) -> TextSearchResponseContractV1: self,
search_text: str,
type_filter="All",
dictionary_uris=None,
version: int = 1,
offset: int = 0,
limit: int = 100,
) -> TextSearchResponseContractV1:
""" """
Search the bSDD database using free text, get list of Classes and/or Properties matching the text. Search the bSDD database using free text, get list of Classes and/or Properties matching the text.
Pagination options are for Classes and Properties combined. Pagination options are for Classes and Properties combined.
@@ -670,14 +691,21 @@ class Client:
"TypeFilter": type_filter, "TypeFilter": type_filter,
"DictionaryUris": dictionary_uris, "DictionaryUris": dictionary_uris,
"offset": offset, "offset": offset,
"limit": limit "limit": limit,
} }
return self.get(endpoint, params) return self.get(endpoint, params)
pass pass
def search_in_dictionary(self, dictionary_uri: str, search_text: str = "", language_code: str = "", def search_in_dictionary(
related_ifc_entity: str = "", self,
version: int = 1, offset: int = 0, limit: int = 100) -> SearchInDictionaryResponseContractV1: dictionary_uri: str,
search_text: str = "",
language_code: str = "",
related_ifc_entity: str = "",
version: int = 1,
offset: int = 0,
limit: int = 100,
) -> SearchInDictionaryResponseContractV1:
""" """
Search the bSDD database, get list of Classes without details. Search the bSDD database, get list of Classes without details.
This version uses new naming and returns one Dictionary instead of a list with always one Dictionary. This version uses new naming and returns one Dictionary instead of a list with always one Dictionary.
@@ -690,12 +718,19 @@ class Client:
"LanguageCode": language_code, "LanguageCode": language_code,
"RelatedIfcEntity": related_ifc_entity, "RelatedIfcEntity": related_ifc_entity,
"offset": offset, "offset": offset,
"limit": limit "limit": limit,
} }
return self.get(endpoint, params) return self.get(endpoint, params)
def search_class(self, search_text: str, dictionary_uris=None, related_ifc_entities=None, def search_class(
version: int = 1, offset: int = 0, limit: int = 100) -> ClassSearchResponseContractV1: self,
search_text: str,
dictionary_uris=None,
related_ifc_entities=None,
version: int = 1,
offset: int = 0,
limit: int = 100,
) -> ClassSearchResponseContractV1:
""" """
Search the bSDD database using free text, get list of Classes matching the text and optional additional filters. Search the bSDD database using free text, get list of Classes matching the text and optional additional filters.
this API replaces ClassificationSearch this API replaces ClassificationSearch
@@ -711,13 +746,13 @@ class Client:
"DictionaryUris": dictionary_uris, "DictionaryUris": dictionary_uris,
"RelatedIfcEntities": related_ifc_entities, "RelatedIfcEntities": related_ifc_entities,
"offset": offset, "offset": offset,
"limit": limit "limit": limit,
} }
return self.get(endpoint, params) return self.get(endpoint, params)
def get_countries(self, version: int = 1) -> list[CountryContractV1]: def get_countries(self, version: int = 1) -> list[CountryContractV1]:
""" """
Get list of all Countries Get list of all Countries
this API replaces Country this API replaces Country
""" """
endpoint = f"Country/v{version}" endpoint = f"Country/v{version}"
+12 -16
View File
@@ -1,21 +1,20 @@
[build-system] [build-system]
requires = ["hatchling"] requires = ["setuptools>=61.0"]
build-backend = "hatchling.build" build-backend = "setuptools.build_meta"
[project] [project]
name = "bsdd" name = "bsdd"
version = "0.0.999999" version = "0.0.0"
authors = [ authors = [
{ name="Dion Moult", email="dion@thinkmoult.com" }, { name="Dion Moult", email="dion@thinkmoult.com" },
] ]
description = "Library to interact with the buildingSMART Data Dictionary" description = "Library to interact with the buildingSMART Data Dictionary"
readme = "README.md" readme = "README.md"
requires-python = ">=3.8" requires-python = ">=3.9"
keywords = ["IFC", "bSDD", "BIM"] keywords = ["IFC", "bSDD", "BIM"]
classifiers = [ classifiers = [
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
@@ -26,19 +25,16 @@ classifiers = [
] ]
dependencies = ["requests"] dependencies = ["requests"]
[project.optional-dependencies]
dev = [
"coverage[toml]>=6.5",
"pytest",
]
[project.urls] [project.urls]
Homepage = "http://ifcopenshell.org" Homepage = "http://ifcopenshell.org"
Documentation = "https://docs.ifcopenshell.org" Documentation = "https://docs.ifcopenshell.org"
Issues = "https://github.com/IfcOpenShell/IfcOpenShell/issues" Issues = "https://github.com/IfcOpenShell/IfcOpenShell/issues"
[tool.hatch.envs.default] [tool.setuptools]
dependencies = [ py-modules = ["bsdd"]
"coverage[toml]>=6.5",
"pytest",
]
[[tool.hatch.envs.all.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
[tool.pytest.ini_options]
pythonpath = [".", "src"]