Merge ppa-dev-tools:fix-lp-credentials into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: 9eb18737f3409a533ae7f677fa9bfc10baf7000a
Proposed branch: ppa-dev-tools:fix-lp-credentials
Merge into: ppa-dev-tools:main
Diff against target: 431 lines (+141/-76)
6 files modified
INSTALL.md (+0/-1)
ppa/lp.py (+1/-7)
ppa/ppa.py (+119/-50)
ppa/ppa_group.py (+1/-1)
scripts/ppa (+18/-3)
tests/test_lp.py (+2/-14)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Reporter Pending
Review via email: mp+429807@code.staging.launchpad.net

Description of the change

This branch focuses mainly on bug fixes, and improvements to error handling and return values generally.

I wanted to also flesh out the test cases for ppa.py since currently they're pretty minimal, and ppa.py still has some pylint problems and some unimplemented internal functionality. But this is a good step forward.

The "Improve error handling and return behavior" commit is a bit of a mishmash of several changes that more properly should have been done as several separate commits. I'll beg forgiveness for my laziness here, but hopefully it's straightforward enough to review.

While this tackles many of the bugs Christian filed from his testing, I've not tackled them all, and there are almost certainly more corner cases I've not addressed. Please mention any you can think of or spot.

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote (last edit ):

Nothing severe, you can address this in a later PR, but IMHO "ppa", "Ppa", "PPA" is rather inconsistent.
This example:
     def get(self, ppa_name):
         """Provides a Ppa for the named ppa.
         :rtype: ppa.Ppa
        :returns: A Ppa object describing the named ppa

"A Ppa" it isn't at the beginning of the sentence, so why start upper case?
And if it would generally be "Ppa" then why is the one at the end all lower case.

rtype: ppa.Ppa seems odd too, isn't that "ppa.ppa"? In other places it is all lower already like "self.ppa_name".

My suggestion would be to make:
- all variable (unless there is another rule) fully lower (local) upper (global if any) case.
- All text mentions of PPA all uppercase everywhere, that is how people write about it usually

WDYT?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

One commit introduces this:
+ :rtype: tbd
+ :returns: tbd

Not changed later AFAICS, should this really stay "tbd"?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote (last edit ):

Also adds commented section:
+ # elif series:
+ # das = get_das(distro, series, arch)
+ # ds = distro.getSeries(name_or_version=series)

Oh I see, all of them are yet known-unimplemented.
But one thing on them - I assume "das" should be "distro archive series".
Since variables and function as "das" how about changing the argument order to be Distro, Arch, Series as well?

That would be a different PR.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Other than those suggestions it LGTM, +1 for landing this and splitting the other things into further work down the road.

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

You're right about the inconsistent capitalization being weird. They do mean different things though:

PPA is Launchpad's name for the service it provides.
ppa is what Launchpad calls the API object for accessing PPA's.
Ppa is the name of the class in ppa-dev-tools
ppa is the name of the module that contains classes like Ppa, PpaGroup, Job, Result, et al.
ppa is also the name of the CLI script that uses the Ppa class for accessing LP's ppa object for manipulating PPAs.

Whew. But I see in the snippet of the code docs the usage is not correct by these rules anyway, and could benefit from disambiguation (e.g. say "Ppa class" rather than just "Ppa"). I'll do a pass through the docs to refine, before landing this branch.

Revision history for this message
Bryce Harrington (bryce) wrote :

Regarding the tbd return types, these need to reference the Launchpad object types, which I need to look up the exact precise terminology for, so I left the tbd there as a reminder. I'll do that lookup and update docs before landing this branch.

Revision history for this message
Bryce Harrington (bryce) wrote :

For the das = get_das() stuff, that is ancient code that might be vestigial, or might still be needed. The change in this branch is commenting out the code (it currently does nothing, except trigger pylint/flake warnings) but is not relevant to these bug fixes, except just being in the way.

When I'm further along with feature development, it should be more obvious if this code is going to be needed (and should be cleaned up) or can just be deleted. But I'm leaving it as is for now.

Revision history for this message
Bryce Harrington (bryce) wrote :

Fixed both the documentation issues mentioned above, and landed the branch. Here's the commit messages for those two additions:

commit a95d05b5f155d3bbf04b45e2a2d739f64d5e2603 (HEAD -> main, origin/main, fix-lp-credentials)
Author: Bryce Harrington <email address hidden>
AuthorDate: Tue Sep 13 19:48:15 2022 -0700
Commit: Bryce Harrington <email address hidden>
CommitDate: Tue Sep 13 19:48:15 2022 -0700

    Fix capitalization/terminology for PPAs vs. Ppa vs. ppa

    We're unfortunately using the same three letters to refer to a variety
    of different technical items. A 'PPA', or "Personal Package Archive",
    is the Launchpad-based service providing packages. 'ppa' is the name of
    the objects provided by Launchpad's REST service for interacting with
    PPAs. 'Ppa' is a wrapper class provided by this project to interact
    with the ppa REST API that instantiates 'Ppa objects' that are usually
    assigned to a variable named 'ppa'. The Ppa class is provided by the
    'ppa' Python module which exists inside the 'ppa' module namespace.
    Finally, the whole apparatus is accessed using a command line
    interface (CLI) tool provided by a Python script named 'ppa'.

    So... it's ppa's all the way down.

    At least let's get the capitalizations correct for PPA and Ppa and
    avoid *that* confusion.

commit b01a8aac9cd93b8181fec9c590213801eff6f3f1
Author: Bryce Harrington <email address hidden>
AuthorDate: Tue Sep 13 19:43:57 2022 -0700
Commit: Bryce Harrington <email address hidden>
CommitDate: Tue Sep 13 19:43:57 2022 -0700

    Define some additional Launchpad data types

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: