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

Create Github Actions workflow to build and deploy on Test PyPi and PyPi #820

Merged
merged 11 commits into from
Oct 9, 2020

Conversation

valeriupredoi
Copy link
Contributor

@valeriupredoi valeriupredoi commented Oct 8, 2020

Automate the deployment to PyPi 🐍📦

See #814

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Please use yamllint to check that your YAML files do not contain mistakes

@valeriupredoi
Copy link
Contributor Author

valeriupredoi commented Oct 8, 2020

@bouweandela do you have a pyproject.toml hanging around from previous PyPi builds? I am a bit lazy and not 100% sure of creating one; do we need to use pep517 to create the wheel or we just use the usual python3 setup.py sdist bdist_wheel?

@bouweandela
Copy link
Member

It would probably be good to use that, since it looks like that's the future of Python packaging, see also this blog: https://snarky.ca/what-the-heck-is-pyproject-toml/

From the blog, it looks like the following content would be enough:

[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
build-backend = "setuptools.build_meta"

@valeriupredoi
Copy link
Contributor Author

I'll try that in a jiffy, cheers dude 🍺

@valeriupredoi
Copy link
Contributor Author

OK good news! I got the darn thing to build the wheel automatically (cheers for the pyproject file suggestion, @bouweandela ) but it looks like I have no permission to upload to Test PyPi - see test - this means that either @bouweandela hasnt added me as collaborator on Test PyPi or the Secrets have not been set correctly on ESMValCore/Settings @mattiarighi - can you guys check this by running the test yourselves pls? To trigger the test just do a dummy push to this branch

@valeriupredoi
Copy link
Contributor Author

OK good news! I got the darn thing to build the wheel automatically (cheers for the pyproject file suggestion, @bouweandela ) but it looks like I have no permission to upload to Test PyPi - see test - this means that either @bouweandela hasnt added me as collaborator on Test PyPi or the Secrets have not been set correctly on ESMValCore/Settings @mattiarighi - can you guys check this by running the test yourselves pls? To trigger the test just do a dummy push to this branch

problem solved by @bouweandela adding me to PyPi/Test PyPi 🍺

@valeriupredoi
Copy link
Contributor Author

here is a (most probable) explanation for the failed circleCI test: pypa/pip#8437

@bouweandela
Copy link
Member

bouweandela commented Oct 9, 2020

From the blog:

which is why the current directory is not put on sys.path automatically; you will need sys.path.insert(0, os.path.dirname(__file__)) or equivalent if you're importing local files

So you'll probably need to insert that before trying to import esmvalcore._version in setup.py. Alternatively, I think you could just write a small function to read the version number from the file without importing it.

@valeriupredoi
Copy link
Contributor Author

@bouweandela you Dutch genius! How did I miss that? Yeh, does the job, but two things: the package already being on Test PyPi the upload fails (should I remove it from Test PyPi? - am scared) and PEP8 complains about the module import not being at top of file - bs if you ask me but hey, it's PEP8

@bouweandela
Copy link
Member

You can't remove packages from (test) PyPI, because that's just a really bad idea. Just use a new version number for the next try, e.g. 2.1.0.post0, 2.1.0.post1 etc.

Copy link
Member

@bouweandela bouweandela left a comment

Choose a reason for hiding this comment

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

Nice job!

@bouweandela bouweandela merged commit 301ec5a into master Oct 9, 2020
@bouweandela bouweandela deleted the GA_pypi_build_and_deploy branch October 9, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants