Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
name: Build Package

on:
- push
- pull_request
push:
branches:
- main
pull_request:
schedule: # run every week to catch upstream InvenTree breakage
- cron: "0 12 * * 6"

jobs:

Expand All @@ -18,7 +22,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Install Python Dependencies
run: |
pip install --upgrade wheel setuptools twine build
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Playwright Tests

on: ["push", "pull_request"]
on:
push:
branches:
- main
pull_request:
schedule: # run every week to catch upstream InvenTree breakage
- cron: "0 12 * * 6"

jobs:
playwright:
Expand All @@ -25,11 +31,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 20
node-version: 24
- name: Build Plugin
run: |
pip install .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Install Python Dependencies
run: |
pip install --upgrade wheel setuptools twine build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Install Deps
run: |
pip install -U ruff
Expand Down
1 change: 0 additions & 1 deletion plugin_creator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-

PLUGIN_CREATOR_VERSION = "1.20.0"
12 changes: 5 additions & 7 deletions plugin_creator/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import questionary
from questionary.prompts.common import Choice

from .helpers import info
from .helpers import remove_file, remove_dir

from .helpers import info, remove_dir, remove_file

# Version requirements for core frontend libraries
MIN_REACT_VERSION = "19.2.4"
Expand All @@ -27,12 +25,12 @@ def frontend_features() -> dict:

def all_features() -> dict:
"""Select all features by default."""
return {key: True for key in frontend_features().keys()}
return {key: True for key in frontend_features()}


def no_features() -> dict:
"""Select no features by default."""
return {key: False for key in frontend_features().keys()}
return {key: False for key in frontend_features()}


def enable_translation() -> bool:
Expand Down Expand Up @@ -62,7 +60,7 @@ def select_features() -> dict:
key for key, value in frontend_features().items() if value in selected
]

return {key: key in selected_keys for key in frontend_features().keys()}
return {key: key in selected_keys for key in frontend_features()}


def remove_frontend(plugin_dir: str) -> None:
Expand Down Expand Up @@ -105,7 +103,7 @@ def update_frontend(plugin_dir: str, context: dict) -> None:
translation = context["frontend"].get("translation", False)

# Remove features which are not needed
for feature in frontend_features().keys():
for feature in frontend_features():
if not features.get(feature, False):
info(f"- Removing unused frontend feature: {feature}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ exclude = [
]

src=["{{ cookiecutter.package_name }}"]

[tool.ruff.lint]

ignore = [
"I001",
"PIE790",
"RUF012"
]
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# -*- coding: utf-8 -*-

PLUGIN_VERSION = "{{ cookiecutter.plugin_version }}"
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def report_callback(self, template, instance, report, request, **kwargs):
def setup_urls(self):
"""Configure custom URL endpoints for this plugin."""
from django.urls import path

from .views import ExampleView

return [
Expand Down Expand Up @@ -253,15 +254,15 @@ def validate_serial_number(self, serial, part, stock_item, **kwargs):

def convert_serial_to_int(self, serial, **kwargs) -> int:
"""Convert a serial number to an integer value."""
return None
...

def get_latest_serial_number(self, part, **kwargs):
"""Return the latest serial number for a given part."""
return None
...

def increment_serial_number(self, serial, part=None, **kwargs):
"""Increment a serial number."""
return None
...
{%- endif %}
{% if "TransitionMixin" in cookiecutter.plugin_mixins.mixin_list %}
# Custom transition logic (from TransitionMixin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Ref: https://www.django-rest-framework.org/api-guide/views/
"""

from datetime import date
import datetime
import random
import string

Expand Down Expand Up @@ -37,7 +37,7 @@ def get(self, request, *args, **kwargs):
response_serializer = self.serializer_class(data={
'random_text': ''.join(random.choices(string.ascii_letters, k=50)),
'part_count': Part.objects.count(),
'today': date.today()
'today': datetime.datetime.now(tz=datetime.timezone.utc).date()
})

# Serializer must be validated before it can be returned to the client
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

import importlib
import importlib.util
import os

import setuptools

# Read version number from source code
Expand Down
Loading