2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 18:45:40 +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:
Matthias Mair
2024-04-03 02:16:59 +01:00
committed by GitHub
parent dd889e8eeb
commit 0bace3f3af
3317 changed files with 532 additions and 1194 deletions

View File

@ -119,7 +119,7 @@ def localDir() -> Path:
def managePyDir():
"""Returns the directory of the manage.py file."""
return localDir().joinpath('InvenTree')
return localDir().joinpath('src', 'backend', 'InvenTree')
def managePyPath():
@ -149,7 +149,7 @@ def yarn(c, cmd, pty: bool = False):
cmd: Yarn command to run.
pty (bool, optional): Run an interactive session. Defaults to False.
"""
path = managePyDir().parent.joinpath('src').joinpath('frontend')
path = localDir().joinpath('src').joinpath('frontend')
c.run(f'cd "{path}" && {cmd}', pty=pty)
@ -210,7 +210,7 @@ def check_file_existance(filename: str, overwrite: bool = False):
@task(help={'uv': 'Use UV (experimental package manager)'})
def plugins(c, uv=False):
"""Installs all plugins as specified in 'plugins.txt'."""
from InvenTree.InvenTree.config import get_plugin_file
from src.backend.InvenTree.InvenTree.config import get_plugin_file
plugin_file = get_plugin_file()
@ -227,19 +227,19 @@ def plugins(c, uv=False):
@task(help={'uv': 'Use UV package manager (experimental)'})
def install(c, uv=False):
"""Installs required python packages."""
print("Installing required python packages from 'requirements.txt'")
print("Installing required python packages from 'src/backend/requirements.txt'")
# Install required Python packages with PIP
if not uv:
c.run('pip3 install --upgrade pip')
c.run('pip3 install --upgrade setuptools')
c.run(
'pip3 install --no-cache-dir --disable-pip-version-check -U -r requirements.txt'
'pip3 install --no-cache-dir --disable-pip-version-check -U -r src/backend/requirements.txt'
)
else:
c.run('pip3 install --upgrade uv')
c.run('uv pip install --upgrade setuptools')
c.run('uv pip install -U -r requirements.txt')
c.run('uv pip install -U -r src/backend/requirements.txt')
# Run plugins install
plugins(c, uv=uv)
@ -248,10 +248,10 @@ def install(c, uv=False):
@task(help={'tests': 'Set up test dataset at the end'})
def setup_dev(c, tests=False):
"""Sets up everything needed for the dev environment."""
print("Installing required python packages from 'requirements-dev.txt'")
print("Installing required python packages from 'src/backend/requirements-dev.txt'")
# Install required Python packages with PIP
c.run('pip3 install -U -r requirements-dev.txt')
c.run('pip3 install -U -r src/backend/requirements-dev.txt')
# Install pre-commit hook
print('Installing pre-commit for checks before git commits...')
@ -324,7 +324,7 @@ def translate_stats(c):
except Exception:
print('WARNING: Translation files could not be compiled:')
path = Path('InvenTree', 'script', 'translation_stats.py')
path = Path('src', 'backend', 'InvenTree', 'script', 'translation_stats.py')
c.run(f'python3 {path}')
@ -870,7 +870,7 @@ def test(
@task(help={'dev': 'Set up development environment at the end'})
def setup_test(c, ignore_update=False, dev=False, path='inventree-demo-dataset'):
"""Setup a testing environment."""
from InvenTree.InvenTree.config import get_media_dir
from src.backend.InvenTree.InvenTree.config import get_media_dir
if not ignore_update:
update(c)
@ -937,8 +937,8 @@ def schema(c, filename='schema.yml', overwrite=False, ignore_warnings=False):
@task(default=True)
def version(c):
"""Show the current version of InvenTree."""
import InvenTree.InvenTree.version as InvenTreeVersion
from InvenTree.InvenTree.config import (
import src.backend.InvenTree.InvenTree.version as InvenTreeVersion
from src.backend.InvenTree.InvenTree.config import (
get_config_file,
get_media_dir,
get_static_dir,
@ -1101,7 +1101,7 @@ def frontend_download(
if not extract:
return
dest_path = Path(__file__).parent / 'InvenTree/web/static/web'
dest_path = Path(__file__).parent / 'src/backend' / 'InvenTree/web/static/web'
# if clean, delete static/web directory
if clean: