### Install and Start Docker Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Use these commands to set up the development environment with Docker. This includes installing necessary plugins, activating a virtual environment, installing dependencies, and building/starting the services. ```shell poetry self add poetry-plugin-shell poetry shell poetry install invoke build invoke start ``` -------------------------------- ### Install and Start Local Poetry Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Commands to set up and run the development environment using a local Poetry setup. This includes installing dependencies with optional extras, sourcing environment variables, and starting the Nautobot server. ```shell poetry self add poetry-plugin-shell poetry shell poetry install --extras nautobot export $(cat development/development.env | xargs) export $(cat development/creds.env | xargs) invoke start && sleep 5 nautobot-server migrate ``` -------------------------------- ### Post-Bake Setup Commands Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/user/quick-start.md After baking the cookie, run these commands within the generated project directory to install dependencies, set up the environment, and format the code. ```shell poetry lock poetry install poetry self add poetry-plugin-shell poetry shell invoke makemigrations invoke autoformat ``` -------------------------------- ### Local Poetry Development Setup Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Use these commands to set up a local development environment with Poetry. This includes adding a plugin, activating the shell, installing dependencies, and running tests. ```shell poetry self add poetry-plugin-shell poetry shell poetry install invoke tests ``` -------------------------------- ### Changelog Fragment Examples Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/contributing.md Examples of correct and incorrect changelog fragment files. Ensure summaries are complete sentences in the past tense, starting with a capital letter and ending with a period. ```plaintext changes/1234.fixed fix critical bug in documentation ``` ```plaintext changes/1234.fixed Fixed critical bug in documentation. ``` -------------------------------- ### Install App from PyPI Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md Install the app using pip. This is the recommended method for most users. ```shell pip install {{ cookiecutter.app_slug }} ``` -------------------------------- ### Docker Development Environment Installation Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md After installing Poetry and Docker, run these commands in the repository root to install dependencies and set up the development environment. ```shell poetry install poetry self add poetry-plugin-shell poetry shell invoke build invoke tests ``` -------------------------------- ### Serve Documentation Locally with MkDocs Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Start a local development server to view and test documentation changes. ```bash poetry run mkdocs serve ``` -------------------------------- ### Install Refreshed Packages with Poetry Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Install all updated package versions defined in poetry.lock. ```bash poetry install ``` -------------------------------- ### Example GitHub Release Notes Structure Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md A template for structuring release notes on GitHub, including sections for changes, contributors, and new contributors. ```markdown ## What's Changed **Towncrier generated Changed/Fixed/Housekeeping etc. sections here** ## Contributors * @alice * @bob ## New Contributors * @bob **Full Changelog**: {{ cookiecutter.repo_url }}/compare/v1.4.1...v1.4.2 ``` -------------------------------- ### Run Nautobot Server Locally Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Command to start the Nautobot development server when using the local Poetry setup. It's recommended to run this in a separate shell. ```shell nautobot-server runserver 0.0.0.0:8080 --insecure ``` -------------------------------- ### Example Git Commands for Release Branch Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Commands to create a release branch, stage changes, and commit them. ```bash git switch -c release-1.4.2 develop git add mkdocs.yml pyproject.toml git diff --cached git commit -m "Release v1.4.2" git push ``` -------------------------------- ### Multiple Changelog Entries Example Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/contributing.md Demonstrates how to create multiple entries within the same changelog fragment file for different categories. Each line generates a separate entry. ```plaintext changes/1234.fixed Fixed critical bug in documentation. Fixed release notes generation. ``` ```plaintext changes/1234.changed Changed release notes generation. ``` -------------------------------- ### Install Additional Python Packages Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Add new Python packages using Poetry. After installation, stop containers, rebuild the Docker image, and restart all containers to apply changes. ```bash ➜ poetry add ``` ```bash ➜ invoke stop ➜ invoke build ➜ invoke start ``` -------------------------------- ### Start Development Environment with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Starts the Docker containers for the Nautobot development environment in detached mode. This command sets up networks and volumes for the services. ```bash ➜ invoke start Starting Nautobot in detached mode... Running docker-compose command "up --detach" Creating network "{{ cookiecutter.app_name }}_default" with the default driver Creating volume "{{ cookiecutter.app_name }}_postgres_data" with default driver Creating {{ cookiecutter.app_name }}_redis_1 ... Creating {{ cookiecutter.app_name }}_docs_1 ... Creating {{ cookiecutter.app_name }}_postgres_1 ... Creating {{ cookiecutter.app_name }}_postgres_1 ... done Creating {{ cookiecutter.app_name }}_redis_1 ... done Creating {{ cookiecutter.app_name }}_nautobot_1 ... Creating {{ cookiecutter.app_name }}_docs_1 ... done Creating {{ cookiecutter.app_name }}_nautobot_1 ... done Creating {{ cookiecutter.app_name }}_worker_1 ... Creating {{ cookiecutter.app_name }}_worker_1 ... done Docker Compose is now in the Docker CLI, try `docker compose up` ``` -------------------------------- ### Install Cookiecutter and Create Nautobot App Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/README.md Installs the cookiecutter package and then uses it to generate a new Nautobot App project from the official template. Ensure Python 3.10-3.14 with pip is installed beforehand. ```shell pip install cookiecutter mkdir outputs ``` ```shell cookiecutter \ --output-dir=./outputs \ --directory=nautobot-app \ https://github.com/nautobot/cookiecutter-nautobot-app ``` -------------------------------- ### Add Python Package Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Installs a new Python package into the project's environment using Poetry. After installation, the environment typically needs to be rebuilt and restarted. ```bash ➜ poetry add ``` -------------------------------- ### Copy Nautobot Credentials File Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Copy the example credentials file to create/overwrite the local development credentials file. This file stores sensitive information like passwords and tokens. ```shell cp development/creds.example.env development/creds.env ``` -------------------------------- ### Install Additional Nautobot App Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Use this command to add external Nautobot apps to your project's dependencies. Ensure your virtual environment is activated. ```bash ➜ poetry add nautobot-chatops ``` -------------------------------- ### Poetry Virtual Environment Commands Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Commands for managing Python dependencies and virtual environments using Poetry. 'poetry shell' activates the virtual environment, and 'poetry install' installs project dependencies. ```shell poetry shell poetry install ``` -------------------------------- ### Invoke CLI Helper Commands: Dev Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md These commands manage the development container lifecycle, including building images, starting, stopping, restarting, and destroying containers, as well as viewing logs. ```shell invoke build invoke debug invoke destroy invoke restart invoke start invoke stop invoke logs ``` -------------------------------- ### Build Docker Image with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Builds the Docker image required for Nautobot and its Celery worker service. This command installs the specified Nautobot version. ```bash ➜ invoke build ... #14 exporting to image #14 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00 #14 exporting layers #14 exporting layers 1.2s done #14 writing image sha256:2d524bc1665327faa0d34001b0a9d2ccf450612bf8feeb969312e96a2d3e3503 done #14 naming to docker.io/{{ cookiecutter.app_slug }}/nautobot:{{ min_nautobot_version }}-py3.12 done ``` -------------------------------- ### Create Release Branch and Bump Version Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Use these commands to create a new release branch from 'main' and bump the development version using poetry. ```bash git switch -c release-1.4.2-to-develop main poetry version prepatch ``` -------------------------------- ### Run Prepare Release GitHub Workflow Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Initiate the 'Prepare Release' GitHub workflow to automate branch creation, version bumping, and release note generation. Ensure the correct version bump type and source branch are selected. ```bash {{ cookiecutter.repo_url }}/actions/workflows/prepare_release.yml ``` -------------------------------- ### Enter iPython Shell Plus Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Launch an enhanced iPython shell that automatically imports all Nautobot models. This provides a more powerful interactive development environment. ```bash ➜ invoke shell-plus ``` -------------------------------- ### Fetch and Update Local Branches Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Ensure local branches are up to date with upstream before starting a release. ```bash git fetch git switch develop && git pull # and repeat for main/ltm ``` -------------------------------- ### Create Release Branch and Bump Version Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Use these commands to create a new branch for release preparation and increment the development version. ```bash > git switch -c release-1.4.2-to-develop main Switched to a new branch 'release-1.4.2-to-develop' > poetry version prepatch Bumping version from 1.4.2 to 1.4.3a1 > git add pyproject.toml && git commit -m "Bump version" > git push ``` -------------------------------- ### Generate Release Notes with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Use the `invoke generate-release-notes` command to automatically create release notes. This command requires the project's poetry environment to be built. ```bash invoke generate-release-notes --version 1.4.2 ``` -------------------------------- ### Stop Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Use this command to safely shut down all running Docker containers for the project. To restart, use `invoke start`. ```bash ➜ invoke stop Stopping Nautobot... Running docker-compose command "down" Stopping {{ cookiecutter.app_name }}_worker_1 ... Stopping {{ cookiecutter.app_name }}_nautobot_1 ... Stopping {{ cookiecutter.app_name }}_docs_1 ... Stopping {{ cookiecutter.app_name }}_redis_1 ... Stopping {{ cookiecutter.app_name }}_postgres_1 ... Stopping {{ cookiecutter.app_name }}_worker_1 ... done Stopping {{ cookiecutter.app_name }}_nautobot_1 ... done Stopping {{ cookiecutter.app_name }}_postgres_1 ... done Stopping {{ cookiecutter.app_name }}_redis_1 ... done Stopping {{ cookiecutter.app_name }}_docs_1 ... done Removing {{ cookiecutter.app_name }}_worker_1 ... Removing {{ cookiecutter.app_name }}_nautobot_1 ... Removing {{ cookiecutter.app_name }}_docs_1 ... Removing {{ cookiecutter.app_name }}_redis_1 ... Removing {{ cookiecutter.app_name }}_postgres_1 ... Removing {{ cookiecutter.app_name }}_postgres_1 ... done Removing {{ cookiecutter.app_name }}_docs_1 ... done Removing {{ cookiecutter.app_name }}_worker_1 ... done Removing {{ cookiecutter.app_name }}_redis_1 ... done Removing {{ cookiecutter.app_name }}_nautobot_1 ... done Removing network {{ cookiecutter.app_name }}_default ``` -------------------------------- ### Run Tests and Linters with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Execute this Invoke command to run linters, check dependencies, build documentation, and run unit tests within the development container. ```bash ➜ invoke tests Running yamllint... Running poetry check... All set! Running pylint... -------------------------------------------------------------------- Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) Running mkdocs... INFO - Cleaning site directory INFO - Building documentation to directory: /home/whitej6/cookiecutter-nautobot-app/site INFO - The following pages exist in the docs directory, but are not included in the "nav" configuration: - admin/compatibility_matrix.md - admin/install.md - admin/upgrade.md - dev/contributing.md - dev/dev_environment.md - dev/extending.md - user/faq.md - user/quick-start.md INFO - Doc file 'index.md' contains an unrecognized relative link './nautobot-app', it was left as is. INFO - Doc file 'index.md' contains an unrecognized relative link './nautobot-app-ssot', it was left as is. INFO - Doc file 'index.md' contains an unrecognized relative link './nautobot-app-chatops', it was left as is. INFO - Documentation built in 0.35 seconds Running unit tests... ============================= test session starts ============================== platform linux -- Python 3.8.10, pytest-7.4.3, pluggy-1.3.0 rootdir: /home/whitej6/cookiecutter-nautobot-app configfile: pyproject.toml testpaths: nautobot-app/tests, nautobot-app-chatops/tests, nautobot-app-ssot/tests plugins: cookies-0.7.0 collected 6 items nautobot-app/tests/test_bake_nautobot_app.py .. [ 33%] nautobot-app-chatops/tests/test_bake_nautobot_app_chatops.py .. [ 66%] nautobot-app-ssot/tests/test_bake_nautobot_app_ssot.py .. [100%] ============================== 6 passed in 2.11s =============================== All tests have passed! ``` -------------------------------- ### Enable App in Nautobot Configuration Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md Configure your `nautobot_config.py` to enable the app by adding it to the `PLUGINS` list and configuring its settings in `PLUGINS_CONFIG`. ```python # In your nautobot_config.py PLUGINS = ["{{ cookiecutter.app_name }}"] # PLUGINS_CONFIG = { # "{{ cookiecutter.app_name }}": { # ADD YOUR SETTINGS HERE # } # } ``` -------------------------------- ### Configure Local Poetry Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Create an invoke.yml file to configure the local Poetry development environment. This allows running commands on the host instead of within Docker containers. ```yaml --- {{ cookiecutter.app_name }}: local: true ``` -------------------------------- ### Bake Nautobot SSoT App Cookie Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/README.md Use this command to generate a new Nautobot SSoT app project using the cookiecutter template. Ensure you have invoke installed. ```bash invoke bake --template nautobot-app-ssot ``` -------------------------------- ### Development Tasks with Ruff, Pylint, and Tests Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md These commands are available via Invoke for performing code formatting, linting, and running tests. ```bash ruff Run ruff to perform code formatting and/or linting. pylint Run pylint code analysis. markdownlint Run pymarkdown linting. tests Run all tests for this app. unittest Run Django unit tests for the app. ``` -------------------------------- ### Changelog Fragment - Correct Format Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/contributing.md Use this format for changelog fragments. Ensure the summary is a complete sentence in the past tense, starting with a capital letter and ending with a period. ```plaintext Fixed critical bug in documentation. ``` -------------------------------- ### Generate Release Notes with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Generate release notes using the invoke task, updating the changelog and staging relevant files. ```bash invoke generate-release-notes --version nautobot-app-v2.7.0 ``` -------------------------------- ### Run Post Upgrade Command Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/admin/install.md After updating the Nautobot configuration, run the `post_upgrade` command to apply migrations and clear the cache. ```shell nautobot-server post_upgrade ``` -------------------------------- ### Rebuild Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Execute these commands to stop the current environment, rebuild Docker images, and then restart the environment. This is necessary after updating environment variables or installing new Python packages. ```bash ➜ invoke stop ➜ invoke build ➜ invoke start ``` -------------------------------- ### Stage and Commit Release Changes Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Stage all generated release files, verify the diffs, and commit the changes. ```bash git add git diff --cached git commit -m "Release nautobot-app-v2.7.0" ``` -------------------------------- ### Create Nautobot App with JSON Replay Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/user/quick-start.md Use a JSON file to pre-fill cookiecutter prompts for creating a Nautobot application. Ensure to use `--overwrite-if-exists` if outputting to the same directory. ```json { "cookiecutter": { "codeowner_github_usernames": "@smith-ntc", "full_name": "Network to Code, LLC", "email": "info@networktocode.com", "github_org": "nautobot", "app_name": "my_app", "verbose_name": "My App", "app_slug": "my-app", "project_slug": "nautobot-app-my-app", "repo_url": "https://github.com/nautobot/nautobot-app-my-app", "base_url": "my-app", "camel_name": "MyApp", "project_short_description": "My App", "model_class_name": "None", "open_source_license": "Apache-2.0", "docs_base_url": "https://docs.nautobot.com", "docs_app_url": "https://docs.nautobot.com/projects/my-app/en/latest", "_template": "git@github.com:nautobot/cookiecutter-nautobot-app.git", "_output_dir": "/tmp", "_repo_dir": "~/.cookiecutters/cookiecutter-nautobot-app/nautobot-app", "_checkout": null } } ``` ```shell cookiecutter https://github.com/nautobot/cookiecutter-nautobot-app.git --directory=nautobot-app --replay-file=my-app.json --overwrite-if-exists ``` -------------------------------- ### Build Docker Image with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Use this Invoke command to build the necessary development container image. ```bash ➜ invoke build ... #15 [cookiecutter] exporting to image #15 exporting layers 1.1s done #15 writing image sha256:85627092abfb1f9abca3faf4990dfd413028bb6a55140125a50386776b9749c2 done #15 naming to docker.io/library/cookiecutter-nautobot-app:3.12 done #15 DONE 1.1s ``` -------------------------------- ### Prepare LTM Release Branch and Version Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Commands for creating a release branch from an LTM branch and updating the version. ```bash git switch -c release-2.4.99 ltm-2.4 poetry version patch ``` -------------------------------- ### Access iPython Shell Plus Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Launch an enhanced iPython shell that automatically imports all Nautobot models, providing a more convenient development and debugging experience. ```bash ➜ invoke shell-plus ``` ```bash ➜ invoke cli ➜ nautobot-server shell_plus ``` -------------------------------- ### Cookiecutter Help Command Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/user/quick-start.md Display all available command-line options for the cookiecutter tool. This is useful for understanding advanced usage and customization. ```shell cookiecutter --help ``` -------------------------------- ### Invoke CLI Helper Commands for Utility Tasks Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md These commands provide utility functions for the development environment, such as launching shells, creating users, and managing database migrations. ```shell cli Launch a bash shell inside the running Nautobot container. create-user Create a new user in django (default: admin), will prompt for password. makemigrations Run Make Migration in Django. nbshell Launch a nbshell session. ``` -------------------------------- ### Run Project Tests with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/release_checklist.md Execute all project tests using the invoke task runner. ```bash poetry run invoke tests ``` -------------------------------- ### Invoke CLI Helper Commands - Utility Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md These Invoke commands provide utility functions for the development environment. Use `invoke ` to execute them. ```shell cli Launch a bash shell inside the running Nautobot container. create-user Create a new user in django (default: admin), will prompt for password. makemigrations Run Make Migration in Django. bshell Launch a nbshell session. ``` -------------------------------- ### Generate Release Notes with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Use the `invoke generate-release-notes` command to automatically generate release notes. This command relies on the project's poetry environment and the `towncrier` package. ```bash invoke generate-release-notes ``` -------------------------------- ### Commit and Push Release Changes Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md After generating release notes and updating relevant files, stage all changes with `git add`, verify with `git diff --cached`, commit with `git commit`, and push with `git push`. ```bash git add mkdocs.yml pyproject.toml git diff --cached git commit -m "Release v1.4.2" git push ``` -------------------------------- ### Alternative iPython Shell Plus Command Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md An alternative method to launch the iPython shell plus using `invoke cli` followed by `nautobot-server shell_plus`. ```bash ➜ invoke cli ➜ nautobot-server shell_plus ``` -------------------------------- ### Run All Tests Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Executes all tests for the project, mirroring the tests run by TravisCI for pull requests. ```bash ➜ invoke tests ``` -------------------------------- ### Stop, Build, and Test Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md A sequence of commands to stop running containers, rebuild Docker images, and restart the environment, typically used after updating environment variables or Python packages. ```bash ➜ invoke stop ➜ invoke build ➜ invoke tests ``` -------------------------------- ### Prepare LTM Release Branch Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Create a release branch from the LTM branch, bump the patch or minor version, and generate release notes. ```bash git switch -c release-2.4.99 ltm-2.4 poetry version patch invoke generate-release-notes --version 2.4.99 ``` -------------------------------- ### Invoke CLI Helper Commands - Local Development Environment Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md These Invoke commands help manage the local Dockerized development environment. Use `invoke ` to execute them. ```shell build Build all docker images. debug Start Nautobot and its dependencies in debug mode. destroy Destroy all containers and volumes. restart Restart Nautobot and its dependencies in detached mode. start Start Nautobot and its dependencies in detached mode. stop Stop Nautobot and its dependencies. ``` -------------------------------- ### Commit and Push Release Changes Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md After generating release notes and staging all changes, commit them with a descriptive message and push to the remote repository. ```bash git commit -m "Release v1.4.2" git push ``` -------------------------------- ### Create Superuser with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Creates a new superuser for Nautobot. This command is run via Invoke and executes the `createsuperuser` management command within the Nautobot container. It prompts for username, email, and password if not provided via environment variables. ```bash ➜ invoke createsuperuser Running docker-compose command "ps --services --filter status=running" Running docker-compose command "exec nautobot nautobot-server createsuperuser --username admin" Error: That username is already taken. Username: ntc Email address: ntc@networktocode.com Password: Password (again): Superuser created successfully. ``` -------------------------------- ### Generate and Move Release Notes for LTM Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Steps to generate release notes for an LTM release and move them to the correct documentation path. ```bash invoke generate-release-notes --version 2.4.99 # Move the release notes from the generated docs/admin/release_notes/version_X.Y.md to docs/admin/release_notes/version_2.4.md ``` -------------------------------- ### Generate App Configuration Schema Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Generate the `app-config-schema.json` file based on the current `PLUGINS_CONFIG`. Note that this command can only infer the schema, and manual updates may be required. ```bash invoke generate-app-config-schema ``` -------------------------------- ### Prepare LTM Release Branch Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Commands to create a release branch from an LTM branch and bump the version. ```bash git switch -c release-2.4.99 ltm-2.4 poetry version patch ``` -------------------------------- ### Create Superuser with Invoke Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-ssot/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md Creates a new superuser for Nautobot. This command is run via Invoke and executes the `createsuperuser` management command within the Nautobot container. Ensure the `creds.env` file is configured. ```bash ➜ invoke createsuperuser Running docker-compose command "ps --services --filter status=running" Running docker-compose command "exec nautobot nautobot-server createsuperuser --username admin" Error: That username is already taken. Username: ntc Email address: ntc@networktocode.com Password: Password (again): Superuser created successfully. ``` -------------------------------- ### Invoke CLI Helper Commands: Utility Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Launches a bash shell inside the running development container for direct interaction. ```shell invoke cli ``` -------------------------------- ### View Docker Container Logs Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/dev/dev_environment.md Displays logs from a specified Docker container. Use the `-f` flag to stream logs in real-time. The `--tail <#>` argument can limit the output. ```bash ➜ docker logs -f ``` -------------------------------- ### Post-Generation Commands for Nautobot App Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/docs/user/quick-start.md After generating your Nautobot application, run these commands within the new project directory to set up dependencies, format code, and prepare for development. ```shell poetry lock poetry install poetry self add poetry-plugin-shell poetry shell invoke makemigrations ruff . # this will ensure all python files are formatted correctly, may require `sudo chown -R ./` as migrations may be owned by root ``` -------------------------------- ### Bump Pre-release Version with Poetry Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Increment the pre-release version using the `prerelease` bump rule with `poetry version`. ```bash > poetry version prerelease Bumping version from 1.0.0-beta.2 to 1.0.0-beta.3 ``` -------------------------------- ### Display Current Poetry Version Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Use `poetry version` without arguments to display the current version of the project as defined in `pyproject.toml`. ```bash > poetry version {{ cookiecutter.app_slug }} 1.0.0-beta.2 ``` -------------------------------- ### Generate and Move LTM Release Notes Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app-chatops/{{ cookiecutter.project_slug }}/docs/dev/release_checklist.md Commands to generate release notes for a specific version and move them to the correct location for LTM releases. ```bash invoke generate-release-notes --version 2.4.99 # Move the release notes from the generated docs/admin/release_notes/version_X.Y.md to docs/admin/release_notes/version_2.4.md ``` -------------------------------- ### Invoke CLI Helper Commands - Testing Source: https://github.com/nautobot/cookiecutter-nautobot-app/blob/main/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md These Invoke commands are used for running code quality checks and tests. Use `invoke ` to execute them. ```shell ruff Run ruff to perform code formatting and/or linting. pylint Run pylint code analysis. markdownlint Run pymarkdown linting. tests Run all tests for this app. unittest Run Django unit tests for the app. djlint Run djlint to perform django template linting. djhtml Run djhtml to perform django template formatting. ```