- Python 3.7 or higher installed
- .NET SDK for building C# binaries or .NET Runtime to run them
- Hatch for Python environment and package management
Clone the Python-Docx-Redlines repository to your local
machine. Use Git to clone the repository using the following command:
git clone https://github.com/JSv4/Python-Docx-Redlines
cd python-docx-redlinesIf Hatch is not already installed, install it using pip:
pip install hatch hatchlingInside the project directory, create a virtual environment using Hatch:
hatch env createActivate the virtual environment:
hatch shellInstall the necessary Python dependencies:
pip install .[dev]You can use the binaries distributed with the project, or, if you want to build new binaries for some reason, you can use our build script, integrated as a hatch tool.
hatch run buildWe're just using dotnet to build binaries for Program.cs, a command line utility that exposes
WmlComparer's redlining capabilities. We are currently target win-x64 and linux-x64 builds, but any runtime
supported by .NET is theoretically supported.
Our build script does the following:
- Build a binary for Linux:
dotnet publish -c Release -r linux-x64 --self-contained- Build a binary for Windows:
dotnet publish -c Release -r win-x64 --self-contained- Build a binary for MacOS:
dotnet publish -c Release -r osx-x64 --self-contained- Archive and package binaries into
./dist/:
To ensure everything is set up correctly and working as expected, run the tests included in the tests/ directory.
Execute the tests using pytest:
pytestThis will run all the test cases defined in your test files.
You've now set up the Python-Docx-Redlines project, built the necessary C# binaries, and learned how to use the Python wrapper to compare .docx files. Running the tests ensures that your setup is correct and the wrapper functions as expected.