From ac811692902ff606395977825f51f2255a30fe18 Mon Sep 17 00:00:00 2001 From: Andrea Ghensi Date: Sun, 19 Feb 2023 17:36:54 +0100 Subject: [PATCH] build(bcf): remove conda dependency --- src/bcf/Makefile | 24 ++-------------------- src/bcf/environment.yml | 7 ------- src/bcf/pyproject.toml | 29 ++++++++++++++++++++------- src/bcf/requirements-dev.txt | 1 - src/bcf/src/bcf/bcfxml.py | 2 +- src/bcf/src/bcf/v2/topic.py | 4 ++-- src/bcf/src/bcf/v3/topic.py | 4 +++- src/bcf/tests/v2/test_ifcclash_api.py | 2 +- src/bcf/tests/v3/test_ifcclash_api.py | 2 +- 9 files changed, 32 insertions(+), 43 deletions(-) delete mode 100644 src/bcf/environment.yml diff --git a/src/bcf/Makefile b/src/bcf/Makefile index 2baaaac259..3a3913b971 100644 --- a/src/bcf/Makefile +++ b/src/bcf/Makefile @@ -1,31 +1,11 @@ -.PHONY: test -test: +.PHONY: ci +ci: tox -.PHONY: qa -qa: - black . - isort . - pylint ./src --output-format=colorized - -.PHONY: typecheck -typecheck: - mypy src/bcf - .PHONY: license license: copyright-header --license LGPL3 --copyright-holder "Andrea Ghensi " --copyright-year "2022" --copyright-software "IfcOpenShell" --copyright-software-description "BCF XML file handling" -a ./ -o ./ -.PHONY: coverage -coverage: - coverage run --source bcf -m pytest tests - coverage html - xdg-open htmlcov/index.html - -.PHONY: clean -clean: - rm -rf htmlcov - # TODO: make this based on xsd file presence .PHONY: models models: diff --git a/src/bcf/environment.yml b/src/bcf/environment.yml deleted file mode 100644 index 01fe5b7a8c..0000000000 --- a/src/bcf/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: bcf-client -channels: - - conda-forge -dependencies: - - ifcopenshell - - xsdata - - numpy diff --git a/src/bcf/pyproject.toml b/src/bcf/pyproject.toml index 49ce8c4ecb..6ca7d94c7d 100644 --- a/src/bcf/pyproject.toml +++ b/src/bcf/pyproject.toml @@ -15,6 +15,7 @@ keywords = ["IFC", "BCF", "BIM", "eingineering"] dependencies = [ "xsdata", "numpy", + "ifcopenshell", ] version = "0.0.1" classifiers = [ @@ -58,20 +59,34 @@ exclude_lines = [ [tool.tox] legacy_tox_ini = """ [tox] -envlist = py310 -isolated_build = true +env_list = lint, type, py3{10,11} skip_missing_interpreters = true -requires = tox-conda [testenv] -conda_deps = +deps = pytest pytest-cov coverage -conda_channels = - conda-forge -conda_env = environment.yml commands = pytest --cov --cov-report=term tests + +[testenv:lint] +description = run linters +skip_install = true +deps = + black + isort + pylint +commands = + black {posargs:.} + isort {posargs:.} + pylint {posargs:.} --output-format=colorized + +[testenv:type] +description = run type checks +deps = + mypy>=0.991 +commands = + - mypy {posargs:src} """ [tool.mypy] diff --git a/src/bcf/requirements-dev.txt b/src/bcf/requirements-dev.txt index b895025a91..9169ee6a0c 100644 --- a/src/bcf/requirements-dev.txt +++ b/src/bcf/requirements-dev.txt @@ -4,4 +4,3 @@ pylint isort xsdata tox==3.27.1 -tox-conda diff --git a/src/bcf/src/bcf/bcfxml.py b/src/bcf/src/bcf/bcfxml.py index 33c5b03b96..d54e7a1482 100644 --- a/src/bcf/src/bcf/bcfxml.py +++ b/src/bcf/src/bcf/bcfxml.py @@ -23,8 +23,8 @@ from pathlib import Path from typing import Optional, Union from bcf.v2.bcfxml import BcfXml as BcfXml2 -from bcf.v3.bcfxml import BcfXml as BcfXml3 from bcf.v2.model import Version as Version2 +from bcf.v3.bcfxml import BcfXml as BcfXml3 from bcf.v3.model import Version as Version3 from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer diff --git a/src/bcf/src/bcf/v2/topic.py b/src/bcf/src/bcf/v2/topic.py index 806d445bb0..87cea5744a 100644 --- a/src/bcf/src/bcf/v2/topic.py +++ b/src/bcf/src/bcf/v2/topic.py @@ -1,8 +1,8 @@ """BCF XML V2 Topic handler.""" +import datetime +import tempfile import uuid import zipfile -import tempfile -import datetime from pathlib import Path from typing import Any, NoReturn, Optional diff --git a/src/bcf/src/bcf/v3/topic.py b/src/bcf/src/bcf/v3/topic.py index 188a4b3f81..71550505ca 100644 --- a/src/bcf/src/bcf/v3/topic.py +++ b/src/bcf/src/bcf/v3/topic.py @@ -190,7 +190,9 @@ class TopicHandler: self.viewpoints[new_viewpoint.guid + ".bcfv"] = new_viewpoint if self.topic.viewpoints is None: self.topic.viewpoints = mdl.TopicViewpoints() - self.topic.viewpoints.view_point.append(mdl.ViewPoint(viewpoint=new_viewpoint.guid + ".bcfv", guid=new_viewpoint.guid)) + self.topic.viewpoints.view_point.append( + mdl.ViewPoint(viewpoint=new_viewpoint.guid + ".bcfv", guid=new_viewpoint.guid) + ) def __eq__(self, other: object) -> bool | NoReturn: return ( diff --git a/src/bcf/tests/v2/test_ifcclash_api.py b/src/bcf/tests/v2/test_ifcclash_api.py index d6adf29bce..14945e8392 100644 --- a/src/bcf/tests/v2/test_ifcclash_api.py +++ b/src/bcf/tests/v2/test_ifcclash_api.py @@ -15,7 +15,7 @@ def test_create_clash_set_bcf() -> None: assert len(topic.viewpoints) == 1 guid, vi_handler = next((k, v) for k, v in topic.viewpoints.items()) v_info = vi_handler.visualization_info - assert v_info.guid == guid + assert f"{v_info.guid}.bcfv" == guid components = v_info.components.selection.component assert {c.ifc_guid for c in components} == {"firstId", "secondId"} camera = v_info.perspective_camera diff --git a/src/bcf/tests/v3/test_ifcclash_api.py b/src/bcf/tests/v3/test_ifcclash_api.py index f5c2658208..d470f1ffb8 100644 --- a/src/bcf/tests/v3/test_ifcclash_api.py +++ b/src/bcf/tests/v3/test_ifcclash_api.py @@ -15,7 +15,7 @@ def test_create_clash_set_bcf() -> None: assert len(topic.viewpoints) == 1 guid, vi_handler = next((k, v) for k, v in topic.viewpoints.items()) v_info = vi_handler.visualization_info - assert v_info.guid == guid + assert f"{v_info.guid}.bcfv" == guid components = v_info.components.selection.component assert {c.ifc_guid for c in components} == {"firstId", "secondId"} camera = v_info.perspective_camera