Skip to content

Commit

Permalink
Merge pull request #160 from rveachkc/rveach/uv-and-actions
Browse files Browse the repository at this point in the history
uv, ruff, github actions
  • Loading branch information
rveachkc authored Jan 7, 2025
2 parents adaed8a + 75d49a5 commit 674a3bd
Show file tree
Hide file tree
Showing 14 changed files with 701 additions and 173 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml → .circleci/circle_ciconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
paths:
- ./venv
key: v1-dependencies-{{ checksum "dev-requirements.txt" }}

test:
docker:
- image: circleci/python:3
Expand All @@ -52,8 +52,8 @@ jobs:
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
pytest -v --junitxml=/tmp/pytest/results.xml >> /tmp/test-reports/pytest.out



- store_artifacts:
path: /tmp/test-reports
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
python -m pip install --upgrade pip
python setup.py verify

- run:
- run:
name: make a source distribution
command: |
. venv/bin/activate
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Python package

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Run tests
env:
MS_TEAMS_WEBHOOK: https://httpbin.org/
run: uv run pytest tests --junit-xml=test-results.xml

- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: test-results.xml

- name: Run Ruff
run: uv run ruff check . --output-file ruff-results.xml --output-format junit

- name: Upload ruff results
uses: actions/upload-artifact@v4
with:
name: ruff-results
path: ruff-results.xml

build:

name: build distribution
runs-on: ubuntu-latest

needs:
- test

steps:
- uses: actions/checkout@v4

- run: git fetch --tags

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Build dist
run: uv build

- name: built artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pymsteams
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6 # Use the latest stable release
hooks:
- id: ruff # run the linter
args: [ --fix ]
stages: [pre-commit] # Only run on staged files
- id: ruff-format # run the formmatter
stages: [pre-commit] # Only run on staged files

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 # Use the latest stable release
hooks:
- id: check-ast
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
4 changes: 0 additions & 4 deletions MANIFEST

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Looking for new maintainers. Please see https://github.com/rveachkc/pymsteams/issues/151

[![CircleCI](https://circleci.com/gh/rveachkc/pymsteams/tree/master.svg?style=shield)](https://circleci.com/gh/rveachkc/pymsteams/tree/master) [![PyPI version](https://badge.fury.io/py/pymsteams.svg)](https://badge.fury.io/py/pymsteams)
[![PyPI version](https://badge.fury.io/py/pymsteams.svg)](https://badge.fury.io/py/pymsteams)

Python Wrapper Library to send requests to Microsoft Teams Webhooks.
Microsoft refers to these messages as Connector Cards. A message can be sent with only the main Connector Card, or additional sections can be included into the message.
Expand Down Expand Up @@ -156,7 +156,7 @@ myTeamsMessage = pymsteams.connectorcard("<Microsoft Webhook URL>")

myTeamsPotentialAction1 = pymsteams.potentialaction(_name = "Add a comment")
myTeamsPotentialAction1.addInput("TextInput","comment","Add a comment here",False)
myTeamsPotentialAction1.addAction("HttpPost","Add Comment","https://...")
myTeamsPotentialAction1.addAction("HttpPost","Add Comment","https://...")

myTeamsPotentialAction2 = pymsteams.potentialaction(_name = "Set due date")
myTeamsPotentialAction2.addInput("DateInput","dueDate","Enter due date")
Expand Down Expand Up @@ -185,7 +185,7 @@ myTeamsPotentialAction1 = pymsteams.potentialaction(_name = "Add a comment")
# You can add a TextInput to your potential action like below - Please note the 2nd argment below as the id name
myTeamsPotentialAction1.addInput("TextInput","comment","Add a comment here",False)
# we use the 2nd argument above as the id name to parse the values into the body post like below.
myTeamsPotentialAction1.addAction("HttpPost","Add Comment","https://...", "{{comment.value}}")
myTeamsPotentialAction1.addAction("HttpPost","Add Comment","https://...", "{{comment.value}}")
myTeamsMessage.addPotentialAction(myTeamsPotentialAction1)


Expand Down
8 changes: 0 additions & 8 deletions dev-requirements.txt

This file was deleted.

56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "pymsteams"
dynamic = ["version"]
description="Format messages and post to Microsoft Teams."
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"requests>=2.20.0",
]
license = {file = "LICENSE"}
keywords=['Microsoft', 'Teams']
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
"Programming Language :: Python :: 3",
"Topic :: Office/Business",
"Topic :: Office/Business :: Groupware",
]

[project.optional-dependencies]
async = [
"httpx>=0.28.1",
]

[project.urls]
Homepage = "https://github.com/rveachkc/pymsteams"


[tool.pytest.ini_options]
pythonpath = [
"src/"
]
addopts = "-ra -q"
testpaths = [
"tests",
]

[tool.uv]
dev-dependencies = [
"pytest-cov>=6.0.0",
"pytest>=8.3.4",
"ruff>=0.8.6",
]

[tool.setuptools_scm]
local_scheme = "no-local-version"
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

68 changes: 0 additions & 68 deletions setup.py

This file was deleted.

Loading

0 comments on commit 674a3bd

Please sign in to comment.