Skip to main content

py-optional

Coverage Status Coverage Status

Getting started

See Documentation for details.

Features

  • Poetry (virtual environment and publish to PyPi, all with one tool)
  • black (linting/formatter)
  • autoflake (removing unused packages)
  • isort (dependency organization)
  • mypy (static type checking)
  • pytest (including test coverage)
  • pre-commit (hooks on commit)
  • GitHub Actions for CI/CD
  • mkdocs for documentation (with material theme)

Installing py-optional

Install the latest release:

pip install py-optional

Or you can clone py-optional and get started locally

# ensure you have Poetry installed
pip install --user poetry

# install all dependencies (including dev)
poetry install

# develop!

Example Usage

import py-optional

# do stuff

Only Python 3.8+ is supported as required by the black, pydantic packages

Publishing to Pypi

Poetry's documentation

Note that it is recommended to use API tokens when uploading packages to PyPI.

Once you have created a new token, you can tell Poetry to use it:

https://python-poetry.org/docs/repositories/#configuring-credentials

We do this using GitHub Actions' Workflows and Repository Secrets!

Repo Secrets

Go to your repo settings and add a PYPI_TOKEN environment variable:

Github Actions setup of Poetry token environment variable

Inspect the GitHub Actions Publish Workflows

name: Publish

on:
  release:
    types:
      - created

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      ...
      ...
      ...
      - name: Publish
        env:
          PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
        run: |
          poetry config pypi-token.pypi $PYPI_TOKEN
          bash scripts/publish.sh

That's it!

When you make a release on GitHub, the publish workflow will run and deploy to PyPi! 🚀🎉😎

Contributing Guide

Welcome! 😊👋

Please see the Contributing Guide.

Release files for py-optional 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-optional 1.3.3
File Size Uploaded
py_optional-1.3.3.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-optional 1.3.3
File Interpreter ABI Platform
py_optional-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / py_optional-1.3.3.tar.gz

Download URL py_optional-1.3.3.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f822efe2fe2c618fb606896d0b644c5c90c7840d9d33c1b042e7ad6c6a6282fe
BLAKE2b-256 checksum
How to use checksums
5b6ce0403ed447a0564efc183622618f46834e07535d186c51513ded36a0a31c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / py_optional-1.3.3-py3-none-any.whl

Download URL py_optional-1.3.3-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1c5e3c8f7b8edbe7b234cb5e7cac77e7ce99728beac3155cdb80b8277ab56b0
BLAKE2b-256 checksum
How to use checksums
b09e7611f967c71c77472e66100f57ffcd39d7fbb958732ae4b93e7558128986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page