-
Notifications
You must be signed in to change notification settings - Fork 3
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
Modify github-to-sops directory structure for publishing to PyPI #3
Conversation
I was a little iffy on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjwignar great work! Thanks for pushing on this for 1.1.
I'm not a Python dev, but I wonder if this is right github-to-sops → github-to-sops/__init__.py
. I'd be surprised to find the source for a module in __init__.py
. Maybe @tarasglek knows.
How do secrets work for the CI publish workflow? I assume @tarasglek has to do this from his account somehow?
tests/test_github-to-sops.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am uncertain whether we should add the most basic test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I think I will remove this file.
Depending on if we want tests at all, I might have to remove or modify some other files that reference pytest
(e.g. .github/workflows/test.yml
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed tests/test_github-to-sops
as of 278bda4, leaving the tests
folder empty.
The test.yml workflow still passes without errors: https://github.com/rjwignar/github-to-sops/actions/runs/7735949309
@tarasglek, Simon's template configures the library with pytest as an optional dependency.
We currently don't have any tests setup for github-to-sops, but I see unit tests are something you'd like to see added to github-to-sops
:
With that in mind, would you like this PR to be configured with pytest setup so tests can be added in the future?
i.e. keep the following in the PR?:
- an empty
test
folder .github/workflows/test.yml
,- the
test
jobs insidepublish.yml
, pytest
as an optional dependency inpyproject.toml
)
.github/workflows/publish.yml
Outdated
pip install '.[test]' | ||
- name: Run tests | ||
run: | | ||
pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this step is different from the Run tests
in test.yml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why. Both workflows were generated by https://github.com/simonw/python-lib-template-repository.
However, we can remove this step entirely if we don't include pytest in this library.
@kliu57 could you take a look at I've seen some projects with empty an Does it make sense to have the |
@tarasglek can you add @rjwignar to the collaborators for this repo? |
Back when I published something to PyPI last term I used an empty |
The directory structure generated by https://github.com/simonw/python-lib-template-repository includes program code inside Here's the |
I see, so it was automatically generated by the tool. I've never used this tool, I did my project restructuring manually. |
If Simon puts the code in |
I've been able to fill out the form myself and add github-to-sops as a pending project on PyPI (we've reserved the package name github-to-sops)
@humphd It looks like no secrets are involved in the publish workflow. From Simon's blog on Trusted Publishing, It looks like Trusted Publishing involves three steps:
|
I've taken a look at some of his recent projects and he keeps source code into submodules that are imported by I think for this PR, we should keep |
- removed [project.optional-dependencies] from pyproject.toml - removed test.yml workflow - removed test job and test job dependency from publish.yml
Invited you guys to the repo |
@rjwignar I don't think you need anything from me to proceed, please push a release. |
Summary
This Pull Request modifies the directory structure of
github-to-sops
to one that can be packaged and published to PyPI.This was done using Simon Willison's cookiecutter template to create a mock project and replicating mock project's directory structure in this branch.
These changes should allow us to ship
github-to-sops
to ChatCraft viapip
, as per tarasglek/chatcraft.org#324The cookiecutter template
The cookiecutter template:
pyproject.toml
file configured withsetuptools
pytest
as a test dependencypackage_name/__init__.py
tests/test_package_name.py
.github/workflows
:My modifications
pyproject.toml
based on what is produced by the template. Content modified to be specific to github-to-sopsREADME.md
github-to-sops
togithub-to-sops/__init__.py
tests/test_github_to_sops
with empty tests.github/workflows
to directory (as the workflow content doesn't depend on the project name)Next Steps
Assuming this directory structure is correct, the next steps would be to use PyPI's Trusted Publishing mechanism to publish github-to-sops to PyPI.
Below is an example of the Trusted Publishing form Willison filled to publish his own library, datasette-test
We would have to fill in this form with this repo's info.
I might be able to fill in the form myself but I wanted to first confirm these changes with @tarasglek.