Skip to main content

Baresquare SDK for Python - Core utilities and AWS integrations

Project description

Baresquare Python Libraries

[!CAUTION] This code is published publicly in PyPI - make sure you do not include proprietary information.

This monorepo hosts Baresquare's Python packages, all published to PyPI.

Packages

The repository currently contains the following packages:

  • baresquare_core_py: Core utilities shared across Baresquare services
  • baresquare_aws_py: AWS-specific utilities that build upon core

Development Guidelines

Versioning

  • All packages share the same version number
  • Version is defined in each package's __init__.py file (__version__ = "x.y.z")
  • Git tags must match the version in __init__.py files (format: vx.y.z)
  • CI will validate version consistency before publishing

Package Configuration

  • A single pyproject.toml file is used for all packages
  • Package-specific settings are handled in the CI process
  • Dependencies between packages are defined in pyproject.toml under [project.optional-dependencies]

Development Setup

To set up the packages for development:

# Install in development mode with all dependencies
pip install -e ".[testing]"

# Run tests
pytest

[!WARNING]
When introducing a new .py file, make sure to add it in the appropriate __init__.py file, otherwise it will not be makde available in the published package.

Linting

For each directory:

  • Show linting issues: ruff check . --preview
  • Fix linting issues: ruff . --fix --preview

Testing

Install packages

# First in the core directory 
cd core
pip install -e .

# Then in the aws directory
cd ../aws
pip install -e .[testing]

Then run pytest in each directory

Publishing

[!TIP] Before publishing properly, check the build locally (see instructions below).

With GitHub Action

It is recommended to publish a new version by creating a GitHub release, as this creates release notes in the relevant GitHub page.

Packages are published to PyPI through GitHub Actions when a new tag is pushed:

  1. Update the version field in all pyproject.toml files (should be the same everywhere)
  2. If there is optional dependency array publishing, update the core package version there too (e.g. in pyproject.toml of the AWS package)
  3. Commit changes
  4. Create and push a tag matching the version (assuming version to be published is 0.1.0):
    • via command line: git tag v0.1.0 && git push origin v0.1.0
    • via GitHub UI: Go to "Releases" → "Draft a new release" → "Choose a tag" → Enter "v0.1.0" → "Create new tag"

CI will validate versions, build packages, and publish to PyPI

Manually

You can also use scripts/publish_local.sh:

  1. Set environment variables:
    export TWINE_USERNAME=__token__
    export TWINE_PASSWORD=XXX
    
  2. If there is optional dependency array publishing, update the core package version there too (e.g. in pyproject.toml of the AWS package)
  3. Check pyproject.toml files of non-core packages - they may reference the version of baresquare-core-py
  4. Create a tag locally matching the version
  5. Run scripts/publish_local.sh

Check the build

When introducing a new file, ensure the file will be made available in the published package.

cd core
python -m build
mkdir -p wheel_extract
# Extract the wheel (it's just a zip file) - make sure to change the version accordingly
unzip dist/baresquare_core_py-0.1.0-py3-none-any.whl -d wheel_extract
# View the contents
ls -la wheel_extract
# Specifically check for your Python files
find wheel_extract -name "*.py"

then check the file exists in the output.

These instructions are for the core package - adjust accordingly for other packages.

Installation

# Install core package
pip install baresquare_core_py

# Install AWS package (which includes core)
pip install baresquare_aws_py

License

MIT License

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

baresquare_sdk-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

baresquare_sdk-0.1.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file baresquare_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: baresquare_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for baresquare_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c410f8083de79ca3029387ae6cb7c8f7a8ddbd985e1bfcf9083d087bf51e27fe
MD5 42bc16773e5e2f40498048bc91c1f3fb
BLAKE2b-256 9ae1d7a1b19b568b91870a235bd2e2fd9f5114b77863125c95d9a1cf474f488d

See more details on using hashes here.

File details

Details for the file baresquare_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: baresquare_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for baresquare_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c713d8cdb7f5f0abcfa5a3dad28e25da412c4bc5acbc5ac5aaba9fbff881f2a
MD5 8e9696d6e4ff3680512d85f788a3007a
BLAKE2b-256 a9b002d3c44d47407c874c5b6725049052645937cbd615ce604eb2bdac01ebc0

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