Skip to content

Commit

Permalink
Introduce poetry (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders committed Feb 7, 2023
1 parent 022bb8f commit 15e985e
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 188 deletions.
6 changes: 0 additions & 6 deletions .codeclimate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install "tox<4" "tox-gh-actions<3" "setuptools<58" "coveralls<4"
pip install "poetry<2" "tox<4" "tox-gh-actions<3" "coveralls<4"
- name: Test with tox
run: tox
- name: Coveralls
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
python-version: 3.9

- name: Update version
run: sed -i "s/__version__ = .*/__version__ = '${{github.ref_name}}'/" */__init__.py
run: sed -i "s/^version = .*/version = '${{github.ref_name}}'/" pyproject.toml

- name: Build a binary wheel and a source tarball
run: |
pip install --upgrade pip
pip install wheel
python setup.py sdist bdist_wheel
pip install poetry
poetry build
- name: Publish distribution 📦 to Test PyPI
if: github.event_name == 'push'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ venv/
.venv/
src/
*.un~
poetry.lock
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- flake8-rst-docstrings==0.2.3

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort
Expand Down
5 changes: 0 additions & 5 deletions MAINTAINERS

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,12 @@ Contributing to Connexion/TODOs
We welcome your ideas, issues, and pull requests. Just follow the
usual/standard GitHub practices.

For easy development, install connexion in editable mode with the :code:`tests` extra, and
For easy development, install connexion using poetry with all extras, and
install the pre-commit hooks to automatically run black formatting and static analysis checks.

.. code-block:: bash
pip install -e .[tests]
poetry install --all-extras
pre-commit install
You can find out more about how Connexion works and where to apply your changes by having a look
Expand Down
8 changes: 0 additions & 8 deletions SECURITY.md

This file was deleted.

2 changes: 0 additions & 2 deletions bandit.yml

This file was deleted.

3 changes: 0 additions & 3 deletions connexion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@

App = FlaskApp
Api = FlaskApi

# This version is replaced during release process.
__version__ = "3.0.dev0"
3 changes: 2 additions & 1 deletion connexion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import path

import click
import importlib_metadata
from clickclick import AliasedGroup, fatal_error

import connexion
Expand Down Expand Up @@ -47,7 +48,7 @@ def validate_server_requirements(ctx, param, value):
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(f"Connexion {connexion.__version__}")
click.echo(f"Connexion {importlib_metadata.version('connexion')}")
ctx.exit()


Expand Down
95 changes: 95 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[tool.poetry]
name = "connexion"
version = "3.0.dev0"
description = "Connexion - API first applications with OpenAPI/Swagger"
readme = "README.rst"
keywords = ["api", "swagger", "openapi"]
license = "Apache-2.0"
authors = [
"Daniel Grossmann-Kavanagh <me@danielgk.com>",
"Henning Jacobs <henning.jacobs@zalando.de>",
"João Santos <joao.santos@zalando.de>",
"Robbe Sneyders <robbe.sneyders@gmail.com>",
"Ruwan Lambrichts <ruwan.lambrichts@ml6.eu>",
]
maintainers = [
"Robbe Sneyders <robbe.sneyders@gmail.com>",
"Ruwan Lambrichts <ruwan.lambrichts@ml6.eu>",
]
repository = "https://github.com/spec-first/connexion"
include = ["*.txt", "*.rst"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]

[tool.poetry.scripts]
connexion = 'connexion.cli:main'

[tool.poetry.dependencies]
python = '^3.7'
clickclick = ">= 1.2, < 21"
httpx = "^0.15"
importlib_metadata = { version = "^6.0.0", python = "<3.8" }
inflection = ">= 0.3.1, < 0.6"
jsonschema = "^4.0.1"
Jinja2 = "^3.0.0"
python-multipart = "~0.0.5"
PyYAML = ">= 5.1, < 7"
requests = "^2.27"
starlette = "^0.19"
typing-extensions = "^4"
werkzeug = "^2.2.1"

a2wsgi = { version = "^1.4", optional = true }
flask = { version = "^2.2", extras = ["async"], optional = true }
py-swagger-ui = { version = "^1.1.0", optional = true }
uvicorn = { version = "^0.17.6", extras = ["standard"], optional = true }

[tool.poetry.extras]
flask = ["a2wsgi", "flask"]
swagger-ui = ["py-swagger-ui"]
uvicorn = ["uvicorn"]

[tool.poetry.group.tests.dependencies]
pre-commit = "~2.21.0"
pytest = "7.2.1"
pytest-asyncio = "~0.18.3"
pytest-cov = "~2.12.1"

[tool.poetry.group.docs.dependencies]
sphinx-autoapi = "1.8.1"

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"

[tool.distutils.bdist_wheel]
universal = true

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning:connexion.*:",
"ignore::FutureWarning:connexion.*:",
]
asyncio_mode = "auto"

[tool.isort]
profile = "black"
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

126 changes: 0 additions & 126 deletions setup.py

This file was deleted.

3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import MagicMock

import connexion
import importlib_metadata
import pytest
from click.testing import CliRunner
from connexion.cli import main
Expand Down Expand Up @@ -51,7 +52,7 @@ def spec_file():
def test_print_version():
runner = CliRunner()
result = runner.invoke(main, ["--version"], catch_exceptions=False)
assert f"Connexion {connexion.__version__}" in result.output
assert f"Connexion {importlib_metadata.version('connexion')}" in result.output


def test_run_missing_spec():
Expand Down

0 comments on commit 15e985e

Please sign in to comment.