Skip to content

[FR] Restructure code #5578

Closed
Closed

Description

@matmair

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

We currently have frontend and backend structured differently and the name InvenTree is used multiple times. If you clone InvenTree any you set up bare metal manually you end up with this path: /home/inventree/InvenTree/InvenTree/InvenTree/version.py.

Suggested solution

Reshuffle the code organisation, rename the InvenTree Django app and move everything possible into clearly documented (in CONTRIBUTING) folders.

My suggested structure would be something like this:

InvenTree/
├─ .github/
│  ├─ actions/
│  ├─ workflows/
│  ├─ scripts/
├─ .vscode/
├─ src/
│  ├─ backend/
│  │  ├─ requirements.txt
│  │  ├─ src/
│  │  │  ├─ core/
│  │  │  │  ├─ version.py
│  │  │  ├─ common/
│  │  │  ├─ order/
│  │  │  ├─ part/
│  │  ├─ manage.py
│  ├─ frontend/
│  │  ├─ src/
│  │  │  ├─ main.tsx
│  │  ├─ package.json
├─ contrib/
│  ├─ deploy/
│  ├─ docker/
│  │  ├─ Dockerfile
│  │  ├─ docker-compose.yml
├─ docs/
├─ assets/
│  ├─ images/
│  │  ├─ LOGO
├─ tasks.py
├─ README.md

Describe alternatives you've considered

Moving some of the deploy stuff out of the way and adding docs alone would also be a bg win IMO.

Examples of other systems

No response

Do you want to develop this?

  • I want to develop this.

Activity

  1. added
    enhancement
    question
    breaking
    on Sep 20, 2023
  2. added this to the 1.0.0 milestone on Sep 20, 2023
  3. wolflu05 commented on Sep 20, 2023

    @wolflu05
    Member

    This is a good idea to simplify things, but we need to make sure that the plugin system still works with the current import paths.

  4. matmair commented on Sep 20, 2023

    @matmair
    MemberAuthor

    All documented plugins paths are safe, they were structured that way. Imports from InvenTree will need a rewrite, that is kind of the point. Monkey patching that would run into a lot of problems because there are multiple namespaces/modules named InvenTree.

  5. wolflu05 commented on Sep 20, 2023

    @wolflu05
    Member

    Yeah, if its only the InvenTree module and all other models can be imported from the same path, I think its ok if this big change will be mentioned as breaking, that way we can rewrite our plugins. I bet you also import stuff in your plugins other than from the plugin package, e.g. models, ...

  6. SchrodingersGat commented on Sep 20, 2023

    @SchrodingersGat
    Member

    This has been bothering me for ages, I support such a change. It would obviously need a lot of testing :)

  7. matmair commented on Sep 20, 2023

    @matmair
    MemberAuthor

    I can make a PR that shows the effects. I have already tested this for all the docker stuff and know that keeps working. Other things should be straight forward - but breaking to 1) forks and 2) plugins. I think a fat warning in the release notes should be enough for 2) and think 1) can be neglected as I know of none that are signifincant.

  8. self-assigned this
    on Sep 20, 2023
  9. matmair commented on Sep 21, 2023

    @matmair
    MemberAuthor

    My suggestion would be a multi-PR change:

    1. move all files except things that touch InvenTree import internals (ci, docker, Django as a whole, misc files) - with symlinks in place to the new locations for bare metal setups
    2. make the breaking Django app name change on a point release (0.13 or 0.14)
    3. remove symlinks when we release 1.0

    Does this sound good @inventree/triage ?

  10. added a commit that references this issue on Oct 3, 2023
    62de738
  11. added a commit that references this issue on Oct 11, 2023
    25c718a
  12. added a commit that references this issue on Dec 16, 2023
    f6d8588
  13. modified the milestones: 1.0.0, 0.15.0 on Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

breakingdocumentationenhancementquestionrefactor

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions