Skip to content

Conversation

@bittner
Copy link
Member

@bittner bittner commented Sep 30, 2018

This PR introduces a number of additions and changes that make building and deploying a Python package easier and cleaner:

  • Load resources using pkg_resources (from setuptools) instead of directly from file system
  • Handle missing dependencies at runtime (print error message explaining what to do)
  • Add a test suite configuration and first tests (BDD)
  • Drop Python 2 for linting, tests and builds

@bittner bittner force-pushed the feature/build-python-package-pypi branch from 50b33b2 to 119e189 Compare September 30, 2018 11:43
Copy link
Member

@cool-RR cool-RR left a comment

Choose a reason for hiding this comment

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

Great job. I'm not a fan of the wordy BDD, but I respect your choice.

Drop Python 2 from linting and tests
@bittner bittner force-pushed the feature/build-python-package-pypi branch from 119e189 to 043fe4b Compare September 30, 2018 11:47
@cool-RR
Copy link
Member

cool-RR commented Sep 30, 2018

I see that tests are passing. Ready to merge?

@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

As long as the title has the "WIP:" prefix you should consider it "work in progress", hence not ready to merge. I'll change the title as soon as it's ready to merge.

What is missing is the build and upload logic to PyPI in the Travis configuration. You'll have to help me with submitting credentials to your Travis account (because builds happen on your Travis account), later.

@cool-RR
Copy link
Member

cool-RR commented Sep 30, 2018 via email

@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

I'm not a fan of the wordy BDD, but I respect your choice.

We can use pytest instead, technically it doesn't make a difference. (In fact, I first started to prepare a pytest setup.)

The reason I chose behave is that Gherkin is much more self-explanatory (in the build log output), even for users and developers not practical with writing tests. I feel that is closer to the audience of PythonTurtle. Just in case someone may be interested in taking a look at the technical setup of the project.

@cool-RR
Copy link
Member

cool-RR commented Sep 30, 2018 via email

Silence too loud (typically less critical) complaints for now
@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

My preference is pytest.

Let's change that later. I don't insist, but I'd better get the deployment working first.

@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

It looks like you really have to generate an encrypted password using the travis CLI client. Hence, can you please:

  1. Install the CLI client (as described in the Travis blog or their docs)
  2. Run the below command in the terminal (see the related docs for more info). You may have to log in using the client first.
travis encrypt <your-password-here> --add publish.password

The docs say, deploy.password; I guess that's the hierarchical path to the key, not a fixed keyword, so I adapted it accordingly. (I may be wrong.)

If you don't want or can't install the Ruby gem you can try the following command using Docker (which works on my machine):

$ docker run --rm -v $PWD:/repo -v ~/.travis:/travis antonmry/travis-docker encrypt "foo-bar-baz-123" --add publish.password
Outdated CLI version, run `gem install travis`.
detected repository as bittner/PythonTurtle

I've left the command output there, so you can spot why my Travis account is not sufficient: It's adding the key to the "wrong" project.

@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

Oh, make it pypi.password.

You need to run this from the project repository, having the project cloned on your computer. It will modify the .travis.yml file (in an utterly unpleasant way) and add a section like this to it:

pypi:
  password:
    secure: I/UBNQygyE....YxwwP4g=

I only need the content of the secure: block. This is a public value, no need to keep it secret.

@bittner
Copy link
Member Author

bittner commented Sep 30, 2018

Hmmm, the more I think about it ... I guess it has to be deploy.password. 😕

@bittner bittner changed the title WIP: Build Python package for PyPI Build Python package for PyPI Sep 30, 2018
provider: pypi
user: coolRR
password:
secure: <travis-encrypt-value-here>
Copy link
Member Author

Choose a reason for hiding this comment

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

I think, the PR is now ready to merge. We'll only need to update this password value later (to make uploading to PyPI work).

@cool-RR cool-RR merged commit 2cdd0e4 into PythonTurtle:master Sep 30, 2018
@cool-RR
Copy link
Member

cool-RR commented Sep 30, 2018

Here's the line:

secure: fdbhH+rsqfG9WfILlBZXlNNSXZVHrfBH9zWa7kKiUY55GMYKli+u/MzG1i6Ezn53Vg1wL1NTQMm5rFbbUfBE2l5/+S191saBZGApEhQZhulSkG702FCbpuGs1a26Zm+dhjyiRvuNdnPB8BA61uHSpWFzDgpLurGsZB0TyB2hZqv7LFL1eG56mKh70LTIDO5XmDh5/yDEXfc23M2nS7Zwx2xJEM047Fay/yeZSjo+LEYgCoTM/z9TftyxkyuLOGsiRoBMwL7eb7wKJzk79vSAvgZP/fSuAqc8ut1lrk1S9OIO4I9s7Zpi1QneJSGDJu4IHfV3nlge/+tlN8aeLA6GsSy/RrrzueBdtYTpbt34vO5rVfhJwjHIKTQa4GUF0R6gCiQ0JjJiXLC+UAbePZxzAKQWaxJWWpqq8L9e+LlHWpEtuB4jEqncFs6FeTT7mTWz2HMTQvvIVAsI2xFkItY4yCpE3P5+5f6UgqwqFpuKCXWF6ohQ090wTlNxN5cikNSYdPPQj7hypKzWrYcH5z4Z4pU63mnO2fZgTEZomvYKXa9mcdtZcCBhPNJW9WTgxqKSouPcjYc4me9wk4wv4ncJaCPLlxbuW7T/Nv+Xy/HYn7eljRapnu7/XcVQgB6gG4vxbRkkLkr1Ybj0xcR2neAQcxhBBqzfCyQezh210dPGqF8=

@bittner bittner deleted the feature/build-python-package-pypi branch September 30, 2018 16:00
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

Successfully merging this pull request may close these issues.

2 participants