Add CD to publish PyPi Package
🚀 The feature, motivation, and pitch
It would be nice if we could pip install trlx in a project, rather than having to clone.
I suggest we use the approach that I also implemented for TrasformerLens:
- Use Poetry rather than SetupTools/PIP to manage dependencies when developing the project (end users can still use pip to install it). This automatically detects dependency clashes that can be a nightmare with PyPi releases. It also has some nice helper tooling (e.g. for bumping package versions). Downside is it's a bit slower.
- Break out checks from the pre-commit hook into a workflow that runs on all PRs and pushes to main (so that we can see which part failed and why) - things like pytest and mypi. Also run this on all common Python versions (a bit like https://github.com/neelnanda-io/TransformerLens/actions/runs/3934543895/jobs/6729387264 )
- Have a release workflow, so that when you create a release (e.g. with v.1.x.0) on GitHub it automatically bundles up the package and releases to PyPi (if the checks are still passing)
Alternatives
Do all the above but use SetupTools still rather than Poetry. Advantage is it's still more known (although Poetry is very popular now), disadvantage is a lot of stuff is harder (e.g. bumping package versions in the CD automatically) and it doesn't check for conflicts.
Additional context
Happy to implement this
Hi @alan-cooney! This is definitely something we'd like. I believe most of us are familiar with SetupTools so I'm partial to the alternative you've outlined.
Break out checks from the pre-commit hook into a workflow that runs on all PRs and pushes to main (so that we can see which part failed and why) - things like pytest and mypi.
- What's different in this scenario from what's currently being done for PRs in the GH workflow (e.g. see Actions)?
Ah yes I assumed that the build action was something else - we can just reference this directly for the checks part (and probably rename it to checks).
I'll create the PR
Was this done? Otherwise I'm willing to take it.
Sorry it hasn't been done yet.
My personal opinion is that https://github.com/neelnanda-io/TransformerLens/blob/main/.github/workflows/release.yml represents best practice on this as a starting point (needs to be switched to use pip/setup tools though