Skip to main content

pyconject

pyconject is a (highly) opinionated PYthon CONfig inJECTor library inspired by Spring Framework (and Spring Boot Framework).

How to pronounce pyconject

pyconject is pronounced PY-CON-JECT, a word play for Burmese "ပိုက်ကွန်ချက်" = "the art of throwing net". It represents how it can be used to capture all types of configs and inject them into all types of packages.

Usage

Note: pyconject requires Python 3.10+. Please be aware that Python 3.10 is nearing its end-of-life for security fixes (October 2026), so upgrading to a newer version is recommended.

For detailed usage, refer to usage.

TL;DR

Instead of this:

# in usr_p/usr_sp/usr_m.py
from black_p.black_sp.black_m import black_func

# initialize values_a, value_b, value_c and value_d.
# this part is often the ugly mess because it involves 
# reading yaml or other tree-like files and assigning values
import yaml
with open("./configs.yml", "rt") as f:
  configs = yaml.safe_load(f)
  black_func_parameters = configs["black_p"]["black_sp"]["black_m"]["black_func"]
  value_a = black_func_parameters["a"]
  # more ugly things here; you get the gist ...

black_func(a=value_a, b=value_b, c=value_c, d=value_d)

With pyconject, we can do this:

# in usr_p/usr_sp/usr_m.py
from black_p.black_sp.black_m import black_func

from pyconject import pyconject

# Explicitly wrap the specific function (or module)
black_func = pyconject.wrap(black_func)

with pyconject.cntx():
    black_func() 

Developing with pyconject

Instead of this:

# in dev_p/dev_sp/dev_m.py
import os

env = os.environ["environment"]

def dev_func(a=None, b=None, c=None, d=None):
  if env == "dev":
    if a is None: a = "dev-a"
    if b is None: b = "dev-b"
    # you know the rest
  elif env == "stg":
    if a is None: a = "stg-a"
    if b is None: b = "stg-b"
    # you know the rest
  elif env == "prd":
    if a is None: a = "prd-a"
    if b is None: b = "prd-b"
    # you know the rest
  # ... 
  # your application logic
  return results

With pyconject, you can do this:

# in dev_p/dev_sp/pyconject-dev_m-dev.py
dev_func:
  a : "dev-a"
  b : "dev_b"
  ...
# in dev_p/dev_sp/dev_m.py
from pyconject import pyconject

@pyconject.func
def dev_func(a, b, c, d):
  # your application logic
  return results

Features

  • Developer integration

    • Functions

    • Classes

    • Modules

    • Packages

    • Client integration

    • Functions

    • Classes

    • Modules

    • Packages

    • Smart Wrap (wrap())

  • Type of configs

    • yaml -- priority
      • reference other yaml files
    • environment/target selection

To Dos

  • Generate config files

  • Raw retrieval of resolved configs (to manipulate by user)

  • Other types of configs

    • .env
    • override by
      • environment variables
      • commandline arguments

How to contribute

  • Create a PR into dev branch.
    • Github actions will run unit-tests.
  • Periodically, the package maintainer will PR into main branch.
    • Unit-tests will be run again.
    • When merged, pypi package and github releases will be published.

Release files for pyconject 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyconject 0.2.1
File Size Uploaded
pyconject-0.2.1.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyconject 0.2.1
File Interpreter ABI Platform
pyconject-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / pyconject-0.2.1.tar.gz

Download URL pyconject-0.2.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
90139d8f3d4df10abcc1e1ffc98da161a768aafd1118f704578908d34c5b5837
BLAKE2b-256 checksum
How to use checksums
244229e69838730778135c38d7527cfe52dda52f2a75cd60577fa83680714072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 24, 2026.

Transparency log

Release files / pyconject-0.2.1-py3-none-any.whl

Download URL pyconject-0.2.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97583a83a1c86da32fcdcee0d6ac44ce7457edcb13c1befa6ff10dd2ad1e12f5
BLAKE2b-256 checksum
How to use checksums
e5d2a667e7f86d7f8c1333eda6baa9cd12c18706c409b799ed510defdea3b180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page