brunopostle / ifcmerge

A three-way-merge tool for IFC files
73 stars 6 forks source link

Any plans to port to Python ? #5

Open luzpaz opened 1 year ago

luzpaz commented 1 year ago

Perl is awesome. The issue is the need to support the perl interpreter as a 3rd party dependency.

Thanks for the amazing work on this!

brunopostle commented 1 year ago

I started writing it in python, but realised I needed some advanced regular expression stuff that I knew how to do in perl.

ifcmerge isn't very complex, I'm sure it can be rewritten in python, contributions welcome.

Though importantly git requires that a mergetool is an executable, so on Windows it needs to be an EXE file (which I can do with perl, not sure about python). The Perl version doesn't have any dependencies, so it will run on any machine with perl, ie. Linux and OSX, without any problems.

luzpaz commented 1 year ago

Thanks for the reply. Perl does indeed have some awesome regex functionality.

Just a quick search returns https://www.tomshardware.com/how-to/create-python-executable-applications
(Note: I don't have experience with it)

Martin15135215 commented 1 year ago

I have had some experience with pyinstaller, the only disadvantage I see is that the exe can get a very large file size, since it just an script with the whole python interpreter and all the deps in one file...

PyInstaller reads a Python script written by you. It analyzes your code to discover every other module and library your script needs in order to execute. Then it collects copies of all those files – including the active Python interpreter! – and puts them with your script in a single folder, or optionally in a single executable file.

Source: https://pyinstaller.org/en/stable/operating-mode.html

Martin15135215 commented 1 year ago

@brunopostle Did you use the standard module re

This module provides regular expression matching operations similar to those found in Perl.

Source: https://docs.python.org/3/library/re.html

I don't know any perl, however i learnt doing regex with the re module with this beginner tutorial https://automatetheboringstuff.com/2e/chapter7/

That might help

brunopostle commented 1 year ago

It looks like there is no significant difference between installing a perl or python version (the current windows EXE bundles a perl interpreter just as a python version would need to bundle a python interpreter).

Python is much better understood by people who might want to work on these tools, so switching would be a good thing, but somebody would need to contribute this (and check it is as fast, perl text handling is very efficient).