Home Information - Your home, your data, organized.
Python
Continued refactoring and content additions to documentation.
Anthony Cassandra836b3c5372e1
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex c5d12ccb..45ab8482 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,4 +1,4 @@-<img src="../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">+<img src="src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128"># Contributing@@ -6,101 +6,58 @@ We welcome contributions! Follow these guidelines to get started.## Project and Goals-_TBD_+The Home Information app's goal is to create a people-focused way to organize the various information needed to manage their homes. Home automation is great, but these systems tend to be device-focused instead of information-focused. They often add more complexity to your life rather than simplifying it. By creating a "single pane of glass" for all the information related to your home, we can begin fulfilling the promise of automation and technology and make managing your home, and your life, simpler.-[Road Map](RoadMap.md)+We've only just begun this journey. We've put some basic functonality in place to demonstrate its potential, but there are plenty of opportunities for improvements. Our [Road Map Page](RoadMap.md) shows just some of the future features we are thinking about.## How to Contribute-users v. coder v. graphic designers+We are open to contributions from anyone. There are a few different ways to contribute:+- **User** - Only requires installing and using the app.+- **Graphic or UX Design** - For those with ideas on better visuals and/or better user experiences.+- **Software Development** - For those wanting to get involved with writing code.-### User Contributions--### Graphic Design Contributions--### Code Contributions--See the [Development Page](docs/Development.md) for how to set up your development environment.--1. Open an issue describing your proposed change.-2. Fork the repository.-3. Create a feature branch.-4. Make your changes.-5. Submit a pull request to the `develop` branch.--Code should be tested before approval.-Squash and merge is preferred for a cleaner commit history.---#### Branching Strategy--- Main Branch (`master`): Stable, production-ready code.-- Development Branch (`develop`): Active development happens here.-- Feature Branches (feature/some-feature): Contributors should branch off `develop`.--Example:-``` shell-git checkout -b feature/new-feature develop-git commit -m "Add new feature"-git push origin feature/new-feature-```---#### Making Changes--: Guidelines on:--Code style (and how to check it)-Commit message format (use a clear and consistent format)-Testing (how to run tests and write new ones)-Documentation (how to update documentation)+See the sections below for more details for each way to contribute.+### User Contributions-#### Coding Style+If you are simply interested in using the Home Information app, we would love for you to contribute your experiences and ideas for improving things. Details for getting up and running are on the [Installation Page](docs/Installation.md).-We mostly adhere to PEP8 but we strongly disagree with its broadly accepted coding guidelines around spaces. Spaces are great visual delimiters and greatly enhance readability. The deviations we make are shown in this Flake8 config file for what is ignored.+Any and all feedback and ideas are welcome, such as:+- Features you would like to see.+- Improvements to existing features you would like.+- Integrations you could use.+- Good and bad usability issues.+- And bugs or glitches.-``` shell-[flake8]-max-line-length = 110+### Graphic and UX Design Contributions-# Things I disable:-#-# E129 - visually indented line with same indent as next logical line-# D203 --# E201 - whitespace after brackets-# E202 - whitespace before brackets-# E203 --# E221 - multiple spaces before operator-# E231 --# E251 - unexpeced whitespace around keyword parameters-# W293 - blank line contains whitespace-# W291 - white space at end of line-# W391 - blank line at end of file-# W503 - line break before binary operator+As with most software projects like this, the UI and UX design tends to be done by software developers with only a passing sense of what "good" looks like and/or are too busy trying to make everything actually work to have time to devote to refining the UI/UX. If you tend toward thinking and caring about the visual style and user experience, it would greatly complement the team.-ignore = E129,D203,E201,E202,E203,E221,E231,E251,W293,W291,W391,W503-```+We are not currently set up with a workflow for contributing in this manner, but all we need are some people with the interest and we'll develop something. Just let us know if this sounds like something you are interested in.+### Software Development Contributions+The following pages are for those wanting to contribute to the code base:-#### Submitting a Pull Request: Explain the PR process:+- [Development Page](docs/Development.md)+- [Development Setup Page](docs/dev/Setup.md)+- [Development Workflow Page](docs/dev/Workflow.md)+- [Developer Documentation](docs/dev/README.md)-- Open a PR against the `develop` branch.-- Write a clear and descriptive PR title and description.-- Include screenshots or GIFs if relevant.-- Address any feedback on the PR.+## Code of Conduct-#### Code of Conduct+Regardless of how you contribute, you must adhere to the golden rule and:-- be respectful-- be inclusive and welcoming-- be responsive-- provide feedback-- keep your ego in check-- keep PRs focused: one feature/fix per PR.+- be respectful;+- be inclusive and welcoming;+- be responsive;+- provide feedback;+- keep your ego in check; or+- in other words, be a decent human being.+Life is too short to be wasting time with a**holes.-#### Licensing+## Licensing-See the [License Page](LICENSE.md).+Be aware of the project's licensing terms. See [License Page](LICENSE.md).diff --git a/README.md b/README.mdindex b3e1b3f0..7c54f6c5 100644--- a/README.md+++ b/README.md@@ -57,7 +57,12 @@ Then visit: [http://localhost:9411](http://localhost:9411) and the [Getting StarSetting up for local development, in brief, looks like this:``` shell-git clone [email protected]:cassandra/home-information.git+# Fork the repo: https://github.com/cassandra/home-information++# Clone your fork+git clone https://github.com/${YOURUSERNAME}/home-information.git++# Initialize the environment and databasecd home-informationmake env-build-devpython3.11 -m venv venv@@ -70,7 +75,8 @@ cd src./manage.py hi_creategroups./manage.py runserver```-See the [Development Page](docs/Development.md) for more details.++See the [Contributing](CONTRIBUTING.md) and [Development](docs/Development.md) pages for more details.---diff --git a/docs/Development.md b/docs/Development.mdindex cefda82a..5490ea6a 100644--- a/docs/Development.md+++ b/docs/Development.md@@ -8,7 +8,7 @@- Git - installed- Redis - installed and running-See the [Prerequisite Installs Section](#prerequisite-installs) below if you want help installing those.+See the [Dependencies Page](dev/Dependencies.md) if you want help installing those.## Tech Stack@@ -20,133 +20,16 @@ See the [Prerequisite Installs Section](#prerequisite-installs) below if you wan## Development Setup-### Download+See the [Development Setup Page](dev/Setup.md).-Decide where you want to download the code to and adjust the following:-``` shell-PROJ_DIR="proj"-mkdir -p $PROJ_DIR-cd $PROJ_DIR-```-Download the code:-``` shell-git clone [email protected]:cassandra/home-information.git-cd home-information-```+## Development Workflow-### Environment Setup+See the [Development Workflow Page](dev/Workflow.md).-Generate the environment variable file and review with the command below. The file will contain sensitive secrets and are stored in a `.private` directory. Also note that administrative credentials created during this next step and save them somewhere safe.-``` shell-make env-build-dev-```-This generates an environment variable file that is sourced before running:-```-$PROJ/.private/env/development.sh-```-This directory and its files should not be checked into the code repository. There is an existing `.gitignore` entry to prevent this.+## Development Guidelines--Next, create the Python virtual environment.-``` shell-cd $PROJ_DIR-python3.11 -m venv venv-```-Now source trhe environment and virtual environment with this convenience script:-``` shell-. ./init-env-dev.sh-```-In the future, just source'ing this script is all you need to set things up for development.--Next, install all the app's required Python packages.-``` shell-pip install -r src/hi/requirements/development.txt-```--### App and Database Initializations--Initialize the database and add the admin users and groups.-``` shell-cd $PROJ_DIR-cd src-./manage.py check-./manage.py migrate-./manage.py hi_createsuperuser-./manage.py hi_creategroups-```--### Running---``` shell-./manage.py runserver-```--Then, visit: [http://127.0.0.1:8411](http://127.0.0.1:8411) to access the app.--If you want to familiarize yourself with how to use the app before diving inot the code, see the [Getting Started Page](GettingStarted.md).+See the [Development Guidelines Page](dev/Guidelines.md).## Developer Documentation-The code is the best documentation for lower-level details, but there are some higher-level concepts that are useful to help orient developers. See [dev/README.md](dev/README.md) for all that high-level, developer-specific documentation.--## Contributing--See the [Contributing Page](../CONTRIBUTING.md) for guidelines and processes.--## Prerequisite Installs <a id="prerequisite-installs"></a>--_Provided for convenience. May be outdated._--### Python--#### MacOS--Get python 3.11 package and install from: [https://www.python.org/downloads/](https://www.python.org/downloads/)--#### Ubuntu (GNU/Linux)--``` shell- sudo apt update && sudo apt upgrade- sudo add-apt-repository ppa:deadsnakes/ppa- sudo apt-get update- apt list | grep python3.11- sudo apt-get install python3.11- sudo apt install python3.11-venv-```--### Redis--#### MacOS--Download tarball from: [https://redis.io/download](https://redis.io/download).---``` shell-brew install redis--# Yields these executables:-/usr/local/bin/redis-server-/usr/local/bin/redis-cli--mkdir ~/.redis-touch ~/.redis/redis.conf-```-Then run with `redis-server`.--#### Ubuntu (GNU/Linux)--``` shell-cd ~/Downloads-tar zxvf redis-6.2.1.tar.gz-cd redis-6.2.1-make test-make--sudo cp src/redis-server /usr/local/bin-sudo cp src/redis-cli /usr/local/bin--mkdir ~/.redis-touch ~/.redis/redis.conf-```-Then run with `redis-server`.+See the [Developer Documentation Page](dev/README.md).diff --git a/docs/dev/Dependencies.md b/docs/dev/Dependencies.mdnew file mode 100644index 00000000..47d5bf99--- /dev/null+++ b/docs/dev/Dependencies.md@@ -0,0 +1,60 @@+<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">++# Dependencies++_Notes and help for project dependencies._++_Provided for convenience. May be outdated._++### Python++#### MacOS++Get python 3.11 package and install from: [https://www.python.org/downloads/](https://www.python.org/downloads/)++#### Ubuntu (GNU/Linux)++``` shell+ sudo apt update && sudo apt upgrade+ sudo add-apt-repository ppa:deadsnakes/ppa+ sudo apt-get update+ apt list | grep python3.11+ sudo apt-get install python3.11+ sudo apt install python3.11-venv+```++### Redis++#### MacOS++Download tarball from: [https://redis.io/download](https://redis.io/download).+++``` shell+brew install redis++# Yields these executables:+/usr/local/bin/redis-server+/usr/local/bin/redis-cli++mkdir ~/.redis+touch ~/.redis/redis.conf+```+Then run with `redis-server`.++#### Ubuntu (GNU/Linux)++``` shell+cd ~/Downloads+tar zxvf redis-6.2.1.tar.gz+cd redis-6.2.1+make test+make++sudo cp src/redis-server /usr/local/bin+sudo cp src/redis-cli /usr/local/bin++mkdir ~/.redis+touch ~/.redis/redis.conf+```+Then run with `redis-server`.diff --git a/docs/dev/Guidelines.md b/docs/dev/Guidelines.mdnew file mode 100644index 00000000..67c60d55--- /dev/null+++ b/docs/dev/Guidelines.md@@ -0,0 +1,49 @@+<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">++# Development Guidelines++## Coding Style++The project triued to adhere to PEP8 but we strongly disagree with the broadly accepted coding guidelines around spaces. Spaces are great visual delimiters and greatly enhance readability. The whitespace deviations we make to PEP8 are shown in this Flake8 config file (`ignore`).++``` shell+[flake8]+max-line-length = 110++# Things I disable:+#+# E129 - visually indented line with same indent as next logical line+# D203 -+# E201 - whitespace after brackets+# E202 - whitespace before brackets+# E203 -+# E221 - multiple spaces before operator+# E231 -+# E251 - unexpeced whitespace around keyword parameters+# W293 - blank line contains whitespace+# W291 - white space at end of line+# W391 - blank line at end of file+# W503 - line break before binary operator++ignore = E129,D203,E201,E202,E203,E221,E231,E251,W293,W291,W391,W503+```++## Code Organization++_TBD_++## Testing Conventions++_TBD_++## Commit Messages++_TBD_++## PR Descriptions++_TBD_++## Documentation++_TBD_diff --git a/docs/dev/README.md b/docs/dev/README.mdindex 5b75b785..b392a018 100644--- a/docs/dev/README.md+++ b/docs/dev/README.md@@ -3,3 +3,5 @@# Developer DocumentationSee the markdown files in this directory for various developer-related documentation.++The code is the best documentation for lower-level details, but there are some higher-level concepts that are useful to help orient developers. This is the place for that high-level, developer-specific documentation.diff --git a/docs/dev/Setup.md b/docs/dev/Setup.mdnew file mode 100644index 00000000..1facc4f1--- /dev/null+++ b/docs/dev/Setup.md@@ -0,0 +1,103 @@+<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">++# Development Setup++## Fork the Repository++- Go to the main repository on GitHub: https://github.com/cassandra/home-information+- Click the "Fork" button in the upper-right corner.+- This creates a copy of the repository in the your GitHub account (keep same name if you can for simplicity).+- The forked repo will be located at https://github.com/${YOURUSERNAME}/home-information.git (if you kept the same repo name).++## Local Repository Setup++Decide where you want to download the code to (adjust the following):+``` shell+PROJ_DIR="${HOME}/proj"+mkdir -p $PROJ_DIR+cd $PROJ_DIR+```++Clone your fork to your local development envirnoment:+``` shell+git clone https://github.com/${YOURUSERNAME}/home-information.git++# Or use the SSH URL if you have SSH keys set up:+git clone [email protected]:${YOURUSERNAME}/home-information.git+```++Add the original repo as "upstream":+``` shell+git remote add upstream https://github.com/cassandra/home-information.git++# Or the SSH URL:+git remote add upstream [email protected]:${YOURUSERNAME}/home-information.git+```++Verfy everything is set up properly:+``` shell+git remote -v++# Expect+origin https://github.com/${YOURUSERNAME}/home-information.git (fetch)+origin https://github.com/${YOURUSERNAME}/home-information.git (push)+upstream https://github.com/cassandra/home-information.git (fetch)+upstream https://github.com/cassandra/home-information.git (push)+```++## Environment Setup++Generate the environment variable file and review with the command below. The file will contain sensitive secrets and are stored in a `.private` directory. Also note that administrative credentials created during this next step.+``` shell+make env-build-dev+```+This generates an environment variable file that we "source" before running:+```+$PROJ_DIR/.private/env/development.sh+```+This `.private` directory and its files should not be checked into the code repository. There is an existing `.gitignore` entry to prevent this. The adminstrative credentials generated can also be seen in that file.+++Next, create the Python virtual environment.+``` shell+cd $PROJ_DIR+python3.11 -m venv venv+```+Now source the environment and virtual environment with this convenience script:+``` shell+. ./init-env-dev.sh+```+In the future, just source'ing this script is all you need to set things up for development (virtual env and env vars).++Next, install all the app's required Python packages (make sure you are in the virtual env).+``` shell+pip install -r src/hi/requirements/development.txt+```++### App and Database Initializations++Initialize the database and add the admin users and groups.+``` shell+cd $PROJ_DIR+cd src+./manage.py check+./manage.py migrate+./manage.py hi_createsuperuser+./manage.py hi_creategroups+```++### Running+++``` shell+./manage.py runserver+```++Then, visit: [http://127.0.0.1:8411](http://127.0.0.1:8411) to access the app.++If you want to familiarize yourself with how to use the app before diving inot the code, see the [Getting Started Page](GettingStarted.md).++A look through these docs might also be a good starting point:+- [Data Model](DataModel.md)+- [Architecture](Architecture.md)+diff --git a/docs/dev/Setup.md.html b/docs/dev/Setup.md.htmlnew file mode 100644index 00000000..0dee6e65--- /dev/null+++ b/docs/dev/Setup.md.html@@ -0,0 +1,312 @@+<!DOCTYPE html>+<html>+ <head>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">+ <title>Setup.md.html</title>+ <style>+ /* This CSS is originated from a following sites.+ https://github.com/magnetikonline/ghmarkdownrender */+ body {+ background: #fff;+ color: #333;+ font: 16px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';+ width: 50em;+ border: 1px solid #ddd;+ outline: 1300px solid #fff;+ margin: 20px auto;+ padding: 40px;+ }+ #frame {+ border: 1px solid #ddd;+ border-radius: 3px;+ margin: 0 auto;+ width: 978px;+ }+ #markdown {+ padding: 45px;+ }+ #markdown > *:first-child {+ margin-top: 0;+ }+ #markdown > *:last-child {+ margin-bottom: 0;+ }+ h1,h2,h3,h4,h5,h6 {+ font-weight: 600;+ line-height: 1.25;+ margin: 24px 0 16px;+ padding: 0;+ }+ h1,h2 {+ padding-bottom: 0.3em;+ }+ h1 {+ border-bottom: 1px solid #eee;+ font-size: 2em;+ }+ h2 {+ border-bottom: 1px solid #eee;+ font-size: 1.5em;+ }+ h3 {+ font-size: 1.25em;+ }+ h4 {+ font-size: 1em;+ }+ h5 {+ font-size: 0.875em;+ }+ h6 {+ color: #777;+ font-size: 0.85em;+ }+ a {+ color: #4183c4;+ text-decoration: none;+ }+ a:hover {+ text-decoration: underline;+ }+ blockquote,dl,ol,p,pre,table,ul {+ margin: 0 0 16px;+ padding: 0;+ }+ blockquote {+ border-left: 0.25em solid #ddd;+ color: #777;+ padding: 0 1em;+ }+ blockquote > *:first-child {+ margin-top: 0;+ }+ blockquote > *:last-child {+ margin-bottom: 0+ }+ hr {+ background: #e7e7e7;+ border: 0;+ height: 0.25em;+ margin: 24px 0;+ overflow: hidden;+ padding: 0;+ }+ hr:before,+ hr:after {+ content: '';+ display: table;+ }+ hr:after {+ clear: both;+ }+ img {+ background: #fff;+ border: 0;+ box-sizing: content-box;+ max-width: 100%;+ }+ kbd {+ background: #fcfcfc;+ border-bottom-color: #bbb;+ border-radius: 3px;+ border: 1px solid #ccc;+ box-shadow: inset 0 -1px 0 #bbb;+ color: #555;+ display: inline-block;+ font: 11px/10px Consolas,'Liberation Mono',Menlo,Courier,monospace;+ padding: 3px 5px;+ vertical-align: middle;+ }+ ol,ul {+ padding-left: 2em;+ }+ ol ol,+ ol ul,+ ul ol,+ ul ul {+ margin-bottom: 0;+ margin-top: 0;+ }+ ol ol,+ ul ol {+ list-style-type: lower-roman;+ }+ li + li {+ margin-top: 0.25em;+ }+ li > p {+ margin-top: 16px;+ }+ table {+ border-collapse: collapse;+ border-spacing: 0;+ }+ table tr {+ background: #fff;+ border-top: 1px solid #ccc;+ }+ table tr:nth-child(2n) {+ background: #f8f8f8;+ }+ table th,+ table td {+ border: 1px solid #ddd;+ padding: 6px 13px;+ }+ table th {+ font-weight: bold;+ }+ code,pre,tt {+ font-family: Consolas,'Liberation Mono',Menlo,Courier,monospace;+ font-size: 12px;+ }+ code,tt {+ background: rgba(0,0,0,0.04);+ border-radius: 3px;+ font-size: 85%;+ margin: 0;+ padding: 0.2em 0;+ }+ code {+ white-space: nowrap;+ }+ code:before,+ code:after,+ tt:before,+ tt:after {+ content: '\\00a0';+ letter-spacing: -0.2em;+ }+ pre {+ background: #f7f7f7;+ border-radius: 3px;+ font-size: 85%;+ line-height: 1.45;+ overflow: auto;+ padding: 16px;+ }+ pre code,+ pre tt {+ background: transparent;+ border: 0;+ margin: 0;+ padding: 0;+ }+ pre > code {+ background: transparent;+ font-size: 100%;+ white-space: pre;+ }+ pre > code:before,+ pre > code:after {+ content: normal;+ }+ h1 code,h1 tt,+ h2 code,h2 tt,+ h3 code,h3 tt,+ h4 code,h4 tt,+ h5 code,h5 tt,+ h6 code,h6 tt {+ font-size: inherit;+ }+ .highlight { margin-bottom: 16px; }+ .pl-c { color: #969896; }+ .pl-c1,.pl-s .pl-v { color: #0086b3; }+ .pl-e,.pl-en { color: #795da3; }+ .pl-ent { color: #63a35c; }+ .pl-id { color: #b52a1d; }+ .pl-ii { background-color: #b52a1d;color: #f8f8f8; }+ .pl-k { color: #a71d5d; }+ .pl-mb { color: #333;font-weight: bold; }+ .pl-md { background-color: #ffecec;color: #bd2c00; }+ .pl-mdr { color: #795da3;font-weight: bold; }+ .pl-mh,.pl-mh .pl-en,.pl-ms { color: #1d3e81;font-weight: bold; }+ .pl-mi { color: #333;font-style: italic; }+ .pl-mi1 { background-color: #eaffea;color: #55a532; }+ .pl-ml { color: #693a17; }+ .pl-mo { color: #1d3e81; }+ .pl-mq { color: #008080; }+ .pl-s,.pl-pds,.pl-s .pl-pse .pl-s1,.pl-sr,.pl-sr .pl-cce,.pl-sr .pl-sre,.pl-sr .pl-sra { color: #183691; }+ .pl-smi,.pl-s .pl-s1 { color: #333; }+ .pl-sr .pl-cce { color: #63a35c;font-weight: bold; }+ .pl-v { color: #ed6a43; }+ #footer {+ color: #777;+ font-size: 11px;+ margin: 10px auto;+ text-align: right;+ white-space: nowrap;+ width: 978px;+ }+ </style>+ </head>+ <body>+ <p><a target="_blank" rel="noopener noreferrer" href="../../src/hi/static/img/hi-logo-w-tagline-197x96.png"><img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128" style="max-width: 100%;"></a></p>+<div class="markdown-heading"><h1 class="heading-element">Development Setup</h1><a id="user-content-development-setup" class="anchor" aria-label="Permalink: Development Setup" href="#development-setup"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<div class="markdown-heading"><h2 class="heading-element">Fork the Repository</h2><a id="user-content-fork-the-repository" class="anchor" aria-label="Permalink: Fork the Repository" href="#fork-the-repository"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>Go to the main repository on GitHub: <a href="https://github.com/cassandra/home-information">https://github.com/cassandra/home-information</a>+</li>+<li>Click the "Fork" button in the upper-right corner.</li>+<li>This creates a copy of the repository in the your GitHub account (keep same name if you can for simplicity).</li>+<li>The forked repo will be located at <a href="https://github.com/$%7BYOURUSERNAME%7D/home-information.git">https://github.com/${YOURUSERNAME}/home-information.git</a> (if you kept the same repo name).</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Local Repository Setup</h2><a id="user-content-local-repository-setup" class="anchor" aria-label="Permalink: Local Repository Setup" href="#local-repository-setup"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>Decide where you want to download the code to (adjust the following):</p>+<div class="highlight highlight-source-shell"><pre>PROJ_DIR=<span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${HOME}</span>/proj<span class="pl-pds">"</span></span>+mkdir -p <span class="pl-smi">$PROJ_DIR</span>+<span class="pl-c1">cd</span> <span class="pl-smi">$PROJ_DIR</span></pre></div>+<p>Clone your fork to your local development envirnoment:</p>+<div class="highlight highlight-source-shell"><pre>git clone https://github.com/<span class="pl-smi">${YOURUSERNAME}</span>/home-information.git++<span class="pl-c"><span class="pl-c">#</span> Or use the SSH URL if you have SSH keys set up:</span>+git clone [email protected]:<span class="pl-smi">${YOURUSERNAME}</span>/home-information.git</pre></div>+<p>Add the original repo as "upstream":</p>+<div class="highlight highlight-source-shell"><pre>git remote add upstream https://github.com/cassandra/home-information.git++<span class="pl-c"><span class="pl-c">#</span> Or the SSH URL:</span>+git remote add upstream [email protected]:<span class="pl-smi">${YOURUSERNAME}</span>/home-information.git</pre></div>+<p>Verfy everything is set up properly:</p>+<div class="highlight highlight-source-shell"><pre>git remote -v++<span class="pl-c"><span class="pl-c">#</span> Expect</span>+origin https://github.com/<span class="pl-smi">${YOURUSERNAME}</span>/home-information.git (fetch)+origin https://github.com/<span class="pl-smi">${YOURUSERNAME}</span>/home-information.git (push)+upstream https://github.com/cassandra/home-information.git (fetch)+upstream https://github.com/cassandra/home-information.git (push)</pre></div>+<div class="markdown-heading"><h2 class="heading-element">Environment Setup</h2><a id="user-content-environment-setup" class="anchor" aria-label="Permalink: Environment Setup" href="#environment-setup"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>Generate the environment variable file and review with the command below. The file will contain sensitive secrets and are stored in a <code>.private</code> directory. Also note that administrative credentials created during this next step.</p>+<div class="highlight highlight-source-shell"><pre>make env-build-dev</pre></div>+<p>This generates an environment variable file that we "source" before running:</p>+<pre><code>$PROJ_DIR/.private/env/development.sh+</code></pre>+<p>This <code>.private</code> directory and its files should not be checked into the code repository. There is an existing <code>.gitignore</code> entry to prevent this. The adminstrative credentials generated can also be seen in that file.</p>+<p>Next, create the Python virtual environment.</p>+<div class="highlight highlight-source-shell"><pre><span class="pl-c1">cd</span> <span class="pl-smi">$PROJ_DIR</span>+python3.11 -m venv venv</pre></div>+<p>Now source the environment and virtual environment with this convenience script:</p>+<div class="highlight highlight-source-shell"><pre><span class="pl-c1">.</span> ./init-env-dev.sh</pre></div>+<p>In the future, just source'ing this script is all you need to set things up for development (virtual env and env vars).</p>+<p>Next, install all the app's required Python packages (make sure you are in the virtual env).</p>+<div class="highlight highlight-source-shell"><pre>pip install -r src/hi/requirements/development.txt</pre></div>+<div class="markdown-heading"><h3 class="heading-element">App and Database Initializations</h3><a id="user-content-app-and-database-initializations" class="anchor" aria-label="Permalink: App and Database Initializations" href="#app-and-database-initializations"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>Initialize the database and add the admin users and groups.</p>+<div class="highlight highlight-source-shell"><pre><span class="pl-c1">cd</span> <span class="pl-smi">$PROJ_DIR</span>+<span class="pl-c1">cd</span> src+./manage.py check+./manage.py migrate+./manage.py hi_createsuperuser+./manage.py hi_creategroups</pre></div>+<div class="markdown-heading"><h3 class="heading-element">Running</h3><a id="user-content-running" class="anchor" aria-label="Permalink: Running" href="#running"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<div class="highlight highlight-source-shell"><pre>./manage.py runserver</pre></div>+<p>Then, visit: <a href="http://127.0.0.1:8411" rel="nofollow">http://127.0.0.1:8411</a> to access the app.</p>+<p>If you want to familiarize yourself with how to use the app before diving inot the code, see the <a href="GettingStarted.md">Getting Started Page</a>.</p>+<p>A look through these docs might also be a good starting point:</p>+<ul>+<li><a href="DataModel.md">Data Model</a></li>+<li><a href="Architecture.md">Architecture</a></li>+</ul>++ </body>+</html>diff --git a/docs/dev/VisualTesting.md b/docs/dev/Testing.mdsimilarity index 85%rename from docs/dev/VisualTesting.mdrename to docs/dev/Testing.mdindex c004afd9..b6e53e86 100644--- a/docs/dev/VisualTesting.md+++ b/docs/dev/Testing.md@@ -1,12 +1,24 @@<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">-# Visual Testing Page+# Testing++## Unit Tests++``` shell+./manage.py test+```++## Integation Tests++_TBD_++## Visual Testing PageVisit: [http:/tests/ui](http:/tests/ui).These tests/ui views are only available in the development environment when DEBUG=True. (They are conditionally loaded in the root urls.py.)-## Adding to the Visual Testing Page+### Adding to the Visual Testing PageThe `hi.tests.ui` module uses auto-discovery by looking in the app directories.@@ -24,7 +36,7 @@ Then:The templates for these tests, by contention, would be put in the app's templates directory as `templates/${APPNAME}/tests/ui`.-## Email testing+### Email TestingThere are some helper base classes to test viewing email formatting and sending emails.``` shelldiff --git a/docs/dev/Workflow.md b/docs/dev/Workflow.mdnew file mode 100644index 00000000..e7a74b4d--- /dev/null+++ b/docs/dev/Workflow.md@@ -0,0 +1,93 @@+<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">++# Development Workflow++- See the [Contributing Page](../../CONTRIBUTING.md) for general information about contributing.+- See the [Development Page](Setup.md) for how to set up your development environment.+- See the [Development Guidelines Page](Guidelines.md) for the projects best practices for development.++## Branching Strategy++- **Main Branch** (`master`): Stable, production-ready code. Only updated by the project maintainers.+- **Development Branch** (`staging`): Active development happens here. Pull requests target this branch, with maintainers controlling merges.+- **Feature Branches**: Contributors will fork the repo and branch off `staging` branch for their work. Anyone can fork the repository, create a feature branch and submit PRs against the `staging` branch.++## Making Changes - Overview++- Always work off the latest `staging` branch to avoid merge conflicts.+- Create an issue and a branch (issues highly encouraged for most PRs).+- Do your thing and add to and/or change the code: use clear commit messages.+- Create a PR: should be focused on a single feature or fix.++## Ensure Your Code is in Sync++Switch to your local copy of staging branch:+``` shell+git checkout staging+```++Fetch the latest changes from upstream:+``` shell+git fetch upstream+```++Merge upstream changes into your fork's dev branch:+``` shell+git merge upstream/staging+```++Push the updated dev branch to your fork:+``` shell+git push origin staging+```++## Create an Issue and Branch++All PRs are encouraged to be associated with an issue and the branch should use the issue number in its name. For minor fixes, or test-only changes, skipping an issue is OK, but anything more substantial should have an issue for discussions and reference.++Issues (and hence branches) come in a few flavors with associated conventions. In general, a branch will have both the issue number and a user-chosen, short mnemonic to be slightly more descriptive. Here are the conventions:++| Type | Issue? | Branch | Notes |+|----------|-----|-----------------------------------|---------------|+| feature | YES | feature/$(ISSUE_NUM}-${MNEMONIC} | New Development |+| bugfix | YES | bugfix/$(ISSUE_NUM}-${MNEMONIC} | Bug Fixes |+| docs | YES | docs/$(ISSUE_NUM}-${MNEMONIC} | Documentation |+| ops | YES | ops/$(ISSUE_NUM}-${MNEMONIC} | Non-app, deployment, etc. |+| tests | NO | tests/${MNEMONIC} | For test-only changes |+| refactor | YES | refactor/$(ISSUE_NUM}-${MNEMONIC} | Only if no new behaviors |+| tweak | NO | tweak/${MNEMONIC} | For small, obvious PRs |++If you are contributing something new, without an existing issue, please create an issue first using the appropriate template: feature, bugfix, etc.. It is generally always better to think about what you are about to do before doing it. Creating an issue is a forcing function for thinking through and communicating your plans.++Once your code is up-to-date, an issue number exists and a mnemonic chosen, you can create your local branch off the current staging branch:+``` shell+git checkout -b feature/$(ISSUE_NUM}-${MNEMONIC} upstream/staging+```++## Do Your Thing++- Make your changes to the code.+- Test your changes locally (and add unit tests).+- Stage changes: `git add .`+- Commit changes: `git commit -m "Add feature: [brief description]"`+- Push branch to your fork: `git push origin feature/$(ISSUE_NUM}-${MNEMONIC}`++## Submit a Pull Request (PR)++- Go to your fork on GitHub: https://github.com/${YOURUSERNAME}/home-information+- Click the "Compare & pull request" button that appears after your push.+- Ensure the base repository is set to `cassandra/home-information -> staging`+- Ensure the compare branch is set to: `${YOURUSERNAME}/home-information -> feature/${YOUR_FEATURE_NAME}`+- Fill out the PR template (describe what your change does).+- Submit the PR and wait for review!++## PR Reviews++During PR review, a decision will be made on whether to squash or rebase:+- **Squash and Merge (default)**: For most PRs+- **Rebase and Merge**: for well-structured PRs that need commit history++## Post-PR Cleanup++- After merging, you should consider deleting the branch to keep your forked repository clean.+- Get your local and forked `staging` branch up to date with the upstream changes (see above).diff --git a/docs/dev/Workflow.md.html b/docs/dev/Workflow.md.htmlnew file mode 100644index 00000000..889f68d6--- /dev/null+++ b/docs/dev/Workflow.md.html@@ -0,0 +1,374 @@+<!DOCTYPE html>+<html>+ <head>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">+ <title>Workflow.md.html</title>+ <style>+ /* This CSS is originated from a following sites.+ https://github.com/magnetikonline/ghmarkdownrender */+ body {+ background: #fff;+ color: #333;+ font: 16px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';+ width: 50em;+ border: 1px solid #ddd;+ outline: 1300px solid #fff;+ margin: 20px auto;+ padding: 40px;+ }+ #frame {+ border: 1px solid #ddd;+ border-radius: 3px;+ margin: 0 auto;+ width: 978px;+ }+ #markdown {+ padding: 45px;+ }+ #markdown > *:first-child {+ margin-top: 0;+ }+ #markdown > *:last-child {+ margin-bottom: 0;+ }+ h1,h2,h3,h4,h5,h6 {+ font-weight: 600;+ line-height: 1.25;+ margin: 24px 0 16px;+ padding: 0;+ }+ h1,h2 {+ padding-bottom: 0.3em;+ }+ h1 {+ border-bottom: 1px solid #eee;+ font-size: 2em;+ }+ h2 {+ border-bottom: 1px solid #eee;+ font-size: 1.5em;+ }+ h3 {+ font-size: 1.25em;+ }+ h4 {+ font-size: 1em;+ }+ h5 {+ font-size: 0.875em;+ }+ h6 {+ color: #777;+ font-size: 0.85em;+ }+ a {+ color: #4183c4;+ text-decoration: none;+ }+ a:hover {+ text-decoration: underline;+ }+ blockquote,dl,ol,p,pre,table,ul {+ margin: 0 0 16px;+ padding: 0;+ }+ blockquote {+ border-left: 0.25em solid #ddd;+ color: #777;+ padding: 0 1em;+ }+ blockquote > *:first-child {+ margin-top: 0;+ }+ blockquote > *:last-child {+ margin-bottom: 0+ }+ hr {+ background: #e7e7e7;+ border: 0;+ height: 0.25em;+ margin: 24px 0;+ overflow: hidden;+ padding: 0;+ }+ hr:before,+ hr:after {+ content: '';+ display: table;+ }+ hr:after {+ clear: both;+ }+ img {+ background: #fff;+ border: 0;+ box-sizing: content-box;+ max-width: 100%;+ }+ kbd {+ background: #fcfcfc;+ border-bottom-color: #bbb;+ border-radius: 3px;+ border: 1px solid #ccc;+ box-shadow: inset 0 -1px 0 #bbb;+ color: #555;+ display: inline-block;+ font: 11px/10px Consolas,'Liberation Mono',Menlo,Courier,monospace;+ padding: 3px 5px;+ vertical-align: middle;+ }+ ol,ul {+ padding-left: 2em;+ }+ ol ol,+ ol ul,+ ul ol,+ ul ul {+ margin-bottom: 0;+ margin-top: 0;+ }+ ol ol,+ ul ol {+ list-style-type: lower-roman;+ }+ li + li {+ margin-top: 0.25em;+ }+ li > p {+ margin-top: 16px;+ }+ table {+ border-collapse: collapse;+ border-spacing: 0;+ }+ table tr {+ background: #fff;+ border-top: 1px solid #ccc;+ }+ table tr:nth-child(2n) {+ background: #f8f8f8;+ }+ table th,+ table td {+ border: 1px solid #ddd;+ padding: 6px 13px;+ }+ table th {+ font-weight: bold;+ }+ code,pre,tt {+ font-family: Consolas,'Liberation Mono',Menlo,Courier,monospace;+ font-size: 12px;+ }+ code,tt {+ background: rgba(0,0,0,0.04);+ border-radius: 3px;+ font-size: 85%;+ margin: 0;+ padding: 0.2em 0;+ }+ code {+ white-space: nowrap;+ }+ code:before,+ code:after,+ tt:before,+ tt:after {+ content: '\\00a0';+ letter-spacing: -0.2em;+ }+ pre {+ background: #f7f7f7;+ border-radius: 3px;+ font-size: 85%;+ line-height: 1.45;+ overflow: auto;+ padding: 16px;+ }+ pre code,+ pre tt {+ background: transparent;+ border: 0;+ margin: 0;+ padding: 0;+ }+ pre > code {+ background: transparent;+ font-size: 100%;+ white-space: pre;+ }+ pre > code:before,+ pre > code:after {+ content: normal;+ }+ h1 code,h1 tt,+ h2 code,h2 tt,+ h3 code,h3 tt,+ h4 code,h4 tt,+ h5 code,h5 tt,+ h6 code,h6 tt {+ font-size: inherit;+ }+ .highlight { margin-bottom: 16px; }+ .pl-c { color: #969896; }+ .pl-c1,.pl-s .pl-v { color: #0086b3; }+ .pl-e,.pl-en { color: #795da3; }+ .pl-ent { color: #63a35c; }+ .pl-id { color: #b52a1d; }+ .pl-ii { background-color: #b52a1d;color: #f8f8f8; }+ .pl-k { color: #a71d5d; }+ .pl-mb { color: #333;font-weight: bold; }+ .pl-md { background-color: #ffecec;color: #bd2c00; }+ .pl-mdr { color: #795da3;font-weight: bold; }+ .pl-mh,.pl-mh .pl-en,.pl-ms { color: #1d3e81;font-weight: bold; }+ .pl-mi { color: #333;font-style: italic; }+ .pl-mi1 { background-color: #eaffea;color: #55a532; }+ .pl-ml { color: #693a17; }+ .pl-mo { color: #1d3e81; }+ .pl-mq { color: #008080; }+ .pl-s,.pl-pds,.pl-s .pl-pse .pl-s1,.pl-sr,.pl-sr .pl-cce,.pl-sr .pl-sre,.pl-sr .pl-sra { color: #183691; }+ .pl-smi,.pl-s .pl-s1 { color: #333; }+ .pl-sr .pl-cce { color: #63a35c;font-weight: bold; }+ .pl-v { color: #ed6a43; }+ #footer {+ color: #777;+ font-size: 11px;+ margin: 10px auto;+ text-align: right;+ white-space: nowrap;+ width: 978px;+ }+ </style>+ </head>+ <body>+ <p><a target="_blank" rel="noopener noreferrer" href="../../src/hi/static/img/hi-logo-w-tagline-197x96.png"><img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128" style="max-width: 100%;"></a></p>+<div class="markdown-heading"><h1 class="heading-element">Development Workflow</h1><a id="user-content-development-workflow" class="anchor" aria-label="Permalink: Development Workflow" href="#development-workflow"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>See the <a href="../../CONTRIBUTING.md">Contributing Page</a> for general information about contributing.</li>+<li>See the <a href="Setup.md">Development Page</a> for how to set up your development environment.</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Branching Strategy</h2><a id="user-content-branching-strategy" class="anchor" aria-label="Permalink: Branching Strategy" href="#branching-strategy"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>+<strong>Main Branch</strong> (<code>master</code>): Stable, production-ready code. Only updated by the prohect maintainers.</li>+<li>+<strong>Development Branch</strong> (<code>staging</code>): Active development happens here. Pull requests target this branch, with maintainers controlling merges.</li>+<li>+<strong>Feature Branches</strong>: Contributors will fork the repo and branch off <code>staging</code> branch for their work. Anyone can fork the repository, create a feature branch and submit PRs against the <code>staging</code> branch.</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Making Changes - Overview</h2><a id="user-content-making-changes---overview" class="anchor" aria-label="Permalink: Making Changes - Overview" href="#making-changes---overview"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>Always work off the latest <code>staging</code> branch to avoid merge conflicts.</li>+<li>Create an issue and a branch (issues highly encouraged for most PRs).</li>+<li>Do your thing and add to and/or change the code: use clear commit messages.</li>+<li>Create a PR: should be focused on a single feature or fix.</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Ensure Your Code is in Sync</h2><a id="user-content-ensure-your-code-is-in-sync" class="anchor" aria-label="Permalink: Ensure Your Code is in Sync" href="#ensure-your-code-is-in-sync"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>Switch to your local copy of staging branch:</p>+<div class="highlight highlight-source-shell"><pre>git checkout staging</pre></div>+<p>Fetch the latest changes from upstream:</p>+<div class="highlight highlight-source-shell"><pre>git fetch upstream</pre></div>+<p>Merge upstream changes into your fork's dev branch:</p>+<div class="highlight highlight-source-shell"><pre>git merge upstream/staging</pre></div>+<p>Push the updated dev branch to your fork:</p>+<div class="highlight highlight-source-shell"><pre>git push origin staging</pre></div>+<div class="markdown-heading"><h2 class="heading-element">Create an Issue and Branch</h2><a id="user-content-create-an-issue-and-branch" class="anchor" aria-label="Permalink: Create an Issue and Branch" href="#create-an-issue-and-branch"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>All PRs are encouraged to be associated with an issue and the branch should use the issue number in its name. For minor fixes, or test-only changes, skipping an issue is OK, but anything more substantial should have an issue for discussions and reference.</p>+<p>Issues (and hence branches) come in a few flavors with associated conventions. In generalm a branch will have both the issue number and a user-chosen, short mnemonic to be slightly more descriptive. Here are the conventions:</p>+<table>+<thead>+<tr>+<th>Type</th>+<th>Issue?</th>+<th>Branch</th>+<th>Notes</th>+</tr>+</thead>+<tbody>+<tr>+<td>feature</td>+<td>YES</td>+<td>feature/$(ISSUE_NUM}-${MNEMONIC}</td>+<td>New Development</td>+</tr>+<tr>+<td>bugfix</td>+<td>YES</td>+<td>bugfix/$(ISSUE_NUM}-${MNEMONIC}</td>+<td>Bug Fixes</td>+</tr>+<tr>+<td>docs</td>+<td>YES</td>+<td>docs/$(ISSUE_NUM}-${MNEMONIC}</td>+<td>Documentation</td>+</tr>+<tr>+<td>ops</td>+<td>YES</td>+<td>ops/$(ISSUE_NUM}-${MNEMONIC}</td>+<td>Non-app, deployment, etc.</td>+</tr>+<tr>+<td>tests</td>+<td>NO</td>+<td>tests/${MNEMONIC}</td>+<td>For test-only changes</td>+</tr>+<tr>+<td>refactor</td>+<td>YES</td>+<td>refactor/$(ISSUE_NUM}-${MNEMONIC}</td>+<td>Only if no new behaviors</td>+</tr>+<tr>+<td>tweak</td>+<td>NO</td>+<td>tweak/${MNEMONIC}</td>+<td>For small, obvious PRs</td>+</tr>+</tbody>+</table>+<p>If you are contributing something new, without an existing issue, please create an issue first using the appropriate template: feature, bugfix, etc.. It is generally always better to think about what you are about to do before doing it. Creating an issue is a forcing function for thinking through and communicating your plans.</p>+<p>Once your code is up-to-date, an issue number exists and a mnemonic chosen, you can create your local branch off the current staging branch:</p>+<div class="highlight highlight-source-shell"><pre>git checkout -b feature/<span class="pl-s"><span class="pl-pds">$(</span>ISSUE_NUM}-<span class="pl-smi">${MNEMONIC}</span> upstream/staging</span></pre></div>+<div class="markdown-heading"><h2 class="heading-element">Do Your Thing</h2><a id="user-content-do-your-thing" class="anchor" aria-label="Permalink: Do Your Thing" href="#do-your-thing"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>Make your changes to the code.</li>+<li>Test your changes locally (and add unit tests).</li>+<li>Stage changes: <code>git add .</code>+</li>+<li>Commit changes: <code>git commit -m "Add feature: [brief description]"</code>+</li>+<li>Push branch to your fork: <code>git push origin feature/$(ISSUE_NUM}-${MNEMONIC}</code>+</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Submit a Pull Request (PR)</h2><a id="user-content-submit-a-pull-request-pr" class="anchor" aria-label="Permalink: Submit a Pull Request (PR)" href="#submit-a-pull-request-pr"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>Go to your fork on GitHub: <a href="https://github.com/$%7BYOURUSERNAME%7D/home-information">https://github.com/${YOURUSERNAME}/home-information</a>+</li>+<li>Click the "Compare & pull request" button that appears after your push.</li>+<li>Ensure the base repository is set to <code>cassandra/home-information -> staging</code>+</li>+<li>Ensure the compare branch is set to: <code>${YOURUSERNAME}/home-information -> feature/${YOUR_FEATURE_NAME}</code>+</li>+<li>Fill out the PR template (describe what your change does).</li>+<li>Submit the PR and wait for review!</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">PR Reviews</h2><a id="user-content-pr-reviews" class="anchor" aria-label="Permalink: PR Reviews" href="#pr-reviews"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<p>During PR review, a decision will be made on whether to squash or rebase:</p>+<ul>+<li>+<strong>Squash and Merge (default)</strong>: For most PRs</li>+<li>+<strong>Rebase and Merge</strong>: for well-structured PRs that need commit history</li>+</ul>+<div class="markdown-heading"><h2 class="heading-element">Post-PR Cleanup</h2><a id="user-content-post-pr-cleanup" class="anchor" aria-label="Permalink: Post-PR Cleanup" href="#post-pr-cleanup"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>+<ul>+<li>After merging, you should consider deleting the branch to keep your forked repository clean.</li>+<li>Get your local and forked <code>staging</code> branch up to date with the upstream changes (see above).</li>+</ul>++ </body>+</html>