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/.
Metadata
Release files for preoccupied.koji-typing 1.35.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| preoccupied_koji_typing-1.35.0.tar.gz | 69.0 kB | With provenance | Details for preoccupied_koji_typing-1.35.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| preoccupied.koji_typing-1.35.0-py3-none-any.whl | Python 3 | none | any | Details for preoccupied.koji_typing-1.35.0-py3-none-any.whl |
Total release size: 153.9 kB
Release files / preoccupied_koji_typing-1.35.0.tar.gz
| Download URL | preoccupied_koji_typing-1.35.0.tar.gz |
|---|---|
| Size | 69.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
992244bfdcb75f75b703d30953560ce3935d466e3250ef00d0cf3c86eae31831
|
|
BLAKE2b-256 checksum How to use checksums |
b6520786c9e584eedcd1de369e7de78fd091ca717621c5887df35ea4e4b3f29b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 27, 2024.
Transparency logRelease files / preoccupied.koji_typing-1.35.0-py3-none-any.whl
| Download URL | preoccupied.koji_typing-1.35.0-py3-none-any.whl |
|---|---|
| Size | 84.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e06009b58cf12807942e3dc3dee4ce7a2d1041f46997584aa0abca8f4e9d8f4
|
|
BLAKE2b-256 checksum How to use checksums |
422a03275c8fb5f58df10707e2ce1689752b02a7bac2b5b5722c171c331a4b5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 27, 2024.
Transparency logSecurity for preoccupied.koji-typing 1.35.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for preoccupied_koji_typing-1.35.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 27, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.