Please read CODE_OF_CONDUCT.md
before contributing.
- Create your own fork of the code
- Do the changes in your fork
- If you like the change and think the project could use it:
- Be sure you have followed the code style for the project.
- Send a pull request.
Set-up expectations:
Env manager: | conda |
Os: | macOS |
Package manager: | pip |
Install Dependencies:
- There are a few dependencies that need to be installed in advance. See the dependencies section for specific instructions and then return here once they have been installed.
Package set-up and installation:
- Setup a new conda env:
conda create -n r5py python=3.9.13
- Activate the environment:
conda activate r5py
- Launch terminal and change directory to wherever you keep your GitHub repos:
cd ~/Documents
- Clone this repo, eg with https:
git clone https://github.com/datasciencecampus/transport-network-performance.git
- Change directory to the repo:
cd transport-network-performance
- Install pre-commit hooks:
pre-commit install
- Update pip:
pip install --upgrade pip
- Install r5py & other reqs:
pip install -r requirements.txt
Set-up check:
- Run set-up pytests:
pytest --runsetup
. - If everything is working as expected, you should see some Java flavoured warnings about
--illegal-access
that you can ignore. But importantly look out for the message:r5py has created the expected database files.
- If you've made it this far, you've earned yourself a coffee.
geos
is a dependency of the python package cartopy
, which is used here for building and visualising static maps. See this cartopy installation guidance note for more details on the installation process.
For macOS, this is straight forward using brew
:
brew install geos
Java is required for handling the transport network routing. Openjdk 11 is recommended by r5py docs. sdkman is used here.
Note: for macOS on ARM architectures (M1/M2 machines), sdkman does not currently provide a suitable openjdk11 version. Instead you can follow this blog post, which introduces Java version mangaement using
jEnv
, and install AdoptOpenJDK-11.
- Get sdkman:
curl -s "https://get.sdkman.io" | bash
- Follow instructions in terminal, you’ll be asked to:
source “<SOME_PATH>.sdkman/bin/sdkman-init.sh"
This will add sdkman env variables to:~/.bash_profile
and possibly~/.zshrc
too. - To see versions available on your os:
sdk list java
- Install the required version using the
identifier
column, eg:sdk install java 11.0.19-amzn
- Check this is the currenty used java version:
sdk current java
.
Pyosmium needs to integrate with C++ Osmium, therefore you will need the following dependencies installed on macos:
brew install boost
brew install cmake
This repository contains a configuration of pre-commit hooks. These are language agnostic and focussed on repository security (such as detection of passwords and API keys). If approaching this project as a developer, you are encouraged to install and enable pre-commits
by running the following in your shell:
-
Install
pre-commit
:pip install pre-commit
-
Enable
pre-commit
:pre-commit install
Once pre-commits are activated, whenever you commit to this repository a series of checks will be executed. The pre-commits include checking for security keys, large files and unresolved merge conflict headers. The use of active pre-commits are highly encouraged and the given hooks can be expanded with Python or R specific hooks that can automate the code style and linting. For example, the flake8
and black
hooks are useful for maintaining consistent Python code formatting.
NOTE: Pre-commit hooks execute Python, so it expects a working Python build.
The Campus looks at issues, features requests, and pull requests on a regular basis but cannot unfortunately guarantee prompt implementation or response.
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
When filing an issue, make sure to answer the questions in the Bug template.
When raising an issue, select the 'Feature request' option and answer the questions in the template.
We mainly follow the Quality Assurance of Code for Analysis and Research in our code conventions.
Testing with pytest
.
Coverage with Coverage.py