asfpy - ASF Infrastructure common Python tools library

Clone this repo:
  1. fa44a52 Add Signer class for HMAC-signing/verifying URLs. by Greg Stein · 5 days ago main
  2. 62ad5b0 add reminder for bumping version in pyproject.toml by Greg Stein · 4 weeks ago
  3. f5b2f7c explain how to tag by Greg Stein · 4 weeks ago
  4. dcb9cde onwards to 0.57 by Greg Stein · 4 weeks ago
  5. a802f9b revise build/test instructions by Greg Stein · 4 weeks ago

asfpy - ASF Infrastructure Common Library for Python functions

This Python library contains features commonly used at the Apache Software Foundation.

(For asfpy 0.37 and below, look at our old Subversion repository)

Package Documention

  • aioldap: asynchronous LDAP client (documentation TBD)
  • clitools: LDAP work via command line tooling (documentation TBD)
  • crypto: helper for ED25519 work (documentation TBD)
  • db: high performance simplified SQLite client (documentation TBD)
  • justone: helper to ensure only one long-running process is operating (documentation TBD)
  • messaging: helpers to send email (documentation TBD)
  • pubsub: client for subscribing to the ASF pubsub service (documentation TBD)
  • sqlite: document-based CRUD using SQLite (documentation TBD)
  • stopwatch: debug/logging timing for Python code. See documentation
  • syslog: redirect print() to syslog (documentation TBD)
  • twatcher: watch EZT emplates for edits, then reload (documentation TBD)
  • whoami: fetch hostname of box (documentation TBD)

  • daemon: DEPRECATED old code to spawn a daemon (obsoleted by pipservice)
  • ldapadmin: DEPRECATED internal ASF infra tooling (moved to internal infra)

Building asfpy package

Prerequisites:

  • poetry: install e.g. with pipx pipx install poetry

Building the package:

$ poetry build

Running the tests:

$ poetry run pytest

Note: the above run might use system/local package install. Configure the poetry virtual environment with:

$ poetry install

Poetry might want to use a keyring. To disable that (and stick to a token in your poetry config), then use the following:

$ poetry config keyring.enabled false

Then to override the default asfpy install, and test the wheel that was built (eg. before pushing the wheel to PyPI):

$ poetry run pip install ./dist/asfpy-0.56-py3-none-any.whl

Running pytest will now use the built wheel.

Installation

Create and activate a virtual environment and then install asfpy using pip:

$ pip install "asfpy"

Note: Adding [ldap] or [aioldap] extras will install optional dependencies for LDAP support that will require additional system dependencies:

$ pip install "asfpy[aioldap]"

Publishing a new asfpy package

Create an account on https://pypi.org/, then add a token with an “all projects” scope.

Configure your credentials for the pypi repository:

$ poetry config pypi-token.pypi <your-token>

Finally publish to pypi.org:

$ make publish

See this guide for more details on working with PyPi.

Please also create a tag for the release.

Publishing to test.pypi.org

Create an account on https://test.pypi.org/, then add a token with an “all projects” scope.

Add a testpypi repository to your poetry config:

$ poetry config repositories.testpypi https://test.pypi.org/legacy/

Configure your credentials for the testpypi repository:

$ poetry config pypi-token.testpypi <your-token>

Finally publish to test.pypi.org:

$ make publish-test

The package should upload to the test.pypi.org service.