mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Code structure refactor (#5582)
* moved docker files to /contrib/container * changed code owners to make more precise * updated CI to use new subdirs * added manual trigger for testing * moved ci files * moved assets into subdir * moved deploy template file to contrib * moved django files to src/backend * updated paths in scripts etc * updated reqs path * fixed version file path * fixed flake8 path * fixed path to node ressources * fixed task paths * added dep path for node * removed unused yarn lockfile * removed unused ci script * updated internal backend paths for tasks * updated translation stats path * fixed source path for coverage * fixed main commit repo path * fit in changes from testing * gather packager improvements (#149) * Matmair/issue5578 (#143) * moved docker files to /contrib/container * changed code owners to make more precise * updated CI to use new subdirs * added manual trigger for testing * moved ci files * moved assets into subdir * moved deploy template file to contrib * moved django files to src/backend * updated paths in scripts etc * updated reqs path * fixed version file path * fixed flake8 path * fixed path to node ressources * fixed task paths * added dep path for node * removed unused yarn lockfile * removed unused ci script * updated internal backend paths for tasks * updated translation stats path * fixed source path for coverage * fixed main commit repo path * fix docker path * use project dir * move project dir command * fixed docker paths * another fix? * seperate tasks out * remove tasks * some debugging * ci: add .deepsource.toml * Update .deepsource.toml * also ignore migrations * more debugging * fix path issues * remove debug script * fix style * change locale path * Fixed paths for requirements * Added dummy requirements to fool packager * fixed exec path * remove deepsource --------- Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com> * Added docs for file structure * Fixed style errors * updated deepsource paths * fix deepsource paths * fixed reqs * merge fixes * move newly added dirs too * fix reqs files * another dep fix * merge upstream/master * revert removal of tags * merge upstream * enabled detection of old config files * adapt coverage src * also detect and support old location for plugins.txt * style fix * fix ~/init.sh location * fix requirements path * fix config to current master * move new folders * fix import order * fix paths for qc_check * fix docs build * fix fix path * set docker project dir * just use a cd * set image path? * set file correct * fix copy path * fix tasks dir * fix init path * fix copy path * set prject dir * fix paths * remove old prod files * fix dev env path * set docker file * Fix devcontainer docker compose file * fix login attempt values * fix init.sh path * Fix pathing for Docker * Docker build fix - Set INVENTREE_BACKEND_DIR separately * Update init.sh * Fix path * Update requirements.txt * merge * fix rq merge * fix docker compose usage --------- Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com> Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@ -9,8 +9,8 @@ The InvenTree server code supports an extensible plugin architecture, allowing c
|
||||
Plugins can be added from multiple sources:
|
||||
|
||||
- Plugins can be installed in InvenTrees venv via PIP (python package manager)
|
||||
- Custom plugins should be placed in the directory `./InvenTree/plugins`.
|
||||
- InvenTree built-in plugins are located in the directory `./InvenTree/plugin/builtin`.
|
||||
- Custom plugins should be placed in the directory `./src/backend/InvenTree/plugins`.
|
||||
- InvenTree built-in plugins are located in the directory `./src/backend/InvenTree/plugin/builtin`.
|
||||
|
||||
For further information, read more about [installing plugins](./plugins/install.md).
|
||||
|
||||
@ -28,7 +28,7 @@ Please read all release notes and watch out for warnings - we generally provide
|
||||
|
||||
#### Plugins
|
||||
|
||||
General classes and mechanisms are provided under the `plugin` [namespaces](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/__init__.py). These include:
|
||||
General classes and mechanisms are provided under the `plugin` [namespaces](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/__init__.py). These include:
|
||||
|
||||
```python
|
||||
# Management objects
|
||||
@ -44,7 +44,7 @@ MixinNotImplementedError # Is raised if a mixin was not implemented (core mec
|
||||
|
||||
#### Mixins
|
||||
|
||||
Mixins are split up internally to keep the source tree clean and enable better testing separation. All public APIs that should be used are exposed under `plugin.mixins`. These include all built-in mixins and notification methods. An up-to-date reference can be found in the source code (current master can be [found here](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/mixins/__init__.py)).
|
||||
Mixins are split up internally to keep the source tree clean and enable better testing separation. All public APIs that should be used are exposed under `plugin.mixins`. These include all built-in mixins and notification methods. An up-to-date reference can be found in the source code (current master can be [found here](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/mixins/__init__.py)).
|
||||
|
||||
#### Models and other internal InvenTree APIs
|
||||
|
||||
@ -72,7 +72,7 @@ MIN_VERSION = None # Lowest InvenTree version number that is supported by the p
|
||||
MAX_VERSION = None # Highest InvenTree version number that is supported by the plugin
|
||||
```
|
||||
|
||||
Refer to the [sample plugins](https://github.com/inventree/InvenTree/tree/master/InvenTree/plugin/samples) for further examples.
|
||||
Refer to the [sample plugins](https://github.com/inventree/InvenTree/tree/master/src/backend/InvenTree/plugin/samples) for further examples.
|
||||
|
||||
### Plugin Config
|
||||
|
||||
|
@ -15,4 +15,4 @@ POST {
|
||||
}
|
||||
```
|
||||
|
||||
For an example of a very simple action plugin, refer to `/InvenTree/plugin/samples/integratoni/simpleactionplugin.py`
|
||||
For an example of a very simple action plugin, refer to `/src/backend/InvenTree/plugin/samples/integratoni/simpleactionplugin.py`
|
||||
|
@ -6,7 +6,7 @@ title: Barcode Mixin
|
||||
|
||||
InvenTree supports decoding of arbitrary barcode data via a **Barcode Plugin** interface. Barcode data POSTed to the `/api/barcode/` endpoint will be supplied to all loaded barcode plugins, and the first plugin to successfully interpret the barcode data will return a response to the client.
|
||||
|
||||
InvenTree can generate native QR codes to represent database objects (e.g. a single StockItem). This barcode can then be used to perform quick lookup of a stock item or location in the database. A client application (for example the InvenTree mobile app) scans a barcode, and sends the barcode data to the InvenTree server. The server then uses the **InvenTreeBarcodePlugin** (found at `/InvenTree/plugins/barcode/inventree.py`) to decode the supplied barcode data.
|
||||
InvenTree can generate native QR codes to represent database objects (e.g. a single StockItem). This barcode can then be used to perform quick lookup of a stock item or location in the database. A client application (for example the InvenTree mobile app) scans a barcode, and sends the barcode data to the InvenTree server. The server then uses the **InvenTreeBarcodePlugin** (found at `/src/backend/InvenTree/plugins/barcode/inventree.py`) to decode the supplied barcode data.
|
||||
|
||||
Any third-party barcodes can be decoded by writing a matching plugin to decode the barcode data. These plugins could then perform a server-side action or render a JSON response back to the client for further action.
|
||||
|
||||
|
@ -34,7 +34,7 @@ In certain container environments (such as docker), plugins are installed into a
|
||||
|
||||
#### Builtin Plugins
|
||||
|
||||
Builtin plugins ship in `src/InvenTree/plugin/builtin`. To achieve full unit-testing for all mixins there are some sample implementations in `src/InvenTree/plugin/samples`.
|
||||
Builtin plugins ship in `src/backend/InvenTree/plugin/builtin`. To achieve full unit-testing for all mixins there are some sample implementations in `src/backend/InvenTree/plugin/samples`.
|
||||
|
||||
!!! success "Builtin Plugins"
|
||||
Builtin plugins are always enabled, as they are required for core InvenTree functionality
|
||||
@ -77,7 +77,7 @@ Admin users can install plugins directly from the web interface, via the "Plugin
|
||||
Custom plugins can be placed in the `src/InvenTree/plugins/` directory, where they will be automatically discovered. This can be useful for developing and testing plugins, but can prove more difficult in production (e.g. when using Docker).
|
||||
|
||||
!!! info "Git Tracking"
|
||||
The `src/InvenTree/plugins/` directory is excluded from Git version tracking - any plugin files here will be hidden from Git
|
||||
The `src/backend/InvenTree/plugins/` directory is excluded from Git version tracking - any plugin files here will be hidden from Git
|
||||
|
||||
!!! warning "Not Recommended For Production"
|
||||
Loading plugins via the local *plugins* directory is not recommended for production. If you cannot use PIP installation (above), specify a custom plugin directory (below) or use a [VCS](https://pip.pypa.io/en/stable/topics/vcs-support/) as a plugin install source.
|
||||
|
@ -28,4 +28,4 @@ If a locate plugin is installed and activated, the [InvenTree mobile app](../../
|
||||
|
||||
### Implementation
|
||||
|
||||
Refer to the [InvenTree source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/samples/locate/locate_sample.py) for a simple implementation example.
|
||||
Refer to the [InvenTree source code](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/samples/locate/locate_sample.py) for a simple implementation example.
|
||||
|
@ -16,7 +16,7 @@ Additionally the `add_label_context` method, allowing custom context data to be
|
||||
|
||||
### Example
|
||||
|
||||
A sample plugin which provides additional context data to the report templates can be found [in the InvenTree source code](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/samples/integration/report_plugin_sample.py):
|
||||
A sample plugin which provides additional context data to the report templates can be found [in the InvenTree source code](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/samples/integration/report_plugin_sample.py):
|
||||
|
||||
```python
|
||||
"""Sample plugin for extending reporting functionality"""
|
||||
|
@ -59,4 +59,4 @@ class ScheduledTaskPlugin(ScheduleMixin, SettingsMixin, InvenTreePlugin):
|
||||
```
|
||||
|
||||
!!! info "More Info"
|
||||
For more information on any of the methods described below, refer to the InvenTree source code. [A working example is available as a starting point](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/samples/integration/scheduled_task.py).
|
||||
For more information on any of the methods described below, refer to the InvenTree source code. [A working example is available as a starting point](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/samples/integration/scheduled_task.py).
|
||||
|
@ -9,7 +9,7 @@ The `ValidationMixin` class enables plugins to perform custom validation of obje
|
||||
Any of the methods described below can be implemented in a custom plugin to provide functionality as required.
|
||||
|
||||
!!! info "More Info"
|
||||
For more information on any of the methods described below, refer to the InvenTree source code. [A working example is available as a starting point](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/samples/integration/validation_sample.py).
|
||||
For more information on any of the methods described below, refer to the InvenTree source code. [A working example is available as a starting point](https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/plugin/samples/integration/validation_sample.py).
|
||||
|
||||
!!! info "Multi Plugin Support"
|
||||
It is possible to have multiple plugins loaded simultaneously which support validation methods. For example when validating a field, if one plugin returns a null value (`None`) then the *next* plugin (if available) will be queried.
|
||||
|
Reference in New Issue
Block a user