Skip to content

Commit 005c2d3

Browse files
committed
pip install setup
1 parent fac7b71 commit 005c2d3

File tree

5 files changed

+60
-4
lines changed

5 files changed

+60
-4
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include file_converters/ifcjson *

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
# IFC2JSON_python
2+
23
Python converter from IFC SPF to JSON
34

45
# Getting Started
56

67
## Requirements
8+
79
- ifcopenshell (using conda or in folder ./ifcopenshell)
810

911
## Installation ifcopenshell using Conda
1012

11-
1. Download the Conda installer for your OS setup. https://docs.conda.io/en/latest/miniconda.html
13+
1. Download the Conda installer for your OS setup. <https://docs.conda.io/en/latest/miniconda.html>
1214
2. After installing Conda, create an environment for IFC.JSON with:
15+
1316
```
1417
conda create --name ifcjson
1518
```
19+
1620
3. Then activate the new environment:
21+
1722
```
1823
conda activate ifcjson
1924
```
25+
2026
4. Install ifcopenshell from conda-forge:
27+
2128
```
2229
conda install -c conda-forge ifcopenshell
2330
```
2431
2532
## Installation ifcopenshell from direct download
26-
Download a recent copy of ifcopenshell from: https://builds.ifcopenshell.org/
33+
34+
Download a recent copy of ifcopenshell from: <https://builds.ifcopenshell.org/>
2735
2836
## Usage
37+
2938
```
3039
python ifc2json.py -i model.ifc -o model_-_ifcjson4.json -v 4
3140
```
41+
3242
```
3343
optional arguments:
3444
-h, --help show this help message and exit
@@ -37,6 +47,20 @@ optional arguments:
3747
-v V IFC.JSON version, options: "4"(default), "5a"
3848
```
3949
50+
## Importing as a Python package
51+
52+
```bash
53+
pip install git+<https://github.com/IFCJSON-Team/IFC2JSON_python.git>
54+
```
55+
56+
After installing with pip, you can import the package in your Python code:
57+
58+
```python
59+
from ifcjson import ifc2json4, ifc2json5a, mesh, reader, to_ifcopenshell, common
60+
# Example usage:
61+
# from ifcjson.ifc2json4 import some_function
62+
```
63+
4064
## Additional Requirements for Roundtrip and IFC.JSON → IFC SPF Conversion
4165

4266
- The roundtrip tests and the conversion from IFC.JSON to IFC SPF require the `pandas` library.
@@ -63,7 +87,7 @@ This keeps the minimal install lightweight for users who only need IFC → JSON
6387

6488
# Running Tests
6589

66-
A test converting a set of sample files is provided to verify the roundtrip conversion from IFC to JSON and back.
90+
A test converting a set of sample files is provided to verify the roundtrip conversion from IFC to JSON and back.
6791
This test will process all `.ifc` files in `samples/input/`, write results to `samples/output/`, and check the validity of the conversion.
6892

6993
To run the test, use the following command from your project root:
@@ -76,4 +100,4 @@ python -m unittest file_converters/tests/test_samples.py
76100
- The test checks for required keys and schema version in the generated JSON files.
77101
- Make sure your input files are placed in `samples/input/`.
78102
79-
---
103+
---

file_converters/__init__.py

Whitespace-only changes.

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ifc2json"
7+
version = "0.1.0"
8+
description = "A tool to convert IFC files to JSON and back."
9+
authors = [
10+
{ name="Jan Brouwer", email="jan@brewsky.nl" }
11+
]
12+
readme = "README.md"
13+
requires-python = ">=3.7"
14+
dependencies = ["ifcopenshell","pandas"]
15+
16+
[project.urls]
17+
"Homepage" = "https://github.com/IFCJSON-Team/IFC2JSON_python"

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="ifc2json",
5+
version="0.1.0",
6+
description="A tool to convert IFC files to JSON and back.",
7+
author="Jan Brouwer",
8+
author_email="jan@brewsky.nl",
9+
packages=find_packages(where="file_converters"),
10+
package_dir={"": "file_converters"},
11+
include_package_data=True,
12+
install_requires=["ifcopenshell","pandas"],
13+
python_requires=">=3.7",
14+
)

0 commit comments

Comments
 (0)