No description
Find a file
2021-10-11 21:41:48 -06:00
.github/workflows What do you want from me 2021-10-07 10:52:08 -06:00
projects Refactor out constants 2021-10-11 21:41:48 -06:00
tools Get fmt working again 2021-10-10 21:42:55 -06:00
.bazelrc [NO TESTS] WIP 2021-09-25 00:43:50 -06:00
.editorconfig 4spc for buildfiles 2021-08-03 19:29:18 -06:00
.gitignore Ignore hypothesis state caches 2021-08-03 19:04:32 -06:00
activate.sh Document working in here 2021-10-10 21:42:38 -06:00
BUILD Get flake8 working as an aspect 2021-08-30 00:29:43 -06:00
LICENSE Initial state 2021-04-08 00:37:51 -06:00
README.md Document working in here 2021-10-10 21:42:38 -06:00
setup.cfg Fmt. 2021-09-24 22:37:38 -06:00
WORKSPACE Get test_licenses using pkg_info ala liccheck 2021-09-19 17:59:18 -06:00

Reid's monorepo

I've found it inconvenient to develop lots of small Python modules. And so I'm going the other way; Bazel in a monorepo with subprojects so I'm able to reuse a maximum of scaffolding.

Projects

Hacking (Ubuntu)

Step 1 - Install bazel

As usual, Ubuntu's packaging of the Bazel bootstrap script is ... considerably stale. Add the upstream Bazel ppa so we can get reasonably fresh builds.

sudo apt install apt-transport-https curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list

Step 2 - Create a canonical python

Bazel, sadly, expects that a platform python exists for things. Due to Bazel's plugins model, changing this is miserable. So just create one.

if ! `which python > /dev/null`; then
  sudo ln -s `which python3` /usr/bin/python
fi

Step 3 - Non-hermetic build deps

The way that Bazel's Python toolchain(s) work is that ultimately they go out to the non-hermetic platform. So, in order to be able to use the good tools we have to have some things on the host filesystem.

if [[ "$(sqlite3 --version | awk -F'.' '/^3/ {print $2; exit}')" -lt 35 ]]; then
  echo "SQLite 3.35.0 or later  (select ... returning support) required"
  exit 1
fi

sudo apt install \
  python3-setuptools \
  postgresql libpq-dev \
  sqlite3 libsqlite3-dev

Working in source

source activate.sh is the key. It automates a number of tasks -

  1. Building a virtualenv
  2. Synchronizing the virtualenv from the requirements.txt
  3. Updating the virtualenv with all project paths
  4. Activating that virtualenv

License

Copyright Reid 'arrdem' McKenzie, 4/8/2021.

Unless labeled otherwise, the contents of this repository are distributed under the terms of the MIT license. See the included LICENSE file for more.