Coder Social home page Coder Social logo

py-optional's Introduction

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.

py-optional's People

Contributors

francipvb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.