Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to paprika recipe manager #22

Merged
merged 10 commits into from
Feb 26, 2023

Conversation

luebbert42
Copy link
Contributor

Hi Jochen,

this code picks one recipe from the local repo and creates the format required by Paprika Recipe Manager (in German right now).
This is basically a gz of a json file, which has to be wrapped in a zip file.

Maybe you are interested to merge..

Viele Grüße aus Köln
Dorthe

@ephes ephes self-requested a review February 14, 2023 06:13
@ephes ephes added the enhancement New feature or request label Feb 14, 2023
@ephes
Copy link
Owner

ephes commented Feb 14, 2023

Hi Dorthe,

wow, this looks great 😃! Now I finally have an excuse to play around with Paprika. I just tried an export and it worked. Maybe it's also possible to export all of the recipes?

There are some minor changes I'd like to add to your PR (httpx instead of requests because of mypy, avoid making http calls in the tests), but I would definitely like to merge it. Thanks a lot!

Viele Grüße aus Düsseldorf
Jochen

…s type stubs for mypy and also because httpx is used everywhere else

some typos + staticmethod decorators..

replaced dir with directory to avoid shadowing builtin dir
@luebbert42
Copy link
Contributor Author

Exporting all recipes is pretty easy. You just have to create multiple gz files and wrap that into a zip file. Do you want me to add this ("if user does not add oid as parameter then export everything")?

Paprika seems to use the uuid to determine if it has to update an existing recipe or create a new entry. Right now I am creating a uuid each time I am exporting. For experting everything I would test if I could take the kpncook oid (which is static). So it would be a kind of "sync" and you could export multiple times everything and only the new recipes would be created in Paprika (bad luck if you changed stuff in Paprika though).

And: I am happy to see your changes, I actually learned a lot from your code (e.g. I did not know flit yet). :-)

@ephes
Copy link
Owner

ephes commented Feb 14, 2023

Exporting all recipes is pretty easy. You just have to create multiple gz files and wrap that into a zip file. Do you want me to add this ("if user does not add oid as parameter then export everything")?

Sounds great!

Paprika seems to use the uuid to determine if it has to update an existing recipe or create a new entry. Right now I am creating a uuid each time I am exporting. For experting everything I would test if I could take the kpncook oid (which is static). So it would be a kind of "sync" and you could export multiple times everything and only the new recipes would be created in Paprika (bad luck if you changed stuff in Paprika though).

In the sync_with_mealie command I use the same method to find out whether a recipe was already added to mealie.

And: I am happy to see your changes, I actually learned a lot from your code (e.g. I did not know flit yet). :-)

Thanks :), I didn't know about flit until last year, too. Do you know about pre-commit hooks? They are configured via .pre-commit-config.yaml and they do some checks and linting + autoformat via black and isort. I use them in all my newer projects.

@luebbert42
Copy link
Contributor Author

just a quick update: I worked on the "export all recipes" mini-feature, it's almost done. I am still working on how to correctly do a 404 test with httpx and pytest-mock (sometimes linked images from the kptncook recipes do not longer exist at Cloudfround). To be continued.

luebbert42 and others added 3 commits February 26, 2023 09:04
…arameters all recipes to Paprika, when a recipe id is added as parameter one recipe is exported
…rying to exclude from pyupgrade by adding it as a standalone type
Copy link
Owner

@ephes ephes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good!

Thanks a lot again for your PR 😀 and pointing me to Paprika

@ephes ephes merged commit 33b4fbf into ephes:main Feb 26, 2023
@ephes
Copy link
Owner

ephes commented Feb 26, 2023

Just released 0.0.10 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants