pymupdf / PyMuPDF-Utilities

Demos, examples and utilities using PyMuPDF
GNU Affero General Public License v3.0
566 stars 153 forks source link

Issue/88 merge the demo scripts into the examples folder #91

Closed programarivm closed 1 year ago

programarivm commented 1 year ago

Closes https://github.com/pymupdf/PyMuPDF-Utilities/issues/88

JorjMcKie commented 1 year ago

@programarivm - this affects a lot of the script - actually all of them. This makes it impractical or even impossible to do a review just based on looking at the PR itself: Can you please give me an idea what the final folder layout of the repo would look like? Something like this maybe

exammples
    folder1: contains scripts like ...
    folder2: contains scripts like ...  
        folder21
... etc.

That would make it much easier for me to see what would happen by the merge. Of yourse we would have to change all the references in the PyMuPDF in RTD again ...

Thank you!

programarivm commented 1 year ago

@JorjMcKie that's a good point.

In my opinion, atm it's just fine to store the scripts in the examples folder. Sorry that I can't give you an idea about the final layout structure; the purpose now is to incrementally improve the codebase by using a self-explanatory naming convention that's easy to update as well.

After the first refactor is completed, what about refactoring the examples folder into chapters of increasing difficulty like in a book or tutorial?

01-the-very-basics 02-working-with-text 03-working-with-images 04-pdf-tools

programarivm commented 1 year ago

Hopefully this table will help review this PR, thank you @JorjMcKie

Demo Examples
PIL2fitz.py examples/convert-image/convert.py
fitz2PIL.py examples/convert-pixmap/convert.py
curly-polygon.py examples/draw-polygon/draw.py
decrypt.py examples/decrypt-document/decrypt.py
fitz-logo.py examples/insert-logo/file.py
svg-logo.py examples/insert-logo/svg.py
numpy2fitz.py examples/draw-rgb-area/draw.py
pdf-converter.py examples/convert-document/convert.py
pdfviewer(wx).py examples/view-document/view.py
pixmap.py examples/tile-image/tile.py
splitter.py examples/split-document/split.py
JorjMcKie commented 1 year ago

Ok, then how about following the structure of topics one level below the "Recipes" section of the documentation. We do already today refer to example script from there. So it probably makes not much sense to establish a different folder structure inside the examples folder.

JorjMcKie commented 1 year ago

You probably should also talk to @jamie-lemon about this: he is working on improving the RTD documentation structure.

JorjMcKie commented 1 year ago

@programarivm / @jamie-lemon In the future we should probably turn round the requirement: For any new script in this repository there needs to be a referral as to which Recipe section it belongs. If there is no suitable sub-section yet, we would need a larger round of decision makers to either extend the number of sub-sections, or even reject the example script.

programarivm commented 1 year ago

@JorjMcKie and @jamie-lemon, what about: (1) merge this PR, (2) hold off on refactoring the examples and (3) update the links?

jamie-lemon commented 1 year ago

I'm happy update any links to the Utilities repo as required in the main PyMuPDF repo. Overall (although I don't appreciate all the fine details of this PR) I don't have any problems with this PR, it just means some docs link updates for me down the line.

JorjMcKie commented 1 year ago

Ok, gentlemen, thanks for all your feedbacks. I will go ahead and do the merge here.