2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-02 21:38:48 +00:00

116 Commits

Author SHA1 Message Date
Lukas
073a275d89
Skip ready functions if not in main thread or plugins are not loaded yet (#5005)
* Skip ready functions if not in main thread or plugins are not loaded yet

* Debug integration tests

* Update ready.py

* Update ready.py

* Fix isInMainThread and isPluginRegistryLoaded ready functions

* Preload gunicorn app to only invoke the appconfig ready functions once

* debug: test prints for statistics

* Remove debug print

* Test without

* Revert "Test without"

This reverts commit 1bc18728935f2cebed38ae64ffe9f4e2f1d8e539.

* Second test

* Add checks back to part, label, user model

* Add checks back to inventree, plugin apps

* log server output for debugging

* hopefully I can get the log this time+

* Next test

* Test with --noreload

* Next test

* trigger: ci, because session expired

* block the second ready execution instead of the first

* fix: load order

* Fix test and revert gh actions workflow change

* Added all_apps method to reload machanism

* Changed detect reload mechanism

* Also trigger ready on reload

* Add skipping second reload back for testing mode

* Added doc string back

* Update InvenTree/plugin/base/integration/AppMixin.py
2023-07-26 08:33:13 +10:00
Matthias Mair
58a33c2e67
[FR] Switch from git to dulwich (#4966)
* [FR] Switch from pure git to dulwich Fixes #4942

* fix lenght

* change length again

* change length again
2023-06-05 19:27:46 +10:00
Matthias Mair
21ed4b2081
Fix common spelling mistakes (#4956)
* add codespell

* first fixes

* doc fixes

* fix docstrings and comments

* functional changes

* docstrings again

* and docs again

* rename args

* add ignore

* use pre-commit for filtering instead

* ups

* fix typo in filter
2023-06-04 00:04:52 +10:00
Oliver
f5a216451a
Plugin schedule fix (#4295)
* Cleanup old info message (seems out of place)

* Wrap called function in quotes

- Doesn't work if you pass the function object itself

* Fix path to called method

This must have been broken for a while?
2023-02-02 23:36:19 +11:00
Oliver
b50a6826ef
Builtin plugins (#3889)
* Allow loading of "builtin" plugins, even if "plugins" are not explicitly loaded

* Updates for 'admin' buttons:

- Make them work like proper links
- Hidden if 'hide_admin_link' customization option is set
- Check for user staff status

* Cleanup rendering of "plugins" display

* Consolidate InvenTree barcode plugins into single plugin class

* Hide "install plugin" button if plugins are not enabled

* Add info message is external plugins are not enabled

* Fixes for loading plugins

- Always load 'builtin' plugins
- Refactor calls to "is_active" at various points in codebase

* Various tweaks

- Improve builtin plugin descriptions
- Spelling fixes

* Adjust plugin detail for builtin plugins

* Simplify barcode plugin class

* Simplify template rendering

* Bug fix for inventree barcode plugin

* Revert "Simplify template rendering"

This reverts commit 3a6755a659fe92963b8bee8378638e28271dd369.

* Re-re-improve template rendering

- Required as the template has been refactored for both "active" and "inactive" plugins

* Fixing unit tests for barcode plugin

* Ensure that barcode scan actions do not take a "long time":

- Add a default timeout of 0.1s to any POST or GET request in the testing framework
- Can be overridden by calling method if desired

* Display plugin "builtin" status in admin panel

* Fix unit tests for plugin API

* Further unit testing fixes

* Version number tweaks

* Further tweaks for unit testing

* Allow longer timeout for report printing via API

* Increase default timeout for API tests

- Sometimes CPU spike can cause the test to fail :|

* label printing can take a bit longer

* Remove timeout requirement from API tester

- Too variable to be reliable for CI
2022-11-05 01:05:54 +11:00
Oliver
c146256170
Allow auto-loading of plugins in certain conditions (#3762)
Ref: 52af196694
2022-10-09 09:07:51 +11:00
Matthias Mair
188ddc3be3
Improve plugin testing (#3517)
* refactor entrypoint into helpers

* Add lookup by metadata
This is geared towards plugins packaged in pkgs that differ in name from their top module

* Make module lookup predictable in changing pkg-envs

* remove no coverage from plugin packages

* ignore coverage for production loadin

* refactor plugin collection - move assigment out

* do not cover fs errors

* test custom dir loading

* test module meta fetcher

* add a bit more safety

* do not cover sanity checkers

* add folder loading test

* ignore again for cleaner diffs for now

* ignore safety catch

* rename test

* Add test for package installs

* fix docstring name

* depreciate test for now

* Fix for out of BASE_DIR paths

* ignore catch

* remove unneeded complexity

* add testing for outside folders

* more docstrings and simpler methods

* make call simpler
2022-08-16 13:09:48 +10:00
Oliver
6eddcd3c23
Setting caching (#3178)
* Revert "Remove stat context variables"

This reverts commit 0989c308d0cea9b9405a1338d257b542c6d33d73.

* Add a caching framework for inventree settings

- Actions that use "settings" require a DB hit every time
- For example the part.full_name() method looks at the PART_NAME_FORMAT setting
- This means 1 DB hit for every part which is serialized!!

* Fixes for DebugToolbar integration

- Requires different INTERNAL_IPS when running behind docker
- Some issues with TEMPLATES framework

* Revert "Revert "Remove stat context variables""

This reverts commit 52e6359265226126da7ed6ed2aed2b83aa33de17.

* Add unit tests for settings caching

* Update existing unit tests to handle cache framework

* Fix for unit test

* Re-enable cache for default part values

* Clear cache for further unit tests
2022-06-12 10:56:16 +10:00
Matthias Mair
f38386b13c
Add more checks to pre-commit (#3132)
* Add bandit to pre-commit checks

* fix catchall exceptions

* remove unused definitons

* remove unuseed ariables

* Add docstring

* fix B006, B008 errors

* fix B007 error

* ignore B009

* Add checks for formatting and naming
2022-06-06 08:56:52 +10:00
Matthias Mair
0c97a50e47
Docstring checks in QC checks (#3089)
* Add pre-commit to the stack

* exclude static

* Add locales to excludes

* fix style errors

* rename pipeline steps

* also wait on precommit

* make template matching simpler

* Use the same code for python setup everywhere

* use step and cache for python setup

* move regular settings up into general envs

* just use full update

* Use invoke instead of static references

* make setup actions more similar

* use python3

* refactor names to be similar

* fix runner version

* fix references

* remove incidential change

* use matrix for os

* Github can't do this right now

* ignore docstyle errors

* Add seperate docstring test

* update flake call

* do not fail on docstring

* refactor setup into workflow

* update reference

* switch to action

* resturcture

* add bash statements

* remove os from cache

* update input checks

* make code cleaner

* fix boolean

* no relative paths

* install wheel by python

* switch to install

* revert back to simple wheel

* refactor import export tests

* move setup keys back to not disturbe tests

* remove docstyle till that is fixed

* update references

* continue on error

* add docstring test

* use relativ action references

* Change step / job docstrings

* update to merge

* reformat comments 1

* fix docstrings 2

* fix docstrings 3

* fix docstrings 4

* fix docstrings 5

* fix docstrings 6

* fix docstrings 7

* fix docstrings 8

* fix docstirns 9

* fix docstrings 10

* docstring adjustments

* update the remaining docstrings

* small docstring changes

* fix function name

* update support files for docstrings

* Add missing args to docstrings

* Remove outdated function

* Add docstrings for the 'build' app

* Make API code cleaner

* add more docstrings for plugin app

* Remove dead code for plugin settings
No idea what that was even intended for

* ignore __init__ files for docstrings

* More docstrings

* Update docstrings for the 'part' directory

* Fixes for related_part functionality

* Fix removed stuff from merge 99676ee

* make more consistent

* Show statistics for docstrings

* add more docstrings

* move specific register statements to make them clearer to understant

* More docstrings for common

* and more docstrings

* and more

* simpler call

* docstrings for notifications

* docstrings for common/tests

* Add docs for common/models

* Revert "move specific register statements to make them clearer to understant"

This reverts commit ca9665462202c2d63f34b4fd920013b1457bbb6d.

* use typing here

* Revert "Make API code cleaner"

This reverts commit 24fb68bd3e1ccfea2ee398c9e18afb01eb340fee.

* docstring updates for the 'users' app

* Add generic Meta info to simple Meta classes

* remove unneeded unique_together statements

* More simple metas

* Remove unnecessary format specifier

* Remove extra json format specifiers

* Add docstrings for the 'plugin' app

* Docstrings for the 'label' app

* Add missing docstrings for the 'report' app

* Fix build test regression

* Fix top-level files

* docstrings for InvenTree/InvenTree

* reduce unneeded code

* add docstrings

* and more docstrings

* more docstrings

* more docstrings for stock

* more docstrings

* docstrings for order/views

* Docstrings for various files in the 'order' app

* Docstrings for order/test_api.py

* Docstrings for order/serializers.py

* Docstrings for order/admin.py

* More docstrings for the order app

* Add docstrings for the 'company' app

* Add unit tests for rebuilding the reference fields

* Prune out some more dead code

* remove more dead code

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-06-02 01:37:39 +10:00
Matthias Mair
6247eecf69
Exclude testing exceptions from coverage (#3046)
* exclude testing excetions

* check user str

* check related users

* move no coverage marker

* fix assertation

* add test for filters

* do not cover logs
2022-05-22 15:54:13 +10:00
Matthias Mair
e1d22f538d resort imports 2022-05-20 17:24:51 +02:00
Oliver
80e3d0970a Adds unit tests for the samplepanel plugin 2022-05-19 11:28:18 +10:00
Oliver
9446702d78 Skip plugin loading for various database admin functions 2022-05-19 09:45:16 +10:00
Oliver
9bcbaaa5f5 Remove more python2 stuff 2022-05-17 16:57:31 +10:00
Matthias
c5acfaf541
do not coverage catch for load 2022-05-03 23:06:57 +02:00
Matthias
de6507e918
update translation commands 2022-05-01 22:03:49 +02:00
Matthias
eef51600c5
do not write to db 2022-03-20 18:10:42 +01:00
Matthias
3606bd8fe4
add try to settings test 2022-03-16 17:03:04 +01:00
Matthias
8f10ef817c
add setting for reload 2022-03-16 14:47:27 +01:00
Matthias
5f9a549918
docs 2022-03-15 01:27:14 +01:00
Matthias
d9d2f39072
just run install 2022-03-15 01:24:58 +01:00
Matthias
38938e892b
[FR] [Plugin] Check if all plugins are really installed
Fixes #2524
2022-03-14 23:50:09 +01:00
Matthias
ba263187a5
optimise coverage 2022-02-28 00:35:36 +01:00
Matthias
f80f960923
translate error message 2022-02-28 00:34:28 +01:00
Matthias
f3f010c4be
write error if too old git 2022-02-28 00:34:02 +01:00
Matthias
bae290d605
check git version and safe for runtime 2022-02-28 00:17:21 +01:00
Matthias
ca07c5f12c
imports are not tested 2022-02-13 05:16:29 +01:00
Oliver
aeb8967473 PEP fixes 2022-02-03 16:06:00 +11:00
Oliver
78b1c7a22b Skips some specific steps when importing data
- We need to prevent certain operations from running when we are importing data
- This is to prevent unique database constraints from being violated

- Do not register plugins during data import
- Do not launch notification events
2022-02-03 16:03:46 +11:00
Matthias
62236474e2
Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2519 2022-01-12 00:12:32 +01:00
Oliver
8aec055e6c Only load plugins if PLUGINS_ENABLED is true
- Hide plugin settings
- Add plugin support status to "stats" dialog
2022-01-11 13:39:47 +11:00
Matthias
f53e66d4c3
Rename registry to make it clearer 2022-01-11 01:00:41 +01:00
Oliver
dc9e25ebad Adds API endpoints for viewing and updating plugin settings
A lot of code updates / refactoring here to get this to work as expected
2022-01-04 20:27:35 +11:00
Matthias
6533457400
always drop out of maintenance on startup 2021-11-21 19:08:01 +01:00
Matthias
d17af9eae7
PEP fixes 2021-11-20 21:03:51 +01:00
Matthias
308348f051
move flags 2021-11-20 18:07:05 +01:00
Matthias
ebe5993a45
refactor registry into own class and file 2021-11-20 16:31:02 +01:00
Matthias
67fa4cc119
PEP fix 2021-11-20 13:44:31 +01:00
Matthias
008917fdef
refactor custom error raising 2021-11-20 13:20:08 +01:00
Matthias
71e05d569b
refactor plugin error processing definition 2021-11-20 13:14:18 +01:00
Matthias
b05381fcc8
rename / cleanup 2021-11-20 13:00:12 +01:00
Matthias
2f306d951f
refactor url definition into plugin 2021-11-20 12:54:51 +01:00
Matthias
e82c93ffae
refactor into own helper function for plugins 2021-11-20 12:39:27 +01:00
Matthias
6301f06416
PEP fix 2021-11-20 04:06:15 +01:00
Matthias
9f0882d637
move imports 2021-11-20 03:52:27 +01:00
Matthias
4b3d5b27a6
add more stack logging points 2021-11-20 03:39:47 +01:00
Matthias
d36ab0d9cd
some more docs 2021-11-20 03:22:25 +01:00
Matthias
4c7d295c0e
hard reset all plugin registration mechanisms on error 2021-11-20 03:20:55 +01:00
Matthias
3dfb8167a7
refactor 2021-11-20 03:20:14 +01:00