Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartMacKay committed Oct 23, 2023
0 parents commit 5d0da9e
Show file tree
Hide file tree
Showing 77 changed files with 2,167 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.data/
.git/
.mypy_cache/
.pytest_cache/
__pycache__/
dist
venv

.coverage
.dockerignore
.env*
!.env
celerybeat-schedule
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.{css,html,json,scss,yml,xml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.bat]
indent_style = tab
end_of_line = crlf

[Makefile]
indent_style = tab

[*.mk]
indent_style = tab
66 changes: 66 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# Environment variables used for running the demo site
#
# Django settings and docker-compose.yml are configured with sensible default
# so whether you run the demo with a virtualenv or containers everything works
# out of the box. You will only need to set environment variables if you want
# to change the configuration in some way. For example, you have postgres
# installed natively but you want to use a container instead. In this case you
# need to set DOCKER_POSTGRES_PORT_FORWARD so the port does not clash with the
# post used by the native postgres.

# Configuration for PostgreSQL

# Both POSTGRES_USER and POSTGRES_PASSWORD are required when building the
# postgres image. Both are set to use the default value of 'postgres' in
# docker-compose.yml. Override them here, along with any other configuration
# changes you want.

#POSTGRES_USER=postgres
#POSTGRES_PASSWORD=postgres
#POSTGRES_DB=postgres
#POSTGRES_PORT=5432

# Configuration for RabbitMQ

#RABBITMQ_DEFAULT_USER=guest
#RABBITMQ_DEFAULT_PASS=guest
#RABBITMQ_DEFAULT_VHOST=

# Configuration for Celery

#CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/

# Map ports from the Docker virtual network so they are accessible locally.
# You will only need to change these if you have multiple docker projects
# running or there are conflicts with services installed natively.

#DOCKER_POSTGRES_PORT_FORWARD=5432
#DOCKER_RABBITMQ_PORT_FORWARD=5672
#DOCKER_RABBITMQ_MANAGEMENT_PORT_FORWARD=15672
#DOCKER_FLOWER_PORT_FORWARD=5555
#DOCKER_DJANGO_PORT_FORWARD=8000

# Extra. Accessing postgres on the command line.
#
# This is useful if you want to define Makefile targets for managing the
# database.
#
# Set environment variables used by the postgresql commands, psql, createdb,
# dropdb, etc. to connect to the database. PGPASSWORD is particularly useful
# to avoid having to enter it for each command. You will need to configure
# the server to allow username/password (md5) authentication on local (socket)
# connections and so avoid having to su to the postgres user first.
#
# /etc/postgresql/<version>/main/pg_hba.conf
# local all all md5
#
# For more info on environment variables see,
# https://www.postgresql.org/docs/current/libpq-envars.html
#
# The values must match the variables defined above, obviously.

#PGUSER=postgres # must match POSTGRES_USER
#PGPASSWORD=postgres # must match POSTGRES_PASSWORD
#PGDATABASE=postgres # must match POSTGRES_DB
#PGPORT=5432 # must match DOCKER_POSTGRES_PORT_FORWARD
26 changes: 26 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# direnv file

# This is just a bash script.
# https://direnv.net/man/direnv-stdlib.1.html
# https://github.com/direnv/direnv/wiki

# Activate the virtualenv
# This simply replicates what venv/bin/activate does.
# See, https://docs.python.org/3/library/venv.html#module-venv

if [[ -d "venv/bin" ]]; then
# The path to the virtualenv should be absolute. If you use ipython
# for the Django shell it will raise an error if the path is relative.
# https://github.com/ipython/ipython/issues/13268
# https://github.com/direnv/direnv/issues/304
export VIRTUAL_ENV=`pwd`/venv
PATH_add "venv/bin"
fi

# Set environment variables from .env. We're using a conditional
# in case an older version of direnv is used. In recent releases
# there is the stdlib function dotenv_if_exists

if [[ -f ".env" ]]; then
dotenv
fi
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#https://git-scm.com/docs/gitattributes

# end of line normalization
* text=auto
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Dependabot configuration
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
# https://github.com/dependabot/dependabot-core/issues/3940 hints that
# dependabot works with requirements-like files.

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/requirements"
schedule:
interval: "daily"
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on: [push]

jobs:

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.10"
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/tests.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Tox tests
run: tox
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Python
__pycache__/
*.py[co]
*.egg*

# Editor temp files
*~

# Ignore dot files except those required for the project
.*
!.dockerignore
!.editorconfig
!.envrc
!.env.example
!.flake8
!.gitattributes
!.github
!.gitignore
!.gitkeep
!.readthedocs.yml

# Project artefacts
build
coverage
dist
logs
venv

# Django runtime files
db.sqlite3

# Any local makefiles
*.mk
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
python:
version: 3.8
install:
- requirements: requirements/docs.txt
- method: pip
path: .
sphinx:
builder: html
configuration: docs/conf.py

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

## Latest
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

## Report Bugs

## Fix Bugs

## Implement Features

## Write Documentation

## Give Feedback

## Get Started!

### Pull Requests
13 changes: 13 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (C) 2023 Stuart MacKay

Licensed under the Apache License, Version 2.0 (the "License");
you may not use the files in library except in compliance with the
License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Dockerfile: configuration for building the images for the web app,
# celery-beat and celery-worker.
#

# Base python image
FROM python:3.11.5-slim-bookworm
# Add the project to the python path
ENV PYTHONPATH /app
# Send all output on stdout and stderr straight to the container logs
ENV PYTHONUNBUFFERED 1
# Set the locale
ENV LC_ALL C.UTF-8
# Terminals support 256 colours
ENV TERM xterm-256color

# Create the mount point for the project files
RUN mkdir /app
WORKDIR /app

# Install OS dependencies

RUN apt-get update \
&& apt-get install -y --no-install-recommends

RUN apt-get install -y --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install project requirements

# Copy across all the files needed to install feeds as an editable
# package since the volume has not been mounted yet.

COPY setup.py .
COPY README.md .
COPY src ./src

COPY requirements/dev.txt /tmp/requirements.txt

RUN pip install --upgrade setuptools pip wheel \
&& pip install pip-tools \
&& pip install -r /tmp/requirements.txt

Loading

0 comments on commit 5d0da9e

Please sign in to comment.