Skip to content

Commit

Permalink
Add messages implementation for python
Browse files Browse the repository at this point in the history
  • Loading branch information
elchupanebrej committed Jul 18, 2023
1 parent 57feb26 commit 6a26520
Show file tree
Hide file tree
Showing 63 changed files with 2,241 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: test-python

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- renovate/**
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:

runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "pypy3.8"
- "pypy3.9"
- "pypy3.10"
os:
- ubuntu-latest
- windows-latest
- macos-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools
pip install tox tox-gh-actions codecov
- name: Test with tox
working-directory: ./python
run: |
tox
codecov
- name: Build checking
working-directory: ./python
if: "matrix.python-version == '3.11'"
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install --upgrade build twine
python -m build
twine check dist/*
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Added Python implementation ([#165](https://github.com/cucumber/messages/pull/165))
- Added C++ implementation ([#152](https://github.com/cucumber/messages/pull/152))

## [22.0.0] - 2023-04-06
Expand Down
55 changes: 55 additions & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
*.rej
*.py[cod]
/.env
*.orig
**/__pycache__

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
_build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.pytest_cache
.ropeproject

# Sublime
/*.sublime-*

#PyCharm
/.idea

# virtualenv
/.Python
/lib
/include
/share
/local
48 changes: 48 additions & 0 deletions python/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args:
- "python/src"
- "python/tests"
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-toml
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.9.0
hooks:
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies: [types-setuptools, types-certifi]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.1"
hooks:
- id: tox-ini-fmt
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint
args: [--format, parsable, --strict]
3 changes: 3 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Messages

Cucumber Messages for Python https://github.com/cucumber/messages
67 changes: 67 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "wheel"]

[project]
authors = [
{name = "Cucumber Limited", email = "cukes@googlegroups.com"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Gherkin",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Topic :: Utilities",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
dependencies = [
"importlib_resources",
"pydantic>=2.0.3"
]
description = "Cucumber Messages is a message protocol for representing results and other information from Cucumber. "
license = {text = "MIT"}
maintainers = [
{name = "Konstantin Goloveshko", email = "kostya.goloveshko@gmail.com"}
]
name = "messages"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.8"
urls = {Repository = "https://github.com/cucumber/messages"}
version = "0.1.0"

[project.entry-points]

[project.scripts]

[tool.black]
line-length = 120
target-version = ["py38", "py39", "py310", "py311"]
verbose = true

[tool.isort]
line_length = 120
multi_line_output = 3
profile = "black"

[tool.mypy]
files = "src/messages/**/*.py"
install_types = true
non_interactive = true
plugins = [
"pydantic.mypy"
]
show_error_codes = true
warn_return_any = true
warn_unused_configs = true

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
]
2 changes: 2 additions & 0 deletions python/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests
15 changes: 15 additions & 0 deletions python/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[options]
include_package_data = True
packages = find:
package_dir =
=src

[options.packages.find]
where = src
[options.package_data]
messages.samples =
*

[options.extras_require]
test =
tox
1 change: 1 addition & 0 deletions python/src/messages/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .messages import *
Loading

0 comments on commit 6a26520

Please sign in to comment.