Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Should git ignore .pyproject file?
Forum Update on Monday, May 27th 2025

Should git ignore .pyproject file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Developer123
    wrote on 25 Aug 2022, 14:32 last edited by Developer123
    #1

    This .pyproject file puts all files added in one line:

    {
        "files": ["library/server.py", "library/client.py", "logger.py", ...]
    }
    

    AND the order of the items changes everytime you add a new item. Did the person who make implemented consider that this is an absolute disaster for version control (git)? Any merges of branches with different components will involve looking component by component manually to check what is being added and what is missing. This design is so bad, unless I'm missing something.

    The only way to reasonably work with this is ignorning the file. But documentation says it's used for Qt Creator to load files... So?

    C 1 Reply Last reply 25 Aug 2022, 16:04
    0
    • D Developer123
      25 Aug 2022, 14:32

      This .pyproject file puts all files added in one line:

      {
          "files": ["library/server.py", "library/client.py", "logger.py", ...]
      }
      

      AND the order of the items changes everytime you add a new item. Did the person who make implemented consider that this is an absolute disaster for version control (git)? Any merges of branches with different components will involve looking component by component manually to check what is being added and what is missing. This design is so bad, unless I'm missing something.

      The only way to reasonably work with this is ignorning the file. But documentation says it's used for Qt Creator to load files... So?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 25 Aug 2022, 16:04 last edited by
      #2

      @Developer123 said in Should git ignore .pyproject file?:

      The only way to reasonably work with this is ignorning the file. But documentation says it's used for Qt Creator to load files... So?

      Which tells you that it should not go into git since it's QtCreator dependent like e.g. CMakeLists.txt.user

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      D 1 Reply Last reply 29 Aug 2022, 11:58
      1
      • C Christian Ehrlicher
        25 Aug 2022, 16:04

        @Developer123 said in Should git ignore .pyproject file?:

        The only way to reasonably work with this is ignorning the file. But documentation says it's used for Qt Creator to load files... So?

        Which tells you that it should not go into git since it's QtCreator dependent like e.g. CMakeLists.txt.user

        D Offline
        D Offline
        Developer123
        wrote on 29 Aug 2022, 11:58 last edited by
        #3

        @Christian-Ehrlicher So it should be ignored by git?

        J 1 Reply Last reply 29 Aug 2022, 12:00
        0
        • D Developer123
          29 Aug 2022, 11:58

          @Christian-Ehrlicher So it should be ignored by git?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 29 Aug 2022, 12:00 last edited by
          #4

          @Developer123 Yes, it should not be committed to the repository

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply 7 Sept 2022, 12:29
          0
          • J jsulm
            29 Aug 2022, 12:00

            @Developer123 Yes, it should not be committed to the repository

            D Offline
            D Offline
            Developer123
            wrote on 7 Sept 2022, 12:29 last edited by Developer123 9 Jul 2022, 12:41
            #5

            @jsulm So I put *.pyproject file in .gitignore. Now I cloned the repository, and <projet>.pyproject is not there. I tried opening the project within Qt Creator and... there is no file to select to open the project, only QML files, etc.

            If I simply open the folder within QtCreator, then the Design tab doesn't work because it gives errors (QML emulator layer error, which was fixed on the original project that had the .pyproject.user file). But Projects button on the left bar is grayed out and I can't set the settings again, also Run is grayed out, because... I have no project anymore?

            Are you sure we are supposed to ignore the .pyproject file?

            J 1 Reply Last reply 7 Sept 2022, 12:41
            0
            • D Developer123
              7 Sept 2022, 12:29

              @jsulm So I put *.pyproject file in .gitignore. Now I cloned the repository, and <projet>.pyproject is not there. I tried opening the project within Qt Creator and... there is no file to select to open the project, only QML files, etc.

              If I simply open the folder within QtCreator, then the Design tab doesn't work because it gives errors (QML emulator layer error, which was fixed on the original project that had the .pyproject.user file). But Projects button on the left bar is grayed out and I can't set the settings again, also Run is grayed out, because... I have no project anymore?

              Are you sure we are supposed to ignore the .pyproject file?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 7 Sept 2022, 12:41 last edited by
              #6

              @Developer123 Looks like we gave you wrong advice. .pyproject file is used by QtCreator to manage Python projects (I don't use QtCreator to handle Python projects, so didn't know).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              D 1 Reply Last reply 9 Sept 2022, 09:05
              0
              • J jsulm
                7 Sept 2022, 12:41

                @Developer123 Looks like we gave you wrong advice. .pyproject file is used by QtCreator to manage Python projects (I don't use QtCreator to handle Python projects, so didn't know).

                D Offline
                D Offline
                Developer123
                wrote on 9 Sept 2022, 09:05 last edited by
                #7

                @jsulm Ok so.. what's the solution for developing QtQuick (PySide2) with github?

                J 1 Reply Last reply 9 Sept 2022, 09:26
                0
                • D Developer123
                  9 Sept 2022, 09:05

                  @jsulm Ok so.. what's the solution for developing QtQuick (PySide2) with github?

                  J Offline
                  J Offline
                  JonB
                  wrote on 9 Sept 2022, 09:26 last edited by JonB 9 Sept 2022, 09:27
                  #8

                  @Developer123
                  [So far as I know.] Assuming this includes your .pyproject file (unless I have misunderstood), the "solution" is to include that in your git. You do not "like" that it causes differences due to re-ordering, but that does not make it "wrong".

                  M D 2 Replies Last reply 9 Sept 2022, 17:56
                  0
                  • J JonB
                    9 Sept 2022, 09:26

                    @Developer123
                    [So far as I know.] Assuming this includes your .pyproject file (unless I have misunderstood), the "solution" is to include that in your git. You do not "like" that it causes differences due to re-ordering, but that does not make it "wrong".

                    M Offline
                    M Offline
                    mchinand
                    wrote on 9 Sept 2022, 17:56 last edited by
                    #9

                    @JonB said in Should git ignore .pyproject file?:

                    You do not "like" that it causes differences due to re-ordering, but that does not make it "wrong".

                    I think it would be worth creating a QtCreator bugreport for this current behavior. While adding a new file to the project will create a single line diff however they are ordered (or re-ordered), many diff tools are good at highlighting differences within a single line change. So they would benefit from not having the files re-ordered.

                    1 Reply Last reply
                    0
                    • J JonB
                      9 Sept 2022, 09:26

                      @Developer123
                      [So far as I know.] Assuming this includes your .pyproject file (unless I have misunderstood), the "solution" is to include that in your git. You do not "like" that it causes differences due to re-ordering, but that does not make it "wrong".

                      D Offline
                      D Offline
                      Developer123
                      wrote on 12 Sept 2022, 11:15 last edited by Developer123 9 Dec 2022, 11:16
                      #10

                      @JonB it's not that I don't like, it's just almost impossible to develop any medium-large software like this. Any branch merges that add/remove components will collide and require manual inspection of every component of the entire project listed on the .pyproject file.

                      J 1 Reply Last reply 12 Sept 2022, 11:28
                      0
                      • D Developer123
                        12 Sept 2022, 11:15

                        @JonB it's not that I don't like, it's just almost impossible to develop any medium-large software like this. Any branch merges that add/remove components will collide and require manual inspection of every component of the entire project listed on the .pyproject file.

                        J Offline
                        J Offline
                        JonB
                        wrote on 12 Sept 2022, 11:28 last edited by
                        #11

                        @Developer123
                        Well somehow others have managed. You have a choice: work with what you have now, or give up developing until you have reported the issue, it has been accepted, fixed and released, and you upgrade to that new version. That is your decision.

                        If this is the only show-stopper, maybe you should write a small Python script to parse this file and re-order these lists to always be in, say, alphabetical order. You could use that when comparing, or if you say Qt only rewrites the lines when a new item is added you might run the script on the .pyproject file whenever you/someone does add a new item and then only check in that file when it has been "normalized". Yes it's a pain, but that seems to be where you are at right now.

                        D 1 Reply Last reply 13 Sept 2022, 15:56
                        0
                        • J JonB
                          12 Sept 2022, 11:28

                          @Developer123
                          Well somehow others have managed. You have a choice: work with what you have now, or give up developing until you have reported the issue, it has been accepted, fixed and released, and you upgrade to that new version. That is your decision.

                          If this is the only show-stopper, maybe you should write a small Python script to parse this file and re-order these lists to always be in, say, alphabetical order. You could use that when comparing, or if you say Qt only rewrites the lines when a new item is added you might run the script on the .pyproject file whenever you/someone does add a new item and then only check in that file when it has been "normalized". Yes it's a pain, but that seems to be where you are at right now.

                          D Offline
                          D Offline
                          Developer123
                          wrote on 13 Sept 2022, 15:56 last edited by
                          #12

                          @JonB "You're right, it's an issue with the tool experienced by developers, we need to report and fix that".

                          It's not hard you know

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mchinand
                            wrote on 13 Sept 2022, 16:03 last edited by
                            #13

                            @Developer123 said in Should git ignore .pyproject file?:

                            It's not hard you know

                            This is a user forum, QtCreator developers most likely have not seen this post. You can create a bugreport so that they are made aware of this issue.

                            D 1 Reply Last reply 14 Sept 2022, 09:40
                            1
                            • M mchinand
                              13 Sept 2022, 16:03

                              @Developer123 said in Should git ignore .pyproject file?:

                              It's not hard you know

                              This is a user forum, QtCreator developers most likely have not seen this post. You can create a bugreport so that they are made aware of this issue.

                              D Offline
                              D Offline
                              Developer123
                              wrote on 14 Sept 2022, 09:40 last edited by
                              #14

                              @mchinand Thanks that was a good advice.

                              I looked it up, this issue was already created, but the priority is "somewhat important".. so probably will remain a bug unless more people complain

                              https://bugreports.qt.io/browse/QTCREATORBUG-22492

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved