Publish forked repository on pypi or use a subtree?

I have one repository that updates my recipes list: GitHub - datapolitical/paprika-exporter: Export recipe data out of Paprika into YAML

And another that runs my website: GitHub - datapolitical/ My blog

Edit: I have copied the code over and set it to run as a GitHub action. It’s working, but there’s no way to keep it synced with the upstream.

My thought is to publish paprika-exporter as a package and then run it from my website repo, but that would edit the directory structure of paprika-exporter so I’m not sure if it would still pull changes correctly from upstream.

Any help would be greatly appreciated.

The data from paprika-exporter needs to be moved into the website folders, which is currently done manually on my computer. I’d like it to happen any time the paprika repo is updated.

I’m not sure what the right mechanism is. I could move it as an artifact I think, or just git fetch the first repository and move the files, but then it wouldn’t know to trigger unless there’s a way to have an action watch another repository. Some guidance would be very welcomed.

You could do that by having the synchronization workflow in your website repo with a workflow_dispatch trigger. The workflow_dispatch event can be created over the API as described in the documentation, so you could have a workflow in the paprika-exporter repo that sends this event on update (preferable after successful tests).

Here are some examples of workflows that are used to make updates such as you’re talking about:

The only catch is you need to setup a PAT and add it as a secret in the repo running the action: Creating a personal access token - GitHub Docs

So after reading more about the problem I decided to just move the code over then run the export from the main repository.

But now that means that that export code is detached from the upstream. That seems to give me two options.

  1. Set up the file in the sub directory and create a subtree of my initial fork of the exporter repo

  2. publish my fork on pypi and then just run it like any other module.

I like #2 better, but I don’t know how to take the existing code and publish it because the upstream repository isn’t set up to be published. Can I just modify my fork to follow these instructions: How to Host your Python Package on PyPI with GitHub | Codementor

I’m worried it would cause issues if I move files into a sub directory so they don’t match the location in the upstream.

Any help is greatly appreciated.

There should be no need to move the upstream code into a subdirectory for packaging. I recommend taking a look at the official Python packaging guide instead (even if it’s longer):

See the packages section for what to include.