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

Automate PyPI package updates #177

Open
iheanyi opened this issue Nov 29, 2020 · 8 comments
Open

Automate PyPI package updates #177

iheanyi opened this issue Nov 29, 2020 · 8 comments
Assignees

Comments

@iheanyi
Copy link
Owner

iheanyi commented Nov 29, 2020

Given that I don't maintain this anymore and the package is under my name, we should automate the process for whenever a new release is cut, we should build and upload a new package to the PyPI repository from the master branch.

Steps to do this:

  1. Add PyPI API Token
  2. Use python setup.py sdist bdist_wheel to build the latest version
  3. Use Twine to upload the latest version using the API token

For testing, we should test this using TestPyPI first for PRs and then swap this out for the release event for uploading to the real thing.

@iheanyi
Copy link
Owner Author

iheanyi commented Nov 29, 2020

As an alternative follow-up, might be worth exploring how to decentralize it but this is a good first step.

@Evolution0
Copy link
Collaborator

Going to start work on this today, hopefully 0.0.10 will be the first to be published this way.

Then I can start working my way down the issue log.

@Evolution0
Copy link
Collaborator

Evolution0 commented Jan 10, 2021

@iheanyi I've pushed the workflow setup needed for automatic builds pushed to TestPyPI with the commands for PyPI included but commented out.

That is about all I can do from my end, tokens and such need to be generated (I can do it for PyPI but not Github)

If you think its worth reconfiguring the build system and project files for the repo to be PEP 517/518 compliant (pyproject.tml) and use setup.cfg let me know, I'm not familiar with the new system but I can't imagine its hard to work out.

Edit: I'll create a build for 0.0.10 then hopefully any further builds will be automatic.

Can also confirm that the workflow now works properly after a few tweaks (right build command since we use setup.py, and installed wheel before running build command) just needs a TestPyPI token added to secrets as TEST_PYPI_API_TOKEN now to test then we can move to PyPI.

@iheanyi iheanyi self-assigned this Jan 11, 2021
@iheanyi
Copy link
Owner Author

iheanyi commented Jan 11, 2021

@Evolution0 Oh snap, I got you on this week hopefully, thanks for getting started on it. I'm also going to look into changing the permissions and seeing if you can get the permissions to manage secrets, if that's cool?

@Evolution0
Copy link
Collaborator

Yeah that will be fine.

@iheanyi
Copy link
Owner Author

iheanyi commented Jan 13, 2021

@Evolution0 I've added the token in there, but the build step is failing.

/opt/hostedtoolcache/Python/3.9.1/x64/bin/python: No module named build

@Evolution0
Copy link
Collaborator

Evolution0 commented Jan 13, 2021

@iheanyi The build looks like its successful according to the log but it doesn't push to TestPyPI because of:

Warning:  It looks like you are trying to use an API token to authenticate in the package index and your token value does not start with "pypi-" as it typically should. This may cause an authentication error. Please verify that you have copied your token properly if such an error occurs.

Ensure that the token is prefixed with "pypi-".

You can click the red X (or green check if successful) next to the most recent commit at the top of the repo to see the log.

@Evolution0
Copy link
Collaborator

TestPyPI builds are going through just fine now on each push after some minor tweaking (also updated the workflow)

I wouldn't go so far as to add a release workflow quite yet, id like to figure out requests-cache to be able to add a testing step to check for regressions/bugs and such (as testing against Bandcamp itself live could put us in a youtube-dl situation) before the actual publish step.

Honestly I should probably start pushing to a dev branch and set the workflow to publish that one to the test server instead, that way there is a clear division between release build and test build and users will still have access to test builds via TestPyPI.

Kind of put it off for a year.. sorry about that. Hopefully I can make some headway into simplifying the code and breaking it up into manageable pieces like I originally intended + adding more documentation so that other people have an easier time working on it. Takes a while to get back into the right mindset to work on it after so long, sometimes its like I didn't even write the code I'm looking at.

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

No branches or pull requests

2 participants