types and annotations for the koji build system
Project description
Overview
preoccupied.koji-typing is an experimental distribution which
provides typing support for the koji package.
It is currently a Work In-Progress, there are still many signatures to be added. The initial starting point was simply the set of hub calls that were being used by koji-smoky-dingo. This project aims to fill out everything.
This project is neither enodorsed, nor supported, by the upstream Koji project.
This repository exists because I had a number of opinions on how to
produce the typing support. There is an open issue in the upstream
to start including typing stubs. However, because koji still supports
Python 2, they are limited to only providing stubs. This means that
their TypedDict declarations are also constrained purely to the stub
definitions. The problem with this approach is that one cannot import
typing declarations from a stub for use in a non-stub. While MyPy
can infer some of the fields from the usage of the return values this
way, anything more complex than mutating the fields in the same
function they are obtained becomes un-checkable. One could not declare
helper functions and then annotate them to make it clear that they
operate specifically on the BuildInfo structure, because BuildInfo
could not be imported and used for the annotation during runtime
loading of the hypothetical module.
Runtime package
The runtime-available koji_types package provides a number of
TypedDict definitions which provide structure for the numerous
dictionary result types returned by koji's ClientSession
interface. These types can be used to annotate your client code in
order to later perform anaylsis. It also provides some Pythonic
enumerations for some koji constant values.
Static analysis package
Following PEP-561 guidelines the packages koij-stubs,
koji_cli-stubs, and kojihub-stubs provide partial stub annotations
for use during static analysis with tools like MyPy. These all rely
on the koji_types package definitions in order to supply accurate
signatures for many of the dict-based results.
Caveats
I have not been able to figure out how to provide typing annotations
to correctly reflect the return type change of ClientSession calls
which support a queryOpts in the use case of countOnly = True. In
those calls the return type is actually an int but I haven't found a
way to provide an override annotation that shows this.
# here the return type is List[UserInfo]
friends = session.listUsers()
# here the return type is actually int, but no annotation support
# exists for this scenario so static analysis will still think
# it's a List[UserInfo]
howmany = session.listUsers(queryOpts={"countOnly": True})
Contact
Author: Christopher O'Brien obriencj@preoccupied.net
Original Git Repository: https://github.com/obriencj/koji-typing
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this library; if not, see http://www.gnu.org/licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file preoccupied_koji_typing-1.35.0.tar.gz.
File metadata
- Download URL: preoccupied_koji_typing-1.35.0.tar.gz
- Upload date:
- Size: 69.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
992244bfdcb75f75b703d30953560ce3935d466e3250ef00d0cf3c86eae31831
|
|
| MD5 |
c3ec7af045f8429d49c1574292d740d8
|
|
| BLAKE2b-256 |
b6520786c9e584eedcd1de369e7de78fd091ca717621c5887df35ea4e4b3f29b
|
Provenance
The following attestation bundles were made for preoccupied_koji_typing-1.35.0.tar.gz:
Publisher:
on_release.yml on obriencj/koji-typing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preoccupied_koji_typing-1.35.0.tar.gz -
Subject digest:
992244bfdcb75f75b703d30953560ce3935d466e3250ef00d0cf3c86eae31831 - Sigstore transparency entry: 157879834
- Sigstore integration time:
-
Permalink:
obriencj/koji-typing@b31d08fad982225f86257d3b3ce42adc5752b82b -
Branch / Tag:
refs/tags/v1.35.0 - Owner: https://github.com/obriencj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on_release.yml@b31d08fad982225f86257d3b3ce42adc5752b82b -
Trigger Event:
release
-
Statement type:
File details
Details for the file preoccupied.koji_typing-1.35.0-py3-none-any.whl.
File metadata
- Download URL: preoccupied.koji_typing-1.35.0-py3-none-any.whl
- Upload date:
- Size: 84.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e06009b58cf12807942e3dc3dee4ce7a2d1041f46997584aa0abca8f4e9d8f4
|
|
| MD5 |
036e549ae8ccd1824035a8b7a335786b
|
|
| BLAKE2b-256 |
422a03275c8fb5f58df10707e2ce1689752b02a7bac2b5b5722c171c331a4b5f
|
Provenance
The following attestation bundles were made for preoccupied.koji_typing-1.35.0-py3-none-any.whl:
Publisher:
on_release.yml on obriencj/koji-typing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
preoccupied_koji_typing-1.35.0-py3-none-any.whl -
Subject digest:
7e06009b58cf12807942e3dc3dee4ce7a2d1041f46997584aa0abca8f4e9d8f4 - Sigstore transparency entry: 157879835
- Sigstore integration time:
-
Permalink:
obriencj/koji-typing@b31d08fad982225f86257d3b3ce42adc5752b82b -
Branch / Tag:
refs/tags/v1.35.0 - Owner: https://github.com/obriencj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on_release.yml@b31d08fad982225f86257d3b3ce42adc5752b82b -
Trigger Event:
release
-
Statement type: