Skip to main content

Common utilities and shared code for PRS microservices

Project description

PRS Commons

A Python library containing common utilities and shared code for PRS microservices.

Installation

From Source (Development)

For development, clone and install in editable mode:

git clone https://<token>@github.com/IshaFoundationIT/prs-facade-common.git
cd prs-facade-common
pip install -e ".[dev]"  # Install with development dependencies

From Private Package Repository

Add your private package repository to pip configuration and install:

# Configure pip to use your private repository
pip config set global.extra-index-url https://your.private.registry.com/simple/

# Install the package
pip install prs-commons

Usage

from prs_commons import MyClass

# Create an instance
obj = MyClass("User")

# Use the instance
print(obj.greet())  # Output: Hello, User!

# Get version
print(f"Library version: {MyClass.version()}")

Development

Prerequisites

  • Python 3.11+
  • Poetry (recommended) or pip

Setup

  1. Clone the repository:

    git clone https://<token>@github.com/IshaFoundationIT/prs-facade-common.git
    cd prs-facade-common
    
  2. Install dependencies:

    # Using Poetry
    poetry install --with dev
    
    # Or using pip
    pip install -e ".[dev]"
    
  3. Install pre-commit hooks:

    pre-commit install
    

Running Tests

# Run all tests
pytest

# Run with coverage report
pytest --cov=prs_commons --cov-report=term-missing

Publishing New Versions

Prerequisites

  1. Set up your ~/.pypirc file with your GitHub token:

    [distutils]
    index-servers =
        github
    
    [github]
    repository = https://upload.pypi.org/legacy/
    username = __token__
    password = your_github_token_here
    

    Replace your_github_token_here with a GitHub Personal Access Token with write:packages scope.

  2. Update the version in pyproject.toml

  3. Build the package:

    python -m build
    
  4. Publish to GitHub Package Registry:

    python -m twine upload --repository github dist/*
    

Installing from GitHub Package Registry

  1. Create a personal access token with read:packages scope

  2. Configure pip to use your token:

    pip install --index-url https://USERNAME:TOKEN@pkgs.dev.azure.com/ORGANIZATION/PROJECT/_packaging/REPOSITORY/pypi/simple/ --no-deps PACKAGE_NAME
    

    Or add to your pip.conf:

    [global]
    extra-index-url = https://USERNAME:TOKEN@pkgs.dev.azure.com/ORGANIZATION/PROJECT/_packaging/REPOSITORY/pypi/simple/
    

Contributing

  1. Create a feature branch
  2. Make your changes
  3. Run tests and pre-commit checks
  4. Submit a pull request

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prs_commons-0.1.0.tar.gz (7.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prs_commons-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file prs_commons-0.1.0.tar.gz.

File metadata

  • Download URL: prs_commons-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for prs_commons-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2fd6f4cefe2543120aa54878ec7f1696e7722928ca0b0e7b93e870d5e2e337cb
MD5 f64029af54994569a0b511dca8d69b89
BLAKE2b-256 80648c1430acd08c7890cfd8f25594e2852fa18a26261cd04e26c0d9fe16ef45

See more details on using hashes here.

File details

Details for the file prs_commons-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prs_commons-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for prs_commons-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 317d9ebf7e9ee254ff583329479e8ba77e0ff901a062f61861cacff4d006167f
MD5 3d1a58eeefdb520e332ddea1c20ca3d8
BLAKE2b-256 dfc3f674814ffdea2338f3347b04464f04ca7739ce2336a795bcd218b59b4753

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page