Skip to main content

Baresquare SDK for Python

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.0.tar.gz (13.6 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.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: baresquare_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 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.0.tar.gz
Algorithm Hash digest
SHA256 1346159f8504d3534b43568747c2b6c81719ea6f0571141658cd4a14598e3784
MD5 b8e1e477f54b6b267c4433657647ad39
BLAKE2b-256 dd2b9ae0e41ecad768d6e75afc0d08b62989eec3a6db480f85e6a76390935642

See more details on using hashes here.

File details

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

File metadata

  • Download URL: baresquare_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b28e7d62e53c3a53f936ccee842b101153b203da7621dbbb83f76963cc6e9fc3
MD5 56783142482979b767c480afee62e28c
BLAKE2b-256 3d8df04c4d0b0ba4b93737b563b764a390b2212fca8506fd286835254d2afcab

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