-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2975411
commit 22c6379
Showing
20 changed files
with
225 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
exclude tests/** | ||
exclude docs/** | ||
exclude dev/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Developer guide | ||
|
||
Please consult the [documentation](https://insightboard.readthedocs.io/en/latest) for general usage. | ||
|
||
## Virtual environment | ||
|
||
We use [uv](https://docs.astral.sh/uv/) to manage virtual environments. First, [install `uv`](https://docs.astral.sh/uv/getting-started/installation/), then activate the virtual environment: | ||
|
||
```bash | ||
uv sync --all-extras | ||
. .venv/bin/activate | ||
``` | ||
|
||
The package will install a script allowing the production server to be launched with `InsightBoard`. To launch the dashboard manually run `python -m InsightBoard`. To launch the dashboard in debug-mode (which uses Dash's bundled Flash server) run `python -m InsightBoard --debug`. If you wish to launch `InsightBoard` from within python, `import InsightBoard` then call `InsightBoard.main()`. | ||
|
||
## Versioning | ||
|
||
Use [Semantic Versioning](https://semver.org/). Version management is handled by [setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/), which extracts the current version number from the git tags. | ||
|
||
Note that `setuptools-scm` writes to a `src/InsightBoard/version.py` file which _should not_ be checked in to git (the file is listed in `.gitignore`), but will allow packaged releases to query `InsightBoard.__version__` to get the current version number. During development this will look peculiar (e.g. `0.1.0.dev...`). | ||
|
||
## Making a release | ||
|
||
To create a new release, navigate to github - Releases, then select `Draft a new release`. Create a new tag in the format `vX.Y.Z` (e.g. `v0.1.0`), click `Generate release notes`, then `Publish release`. This will trigger a github action that will build the Python wheels and upload the package to PyPI. It is worth keeping an eye on this action to ensure it completes successfully, and making any necessary changes if it does not. | ||
|
||
## Building as an application | ||
|
||
_Experimental_ | ||
|
||
To build the application as a standalone executable, we use [PyInstaller](https://www.pyinstaller.org/). This will create a `dist/InsightBoard` folder containing the executable and all necessary dependencies. To build the application, run `./dev/build_app.sh`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import InsightBoard | ||
|
||
InsightBoard.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
datas = [ | ||
('../src/InsightBoard/pages/*', 'pages'), | ||
] | ||
|
||
|
||
a = Analysis( | ||
['app.py'], | ||
pathex=['../src/InsightBoard'], | ||
binaries=[], | ||
datas=datas, | ||
hiddenimports=['InsightBoard'], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
noarchive=False, | ||
optimize=0, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='InsightBoard', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='InsightBoard', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
# Change to the parent directory | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
pushd "$SCRIPT_DIR/.." | ||
|
||
# Cleanup any previous build | ||
rm -rf build dist | ||
|
||
# Active the virtual environment (with all dependencies installed) | ||
uv sync | ||
uv pip install "adtl[parquet] @ git+https://github.com/globaldothealth/adtl" | ||
uv pip install pyinstaller | ||
source .venv/bin/activate | ||
|
||
# Build the app | ||
uv run pyinstaller dev/app.spec | ||
|
||
# Return to original directory | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from .app import app | ||
import argparse | ||
from InsightBoard import main | ||
from InsightBoard.app import app | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) # pragma: no cover | ||
p = argparse.ArgumentParser() | ||
p.add_argument("--debug", action="store_true") | ||
args = p.parse_args() | ||
|
||
if args.debug: | ||
# Dash launches a Flask development server | ||
app.run(debug=True) | ||
else: | ||
# Otherwise, launch the production server | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .config import ConfigManager # noqa: F401 | ||
from InsightBoard.config.config import ConfigManager # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
from .database import Database, DatabaseBackend, WritePolicy, BackupPolicy # noqa: F401 | ||
from InsightBoard.database.database import ( # noqa: F401 | ||
Database, | ||
DatabaseBackend, | ||
WritePolicy, | ||
BackupPolicy, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .project import Project # noqa: F401 | ||
from InsightBoard.project.project import Project # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
tests/system/InsightBoard/projects/sample_project/parsers/adtl-source1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.