mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-14 00:09:56 +00:00
Update version checks: (#10954)
* Update version checks: - Add error code for old python version - Fix min python version in docs - Various spelling fixes in docs * Fix docs link * Revert change to docs version string * Bug fix
This commit is contained in:
@@ -76,7 +76,7 @@ Barcode scanning is a key feature of the [companion mobile app](../app/barcode.m
|
||||
|
||||
## Barcode History
|
||||
|
||||
If enabled, InvenTree can retain logs of the most recent barcode scans. This can be very useful for debugging or auditing purpopes.
|
||||
If enabled, InvenTree can retain logs of the most recent barcode scans. This can be very useful for debugging or auditing purposes.
|
||||
|
||||
Refer to the [barcode settings](../settings/global.md#barcodes) to enable barcode history logging.
|
||||
|
||||
|
||||
@@ -16,4 +16,4 @@ To make MFA mandatory for all users:
|
||||
|
||||
### Security Consideration
|
||||
|
||||
A user can lock themself out if they lose access to both the device with their TOTP app and their backup tokens. An admin can delete their tokens from the admin pages (they exist under the 'TOTP devices' / 'static devices' models) . This should be a last resort and only done by people knowledgeable about the [admin pages](../settings/admin.md) as changes there might circumvent InvneTrees business and security logic.
|
||||
A user can lock themselves out if they lose access to both the device with their TOTP app and their backup tokens. An admin can delete their tokens from the admin pages (they exist under the 'TOTP devices' / 'static devices' models) . This should be a last resort and only done by people knowledgeable about the [admin pages](../settings/admin.md) as changes there might circumvent InvenTree's business and security logic.
|
||||
|
||||
@@ -9,7 +9,7 @@ InvenTree can be configured to send emails to users, for various purposes.
|
||||
To enable this, email configuration settings must be supplied to the InvenTree [configuration options](../start/config.md#email-settings).
|
||||
|
||||
!!! info "Functionality might be degraded"
|
||||
Multiple functions of InvenTree require functioning email delivery, including *Password Reset*, *Notififications*, *Update Infos*
|
||||
Multiple functions of InvenTree require functioning email delivery, including *Password Reset*, *Notifications*, *Update Infos*
|
||||
|
||||
### Outgoing
|
||||
|
||||
|
||||
@@ -95,6 +95,12 @@ An error occurred while reading the InvenTree configuration file. This might be
|
||||
|
||||
Django is not installed in the current Python environment. This means that the InvenTree backend is not running within the correct [python virtual environment](../start/index.md#virtual-environment) or that the required Python packages were not installed correctly.
|
||||
|
||||
#### INVE-E15
|
||||
|
||||
**Python version not supported**
|
||||
|
||||
This error occurs attempting to run InvenTree on a version of Python which is older than the minimum required version. We [require Python {{ config.extra.min_python_version }} or newer](../start/index.md#python-requirements)
|
||||
|
||||
### INVE-W (InvenTree Warning)
|
||||
Warnings - These are non-critical errors which should be addressed when possible.
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ pip install django-storages[google]
|
||||
You will need to change the storage backend, which is set via the `INVENTREE_BACKUP_STORAGE` environment variable, or via `backup_storage` in the configuration file:
|
||||
|
||||
```yaml
|
||||
backup_stoage: storages.backends.gcloud.GoogleCloudStorage
|
||||
backup_storage: storages.backends.gcloud.GoogleCloudStorage
|
||||
```
|
||||
|
||||
### Configure Backend Options
|
||||
|
||||
@@ -488,7 +488,7 @@ The INVENTREE_CUSTOMIZE environment variable must contain a json object with the
|
||||
the wanted values. Example:
|
||||
|
||||
```
|
||||
INVENTREE_CUSTOMIZE={"login_message":"Hallo Michi"}
|
||||
INVENTREE_CUSTOMIZE={"login_message":"Hello World"}
|
||||
```
|
||||
|
||||
This example sets a login message. Take care of the double quotes.
|
||||
|
||||
@@ -359,7 +359,7 @@ extra:
|
||||
# provider: google
|
||||
# property: UA-143467500-1
|
||||
|
||||
min_python_version: 3.10
|
||||
min_python_version: 3.11
|
||||
min_invoke_version: 2.0.0
|
||||
django_version: 5.2
|
||||
docker_postgres_version: 17
|
||||
|
||||
@@ -20,6 +20,8 @@ from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION
|
||||
# InvenTree software version
|
||||
INVENTREE_SW_VERSION = '1.2.0 dev'
|
||||
|
||||
# Minimum supported Python version
|
||||
MIN_PYTHON_VERSION = (3, 11)
|
||||
|
||||
logger = logging.getLogger('inventree')
|
||||
|
||||
@@ -59,33 +61,36 @@ except Exception as exc:
|
||||
|
||||
|
||||
def checkMinPythonVersion():
|
||||
"""Check that the Python version is at least 3.11."""
|
||||
"""Check that the Python version meets the minimum requirements."""
|
||||
V_MIN_MAJOR, V_MIN_MINOR = MIN_PYTHON_VERSION
|
||||
|
||||
version = sys.version.split(' ')[0]
|
||||
docs = 'https://docs.inventree.org/en/stable/start/intro/#python-requirements'
|
||||
docs = 'https://docs.inventree.org/en/stable/start/#python-requirements'
|
||||
|
||||
msg = f"""
|
||||
InvenTree requires Python 3.11 or above - you are running version {version}.
|
||||
INVE-E15: Python version not supported.
|
||||
InvenTree requires Python {V_MIN_MAJOR}.{V_MIN_MINOR} or above - you are running version {version}.
|
||||
- Refer to the InvenTree documentation for more information:
|
||||
- {docs}
|
||||
"""
|
||||
|
||||
if sys.version_info.major < 3: # noqa: UP036
|
||||
if sys.version_info.major < V_MIN_MAJOR:
|
||||
raise RuntimeError(msg)
|
||||
|
||||
if sys.version_info.major == 3 and sys.version_info.minor < 11:
|
||||
if sys.version_info.major == V_MIN_MAJOR and sys.version_info.minor < V_MIN_MINOR:
|
||||
raise RuntimeError(msg)
|
||||
|
||||
print(f'Python version {version} - {sys.executable}')
|
||||
logger.info(f'Python version {version} - {sys.executable}')
|
||||
|
||||
|
||||
def inventreeInstanceName():
|
||||
def inventreeInstanceName() -> str:
|
||||
"""Returns the InstanceName settings for the current database."""
|
||||
from common.settings import get_global_setting
|
||||
|
||||
return get_global_setting('INVENTREE_INSTANCE')
|
||||
|
||||
|
||||
def inventreeInstanceTitle():
|
||||
def inventreeInstanceTitle() -> str:
|
||||
"""Returns the InstanceTitle for the current database."""
|
||||
from common.settings import get_global_setting
|
||||
|
||||
@@ -95,7 +100,7 @@ def inventreeInstanceTitle():
|
||||
return 'InvenTree'
|
||||
|
||||
|
||||
def inventreeVersion():
|
||||
def inventreeVersion() -> str:
|
||||
"""Returns the InvenTree version string."""
|
||||
return INVENTREE_SW_VERSION.lower().strip()
|
||||
|
||||
@@ -110,12 +115,12 @@ def inventreeVersionTuple(version=None):
|
||||
return [int(g) for g in match.groups()] if match else []
|
||||
|
||||
|
||||
def isInvenTreeDevelopmentVersion():
|
||||
def isInvenTreeDevelopmentVersion() -> bool:
|
||||
"""Return True if current InvenTree version is a "development" version."""
|
||||
return inventreeVersion().endswith('dev')
|
||||
|
||||
|
||||
def inventreeDocsVersion():
|
||||
def inventreeDocsVersion() -> str:
|
||||
"""Return the version string matching the latest documentation.
|
||||
|
||||
Development -> "latest"
|
||||
@@ -123,26 +128,27 @@ def inventreeDocsVersion():
|
||||
"""
|
||||
if isInvenTreeDevelopmentVersion():
|
||||
return 'latest'
|
||||
return INVENTREE_SW_VERSION # pragma: no cover
|
||||
|
||||
return INVENTREE_SW_VERSION
|
||||
|
||||
|
||||
def inventreeDocUrl():
|
||||
def inventreeDocUrl() -> str:
|
||||
"""Return URL for InvenTree documentation site."""
|
||||
tag = inventreeDocsVersion()
|
||||
return f'https://docs.inventree.org/en/{tag}'
|
||||
|
||||
|
||||
def inventreeAppUrl():
|
||||
def inventreeAppUrl() -> str:
|
||||
"""Return URL for InvenTree app site."""
|
||||
return 'https://docs.inventree.org/app/'
|
||||
return 'https://docs.inventree.org/en/stable/app/'
|
||||
|
||||
|
||||
def inventreeGithubUrl():
|
||||
def inventreeGithubUrl() -> str:
|
||||
"""Return URL for InvenTree github site."""
|
||||
return 'https://github.com/InvenTree/InvenTree/'
|
||||
|
||||
|
||||
def isInvenTreeUpToDate():
|
||||
def isInvenTreeUpToDate() -> bool:
|
||||
"""Test if the InvenTree instance is "up to date" with the latest version.
|
||||
|
||||
A background task periodically queries GitHub for latest version, and stores it to the database as "_INVENTREE_LATEST_VERSION"
|
||||
@@ -164,7 +170,7 @@ def isInvenTreeUpToDate():
|
||||
return inventree_version >= latest_version # pragma: no cover
|
||||
|
||||
|
||||
def inventreeApiVersion():
|
||||
def inventreeApiVersion() -> int:
|
||||
"""Returns current API version of InvenTree."""
|
||||
return INVENTREE_API_VERSION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user