A set of tools for connecting and processing data for Annex Brands, featuring API pack and ship quoting.
Project description
ABConnect
ABConnect is a Python package that provides a collection of tools for connecting and processing data for Annex Brands. It includes modules for quoting, building, and loading data from various file formats (CSV, JSON, XLSX), with a focus on handling unsupported characters and encoding issues seamlessly.
Table of Contents
Features
New in v0.1.8
- Generic Endpoint System: Automatic access to all 223+ API endpoints without manual implementation
- Fluent Query Builder: Build complex API queries with method chaining
- Pydantic Models: Type-safe response models with automatic validation
Core Features
- API Request Builder: Assemble dynamic API requests using static JSON templates and runtime updates.
- Quoter Module: Retrieve and parse quotes from the ABC API in both Quick Quote (qq) and Quote Request (qr) modes.
- Robust Data Loading: Supports CSV, JSON, and XLSX files with built-in encoding and character handling.
- Full API Client: Comprehensive API client with authentication and endpoint-specific methods.
Installation
You can install ABConnect using pip:
pip install ABConnect
For more detailed installation instructions and documentation, visit https://abconnecttools.readthedocs.io/
Configuration
Environment Variables
ABConnect requires the following environment variables for authentication:
# Create a .env file with your credentials
ABCONNECT_USERNAME=your_username
ABCONNECT_PASSWORD=your_password
ABC_CLIENT_ID=your_client_id
ABC_CLIENT_SECRET=your_client_secret
# Optional: Set environment (defaults to production)
ABC_ENVIRONMENT=staging # or 'production'
Using Different Environments
ABConnect supports both staging and production environments:
from ABConnect.api import ABConnectAPI
# Use staging environment
api = ABConnectAPI(env='staging')
# Use production environment (default)
api = ABConnectAPI()
# Environment can also be set via ABC_ENVIRONMENT variable
Testing Configuration
For testing, create a .env.staging file with staging credentials:
cp ABConnect/dotenv.sample .env.staging
# Edit .env.staging with your staging credentials
Tests will automatically use .env.staging when running with pytest.
Documentation
Full documentation is available at https://abconnecttools.readthedocs.io/
Development
To contribute to ABConnect, clone the repository and install in development mode:
git clone https://github.com/AnnexBrands/ABConnectTools.git
cd ABConnectTools
pip install -e .[dev]
Testing
Run all tests with:
pytest
Testing Model Implementation Against Swagger
ABConnect maintains strict alignment with the API's swagger specification. Several tests verify that all models and endpoints are properly implemented:
1. Test All Endpoints Have Implementations
# Comprehensive test with visual tree output showing which endpoints are implemented
pytest tests/api/swagger/test_all_swagger_endpoints_have_implementations.py -v
# Displays:
# ✅ Working endpoints with path count
# ❌ Missing endpoint files
# ⚠️ Import failures for endpoints that exist but can't be imported
2. Test Constitution Compliance
# Tests endpoint-model pairing and swagger-first principles
pytest tests/test_constitution.py -v
# Verifies:
# - All swagger endpoints have implementations
# - Endpoints have corresponding Pydantic models
# - No duplicate or violating files exist
3. Verify Model Imports
# Test that all models can be imported without errors
python -c "from ABConnect.api.models import shared, companies, contacts, job, address, jobtimeline; print('All model imports successful')"
# Test specific model validation and inspect fields
python -c "from ABConnect.api.models.jobparcelitems import ParcelItem; print(list(ParcelItem.model_fields.keys()))"
4. Run Specific Test Categories
# Test only API endpoints
pytest tests/api/ -v
# Test only models
pytest tests/api/models/ -v
# Test swagger compliance with detailed output
pytest tests/api/swagger/ -v -s
Test Coverage Summary
- Endpoint Tests: Verify all 223+ API endpoints are accessible
- Model Tests: Validate Pydantic models match swagger schemas
- Integration Tests: Test end-to-end API workflows
- Constitution Tests: Ensure code follows architecture principles
License
This project is licensed under the MIT License - see the LICENSE file for details.
Links
- Documentation: https://abconnecttools.readthedocs.io/
- Repository: https://github.com/AnnexBrands/ABConnectTools
- Issue Tracker: https://github.com/AnnexBrands/ABConnectTools/issues
- PyPI: https://pypi.org/project/ABConnect/
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 abconnect-0.2.1.tar.gz.
File metadata
- Download URL: abconnect-0.2.1.tar.gz
- Upload date:
- Size: 223.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30db77183e46574a5374fa7466ab4d544d149bd2c44dc22fdfe8b3a9678f3560
|
|
| MD5 |
e4d34302e735e89b0170732976e53981
|
|
| BLAKE2b-256 |
92ed85c48baa772c80461aaedd14d0c1ec8242dfebe3825f8a94f361cd226604
|
Provenance
The following attestation bundles were made for abconnect-0.2.1.tar.gz:
Publisher:
workflow.yml on AnnexBrands/ABConnectTools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abconnect-0.2.1.tar.gz -
Subject digest:
30db77183e46574a5374fa7466ab4d544d149bd2c44dc22fdfe8b3a9678f3560 - Sigstore transparency entry: 791220119
- Sigstore integration time:
-
Permalink:
AnnexBrands/ABConnectTools@336dd08135668f07c9cd4bd54f74b9943bbde735 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/AnnexBrands
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@336dd08135668f07c9cd4bd54f74b9943bbde735 -
Trigger Event:
push
-
Statement type:
File details
Details for the file abconnect-0.2.1-py3-none-any.whl.
File metadata
- Download URL: abconnect-0.2.1-py3-none-any.whl
- Upload date:
- Size: 292.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11191abdbdad0b1793b30c6b398cd68c302ae380db2111ed753079e48a399a4a
|
|
| MD5 |
84d815f382435f7bd2dcc5877ad7c97e
|
|
| BLAKE2b-256 |
83a67edddbe552fc66ade060c6c5c097d72ed408510034291b5fc7ea4bec8d16
|
Provenance
The following attestation bundles were made for abconnect-0.2.1-py3-none-any.whl:
Publisher:
workflow.yml on AnnexBrands/ABConnectTools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abconnect-0.2.1-py3-none-any.whl -
Subject digest:
11191abdbdad0b1793b30c6b398cd68c302ae380db2111ed753079e48a399a4a - Sigstore transparency entry: 791220122
- Sigstore integration time:
-
Permalink:
AnnexBrands/ABConnectTools@336dd08135668f07c9cd4bd54f74b9943bbde735 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/AnnexBrands
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@336dd08135668f07c9cd4bd54f74b9943bbde735 -
Trigger Event:
push
-
Statement type: