Skip to content

Latest commit

 

History

History
116 lines (77 loc) · 3.16 KB

BUILD.md

File metadata and controls

116 lines (77 loc) · 3.16 KB

Building

The build process should be fairly familiar.

Windows

  1. Ensure you have the required dependencies:

    Only Python 3.8 can be used currently, as the local dependencies are built for 3.8 Windows x64. They are provided by Christoph Gohlke here.

  2. Create and activate a virtual environment to install into, any should do. Here we use virtualenv:

python3 -m venv spgr

.\spgr\Scripts\activate.bat
  1. Clone the repository. There are some data files that are stored in git LFS, so we ensure that the hooks are installed first, then git clone is able to download both sets of files.
git lfs install
git clone https://github.com/aliaksei135/seedpod_ground_risk.git
  1. Install requirements
cd seedpod_ground_risk
pip install -r requirements.txt

Linux

  1. Install dependencies
sudo apt install libgeos-dev libgdal-dev proj-bin libbz2-dev
  1. Create and activate a virtual environment, any should do. Here we use virtualenv:
python -m venv spgr
source spgr/bin/activate
  1. Clone the repository. There are some data files that are stored in git LFS, so we ensure that the hooks are installed first, then git clone is able to download both sets of files.
git lfs install
git clone https://github.com/aliaksei135/seedpod_ground_risk.git
  1. Install requirements
cd seedpod_ground_risk
pip install -r requirements-linux.txt

This is enough to run and develop on.

Packaging

There are 2 available packaging formats: Installer or wheel. The former is what is distributed, while the latter is required for use of the CLI for instance.

When packaging don't forget to check versions in both setup.py and make_installer.iss and ensure they match!

Installer

Currently, this is only supported on Windows.

The installer uses PyInstaller to extract all the dependencies and InnoSetup to create a Windows installer package out of them.

  1. Ensure you have installed InnoSetup here.

  2. Inside the root repository directory with the virtualenv active:

python -O -m PyInstaller --noconfirm "SEEDPOD Ground Risk.spec"

We run python with the first level optimise flag -O to slim down some now unnecessary debug code. Do not use second level optimisation -OO, as this removes some docstrings that break dependencies.

  1. Open make_installer.iss in InnoSetup and run the packaging process. This can take a while, but should output an installer in the Output folder.

Wheel

Building wheels is supported on both Windows and Linux

  1. Inside the root repository directory with the virtualenv active. Ensure you have up to date build tools:
cd seedpod_ground_risk
pip wheel . -w dist

The .whl file will be built in dist. You can install this as required:

pip install <.whl file>

then import the module:

import seedpod_ground_risk # Import entire module
import seedpod_ground_risk.cli # Only the CLI