Skip to content

Commit

Permalink
Merge pull request #54 from nautobot/develop
Browse files Browse the repository at this point in the history
2.0 release prep
  • Loading branch information
glennmatthews authored Sep 29, 2023
2 parents 04db3b9 + d83f258 commit 626ce31
Show file tree
Hide file tree
Showing 42 changed files with 1,332 additions and 1,186 deletions.
58 changes: 29 additions & 29 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"cookiecutter": {
"codeowner_github_usernames": "\\",
"full_name": "Network to Code, LLC",
"email": "info@networktocode.com",
"github_org": "nautobot",
"plugin_name": "nautobot_floor_plan",
"verbose_name": "Nautobot Floor Plan",
"plugin_slug": "nautobot-floor-plan",
"project_slug": "nautobot-plugin-floor-plan",
"repo_url": "https://github.com/nautobot/nautobot-plugin-floor-plan",
"base_url": "floor-plan",
"min_nautobot_version": "1.5.0",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "FloorPlan",
"project_short_description": "Nautobot Floor Plan",
"version": "0.1.0",
"model_class_name": "FloorPlan",
"open_source_license": "Apache-2.0",
"docs_base_url": "https://docs.nautobot.com",
"docs_app_url": "https://docs.nautobot.com/projects/floor-plan/en/latest",
"_drift_manager": {
"template": "https://github.com/networktocode-llc/cookiecutter-ntc.git",
"template_dir": "nautobot-plugin",
"template_ref": "nautobot-plugin-v1.0",
"cookie_dir": "",
"branch_prefix": "drift-manager"
"cookiecutter": {
"codeowner_github_usernames": "\\",
"full_name": "Network to Code, LLC",
"email": "info@networktocode.com",
"github_org": "nautobot",
"plugin_name": "nautobot_floor_plan",
"verbose_name": "Nautobot Floor Plan",
"plugin_slug": "nautobot-floor-plan",
"project_slug": "nautobot-plugin-floor-plan",
"repo_url": "https://github.com/nautobot/nautobot-plugin-floor-plan",
"base_url": "floor-plan",
"min_nautobot_version": "1.5.0",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "FloorPlan",
"project_short_description": "Nautobot Floor Plan",
"version": "0.1.0",
"model_class_name": "FloorPlan",
"open_source_license": "Apache-2.0",
"docs_base_url": "https://docs.nautobot.com",
"docs_app_url": "https://docs.nautobot.com/projects/floor-plan/en/latest",
"_drift_manager": {
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
"template_dir": "nautobot-app",
"template_ref": "develop",
"cookie_dir": "",
"branch_prefix": "drift-manager"
}
}
}
}
}
6 changes: 3 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
# E501: Line length is enforced by Black, so flake8 doesn't need to check it
# W503: Black disagrees with this rule, as does PEP 8; Black wins
ignore = E501, W503
ignore =
E501, # Line length is enforced by Black, so flake8 doesn't need to check it
W503 # Black disagrees with this rule, as does PEP 8; Black wins
exclude =
migrations,
__pycache__,
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
INVOKE_NAUTOBOT_FLOOR_PLAN_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v5"
- name: "Linting: pydocstyle"
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.8"]
nautobot-version: ["1.5.0"]
nautobot-version: ["2.0.0"]
env:
INVOKE_NAUTOBOT_FLOOR_PLAN_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_FLOOR_PLAN_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -119,13 +119,9 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8"]
db-backend: ["postgresql"]
nautobot-version: ["stable"]
include:
- python-version: "3.8"
db-backend: "mysql"
nautobot-version: "1.5.0"
nautobot-version: ["2.0.0"]
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_FLOOR_PLAN_PYTHON_VER: "${{ matrix.python-version }}"
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/rebake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "Rebake Cookie"
on: # yamllint disable-line rule:truthy
schedule:
# Every Saturday at 5:00 am UTC
- cron: "0 5 * * 6"
workflow_dispatch:
inputs:
template-ref:
description: "The branch or tag to use for the template, using the value from .cookiecutter.json when empty"
default: ""
jobs:
rebake:
runs-on: "ubuntu-22.04"
permissions:
actions: "write"
contents: "write"
packages: "read"
pull-requests: "write"
container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:latest"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: "Configure"
id: "config"
run: |
export REBAKE_ARGS='--push'
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
export REBAKE_ARGS="$REBAKE_ARGS --template-ref='${{ github.event.inputs.template-ref }}'"
fi
echo "rebake-args='$REBAKE_ARGS'" >> $GITHUB_OUTPUT
- name: "Rebake"
run: |
python -m ntc_cookie_drift_manager rebake ${{ steps.config.outputs.rebake-args }} '${{ github.repositoryUrl }}'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,6 @@ invoke.yml
docs/README.md
docs/CHANGELOG.md
public
/compose.yaml
/dump.sql
/nautobot_floor_plan/static/
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rules:
quote-type: "double"
ignore: |
.venv/
compose.yaml
8 changes: 4 additions & 4 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# -------------------------------------------------------------------------------------
# !!! USE CAUTION WHEN MODIFYING LINES BELOW

# Accepts a desired Nautobot version as build argument, default to 1.4
ARG NAUTOBOT_VER="1.4"
# Accepts a desired Nautobot version as build argument, default to `2.0.0`
ARG NAUTOBOT_VER="2.0.0"

# Accepts a desired Python version as build argument, default to 3.8
ARG PYTHON_VER="3.8"
Expand All @@ -26,7 +26,7 @@ ENV NAUTOBOT_ROOT ${NAUTOBOT_ROOT}
# and CI and local development may have a newer version of Poetry
# Since this is only used for development and we don't ship this container, pinning Poetry back is not expressly necessary
# We also don't need virtual environments in container
RUN curl -sSL https://install.python-poetry.org | python3 - && \
RUN which poetry || curl -sSL https://install.python-poetry.org | python3 - && \
poetry config virtualenvs.create false

# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
Expand Down Expand Up @@ -68,7 +68,7 @@ RUN sort poetry_freeze_base.txt poetry_freeze_all.txt | uniq -u > poetry_freeze_

# Install all local project as editable, constrained on Nautobot version, to get any additional
# direct dependencies of the app
RUN pip install -c constraints.txt -e .
RUN pip install -c constraints.txt -e .[all]

# Install any dev dependencies frozen from Poetry
# Can be improved in Poetry 1.2 which allows `poetry install --only dev`
Expand Down
2 changes: 1 addition & 1 deletion development/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ services:
db:
condition: "service_healthy"
<<:
- *nautobot-build
- *nautobot-base
- *nautobot-build
worker:
entrypoint:
- "sh"
Expand Down
4 changes: 4 additions & 0 deletions development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
healthcheck:
test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test
docs:
entrypoint: "mkdocs serve -v -a 0.0.0.0:8080"
ports:
Expand All @@ -30,6 +32,8 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
healthcheck:
test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test
# To expose postgres or redis to the host uncomment the following
# postgres:
# ports:
Expand Down
8 changes: 7 additions & 1 deletion development/docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ services:
image: "mysql:8"
command:
- "--default-authentication-plugin=mysql_native_password"
- "--max_connections=1000"
env_file:
- "development.env"
- "creds.env"
- "development_mysql.env"
volumes:
- "mysql_data:/var/lib/mysql"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test:
- "CMD"
- "mysqladmin"
- "ping"
- "-h"
- "localhost"
timeout: "20s"
retries: 10
volumes:
Expand Down
3 changes: 3 additions & 0 deletions development/docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ services:
- "NAUTOBOT_DB_ENGINE=django.db.backends.postgresql"
db:
image: "postgres:13-alpine"
command:
- "-c"
- "max_connections=200"
env_file:
- "development.env"
- "creds.env"
Expand Down
10 changes: 5 additions & 5 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os
import sys

from nautobot.core.settings import * # noqa: F403
from nautobot.core.settings_funcs import parse_redis_connection
from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import
from nautobot.core.settings_funcs import parse_redis_connection, is_truthy


#
Expand Down Expand Up @@ -46,7 +46,9 @@
# Debug
#

DEBUG = True
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False))

TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

# Django Debug Toolbar
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: DEBUG and not TESTING}
Expand All @@ -62,8 +64,6 @@

LOG_LEVEL = "DEBUG" if DEBUG else "INFO"

TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

# Verbose logging during normal development operation, but quiet logging during unit test execution
if not TESTING:
LOGGING = {
Expand Down
1 change: 1 addition & 0 deletions docs/admin/compatibility_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Because this App depends on Nautobot's `Location` data model, which was introduc
| Nautobot Floor Plan Version | Nautobot First Support Version | Nautobot Last Support Version |
| --------------------------- | ------------------------------ | ----------------------------- |
| 1.0.X | 1.4.0 | 1.99.99 |
| 2.0.X | 2.0.0 | 2.99.99 |
14 changes: 14 additions & 0 deletions docs/admin/release_notes/version_2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# v2.0 Release Notes

This document describes all new features and changes in the release `2.0`. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Release Overview

Updated `nautobot` to `2.0.0`.

## [v2.0.0] - 2023-09-29

### Changed

- Updated `nautobot` to `2.0.0`.
- Renamed `tag` to `tags` filter field for both, `FloorPlan` and `FloorPlanTile` filters.
37 changes: 7 additions & 30 deletions docs/admin/uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,15 @@ Here you will find any steps necessary to cleanly remove the App from your Nauto

## Database Cleanup

Delete any and all ObjectChange records relating to the models provided by this App. This can be done manually through the Nautobot UI, or by running commands through `nautobot-server nbshell` such as:
Prior to removing the plugin from the `nautobot_config.py`, run the following command to roll back any migration specific to this plugin.

```python
>>> from django.contrib.contenttypes.models import ContentType
>>> from nautobot.extras.models import ObjectChange
>>> from nautobot_floor_plan.models import FloorPlan, FloorPlanTile
>>> ct = ContentType.objects.get_for_model(FloorPlan)
>>> ct2 = ContentType.objects.get_for_model(FloorPlanTile)
>>> ObjectChange.objects.filter(changed_object_type__in=(ct, ct2)).delete()
```shell
nautobot-server migrate nautobot_plugin_floor_plan zero
```

Additionally, remove the `nautobot_floor_plan | floor_plan_tile` content-type from any and all Status records in Nautobot. This can be done manually through the Nautobot UI, or by running commands through `nautobot-server nbshell` such as:
!!! warning "Developer Note - Remove Me!"
Any other cleanup operations to ensure the database is clean after the app is removed. Is there anything else that needs cleaning up, such as CFs, relationships, etc. if they're no longer desired?

```python
>>> from django.contrib.contenttypes.models import ContentType
>>> from nautobot.extras.models import Status
>>> from nautobot_floor_plan.models import FloorPlanTile
>>> ct = ContentType.objects.get_for_model(FloorPlanTile)
>>> for status in Status.objects.filter(content_types=ct):
... status.content_types.remove(ct)
...
>>>
```

If you've defined any Nautobot extensibility features (webhooks, export templates, custom fields, relationships, etc.) that use or relate to the models included by this App, be sure to delete those records as well.

Finally, run the command `nautobot-server migrate nautobot_floor_plan zero` to remove the database tables added by this App from your Nautobot database.

## Uninstall Guide

After performing the above database cleanup, you can then remove the App from the Nautobot environment:
## Remove App configuration

- Remove `"nautobot_floor_plan"` from the `PLUGINS` list in your `nautobot_config.py` and restart the Nautobot services.
- Run `nautobot-server post_upgrade`.
- Optionally, uninstall the plugin from your environment with `pip remove nautobot-floor-plan` or equivalent.
Remove the configuration you added in `nautobot_config.py` from `PLUGINS` & `PLUGINS_CONFIG`.
9 changes: 9 additions & 0 deletions docs/assets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
font-size: 0.7rem;
}

/*
* The default max-width is 61rem which does not provide nearly enough space to present code examples or larger tables
*/
.md-grid {
margin-left: auto;
margin-right: auto;
max-width: 95%;
}

.md-tabs__link {
font-size: 0.8rem;
}
Expand Down
9 changes: 3 additions & 6 deletions docs/dev/dev_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ The project features a CLI helper based on [Invoke](https://www.pyinvoke.org/) t

Each command can be executed with `invoke <command>`. All commands support the arguments `--nautobot-ver` and `--python-ver` if you want to manually define the version of Python and Nautobot to use. Each command also has its own help `invoke <command> --help`

!!! note
To run the mysql (mariadb) development environment, set the environment variable as such `export NAUTOBOT_USE_MYSQL=1`.

#### Local Development Environment

```shell
Expand Down Expand Up @@ -400,7 +397,7 @@ namespace.configure(
)
```

Or set the `INVOKE_NAUTOBOT_GOLDEN_CONFIG_PYTHON_VER` variable.
Or set the `INVOKE_NAUTOBOT_FLOOR_PLAN_PYTHON_VER` variable.

### Updating Nautobot Version

Expand All @@ -412,8 +409,8 @@ namespace.configure(
{
"nautobot_floor_plan": {
...
"nautobot_ver": "1.0.2",
...
"nautobot_ver": "1.5.0",
...
}
}
)
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
griffe==0.30.1
mkdocs==1.3.1
mkdocs-material==8.4.2
mkdocs==1.4.3
mkdocs-material==9.1.15
mkdocstrings==0.22.0
mkdocstrings-python==1.1.2
mkdocs-version-annotations==1.0.0
Loading

0 comments on commit 626ce31

Please sign in to comment.