Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for py3.12 #36

Merged
merged 29 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ccc7790
added support for py3.12
gsnider2195 Aug 13, 2024
61978ca
update codeowners
gsnider2195 Aug 14, 2024
9e61d92
update codeowners, bump default nautobot and python versions
gsnider2195 Aug 14, 2024
720c045
bump nautobot version
gsnider2195 Aug 20, 2024
e812d86
switch to py3.11 for dev environment until pylint issues can be resolved
gsnider2195 Aug 20, 2024
4fa1390
change default python version for dockerfile
gsnider2195 Aug 20, 2024
07d2e02
change default python version for dockerfile
gsnider2195 Aug 20, 2024
739c4e2
fix lockfile mismatch when building docker image
gsnider2195 Aug 20, 2024
c707ac1
fix stable nautobot version name
gsnider2195 Aug 21, 2024
f71b174
Merge remote-tracking branch 'origin/develop' into u/gas-python3.12
gsnider2195 Aug 21, 2024
4f03a74
update lockfile
gsnider2195 Aug 21, 2024
74489e8
Merge remote-tracking branch 'origin/develop' into u/gas-python3.12
gsnider2195 Aug 21, 2024
b55e627
add test code
gsnider2195 Aug 21, 2024
eb0f297
add test code
gsnider2195 Aug 21, 2024
e6d6f30
test code
gsnider2195 Aug 21, 2024
a08a6fb
test code
gsnider2195 Aug 21, 2024
2940e67
test code
gsnider2195 Aug 21, 2024
e7833b4
fix docker build
gsnider2195 Aug 21, 2024
9df4fb0
remove test code
gsnider2195 Aug 21, 2024
370df10
test multiplatform builds
gsnider2195 Aug 21, 2024
aa3b4fb
test multi-platform build
gsnider2195 Aug 21, 2024
d1d90be
yamllint
gsnider2195 Aug 21, 2024
28f28c2
remove multi-arch test code
gsnider2195 Aug 21, 2024
ca935cb
update dockerfile
gsnider2195 Aug 21, 2024
b39cca7
move ci logic into tasks.py
gsnider2195 Aug 21, 2024
0978dfc
yamllint
gsnider2195 Aug 21, 2024
987da16
update dockerfile and invoke.example.yml
gsnider2195 Aug 22, 2024
f3b59a4
update task help for invoke lock
gsnider2195 Aug 22, 2024
9b8bde0
install extras and dev dependencies
gsnider2195 Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Default owner(s) of all files in this repository
* @cmsirbu @snaselj @whitej6
* @nautobot/maintain-nautobot-apps
gsnider2195 marked this conversation as resolved.
Show resolved Hide resolved
26 changes: 21 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on: # yamllint disable-line rule:truthy rule:comments
pull_request: ~

env:
APP_NAME: "nautobot-app-dev-example"
APP_NAME: "nautobot-dev-example"
gsnider2195 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
ruff-format:
Expand Down Expand Up @@ -91,6 +91,13 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Constrain Nautobot version"
run: |
# Retrieve the version from the Docker image - for cases where the input version is "stable" or "latest"
docker run --rm --entrypoint "" ghcr.io/nautobot/nautobot-dev:${{ matrix.nautobot-version }}-py${{ matrix.python-version }} pip show nautobot | \
grep "^Version" | sed "s/Version: //" > /tmp/nautobot_version.txt
export NAUTOBOT_VER=$(cat /tmp/nautobot_version.txt)
poetry add nautobot@$NAUTOBOT_VER --python ${{ matrix.python-version }}
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v3"
Expand All @@ -108,6 +115,7 @@ jobs:
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
CI=true
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Linting: pylint"
Expand All @@ -122,14 +130,14 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
db-backend: ["postgresql"]
nautobot-version: ["stable"]
include:
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "2.0.0"
- python-version: "3.11"
- python-version: "3.12"
db-backend: "mysql"
nautobot-version: "stable"
runs-on: "ubuntu-22.04"
Expand All @@ -141,6 +149,13 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Constrain Nautobot version"
run: |
# Retrieve the version from the Docker image - for cases where the input version is "stable" or "latest"
docker run --rm --entrypoint "" ghcr.io/nautobot/nautobot-dev:${{ matrix.nautobot-version }}-py${{ matrix.python-version }} pip show nautobot | \
grep "^Version" | sed "s/Version: //" > /tmp/nautobot_version.txt
export NAUTOBOT_VER=$(cat /tmp/nautobot_version.txt)
poetry add nautobot@$NAUTOBOT_VER --python ${{ matrix.python-version }}
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v3"
Expand All @@ -158,6 +173,7 @@ jobs:
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
CI=true
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Use Mysql invoke settings when needed"
Expand Down Expand Up @@ -196,7 +212,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.11"
python-version: "3.12"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand Down Expand Up @@ -231,7 +247,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.11"
python-version: "3.12"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand Down
34 changes: 12 additions & 22 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}
# Runtime argument and environment setup
ARG NAUTOBOT_ROOT=/opt/nautobot

# Docker needs to specify the build args in each stage
gsnider2195 marked this conversation as resolved.
Show resolved Hide resolved
ARG NAUTOBOT_VER
ARG PYTHON_VER

ENV prometheus_multiproc_dir=/prom_cache
ENV NAUTOBOT_ROOT=${NAUTOBOT_ROOT}
ENV INVOKE_NAUTOBOT_DEV_EXAMPLE_LOCAL=true
Expand Down Expand Up @@ -53,29 +57,15 @@ RUN which poetry || curl -sSL https://install.python-poetry.org | python3 - && \
WORKDIR /source
COPY . /source

# Get container's installed Nautobot version as a forced constraint
# NAUTOBOT_VER may be a branch name and not a published release therefor we need to get the installed version
# so pip can use it to recognize local constraints.
RUN pip show nautobot | grep "^Version: " | sed -e 's/Version: /nautobot==/' > constraints.txt

# Use Poetry to grab dev dependencies from the lock file
# Can be improved in Poetry 1.2 which allows `poetry install --only dev`
#
# We can't use the entire freeze as it takes forever to resolve with rigidly fixed non-direct dependencies,
# especially those that are only direct to Nautobot but the container included versions slightly mismatch
RUN poetry export -f requirements.txt --without-hashes --extras all --output poetry_freeze_base.txt
RUN poetry export -f requirements.txt --without-hashes --extras all --with dev --output poetry_freeze_all.txt
RUN sort poetry_freeze_base.txt poetry_freeze_all.txt | uniq -u > poetry_freeze_dev.txt

# Install all local project as editable, constrained on Nautobot version, to get any additional
# direct dependencies of the app
RUN --mount=type=cache,target="/root/.cache/pip",sharing=locked \
pip install -c constraints.txt -e .[all]
# Constrain the Nautobot version to NAUTOBOT_VER
# In CI, this should be done outside of the Dockerfile to prevent cross-compile build failures
ARG CI
RUN if [ -z "${CI+x}" ]; then \
INSTALLED_NAUTOBOT_VER=$(pip show nautobot | grep "^Version" | sed "s/Version: //"); \
poetry add nautobot@${INSTALLED_NAUTOBOT_VER} --python ${PYTHON_VER}; fi

# Install any dev dependencies frozen from Poetry
# Can be improved in Poetry 1.2 which allows `poetry install --only dev`
RUN --mount=type=cache,target="/root/.cache/pip",sharing=locked \
pip install -c constraints.txt -r poetry_freeze_dev.txt
# Install the app
RUN poetry install

COPY development/nautobot_config.py ${NAUTOBOT_ROOT}/nautobot_config.py
# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
2 changes: 1 addition & 1 deletion invoke.example.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
nautobot_dev_example:
project_name: "nautobot-dev-example"
nautobot_ver: "2.0.0"
nautobot_ver: "2.3.1"
local: false
python_ver: "3.11"
compose_dir: "development"
Expand Down
Loading
Loading