Skip to content

Commit

Permalink
Merge pull request #182 from gpongelli/poetry
Browse files Browse the repository at this point in the history
move to poetry
  • Loading branch information
dixudx authored Mar 28, 2023
2 parents f275b05 + 0c51287 commit da253d2
Show file tree
Hide file tree
Showing 8 changed files with 1,039 additions and 95 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Display Python version
run: python --version
- name: Install dependencies
run: |
pip install -U pip tox
poetry install --with devel
- name: Lint with flake8
run: |
tox -e flake
poetry run tox -e flake
- name: Test with pytest
run: |
tox -e test
poetry run tox -e test
18 changes: 18 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,21 @@ the tests using pytest_ with the following command:
(venv) tox -e test
(venv) tox -e flake
(venv) tox -e pycodestyle
Testing with Poetry
-------

When using poetry_ , all dependencies and test environment are managed by this tool even when using tox_.

If you have already globally installed poetry_ on your system, you can run
the tests using pytest_ with the following command:

.. _poetry: https://python-poetry.org/

.. code-block:: bash
poetry install --with devel
poetry run tox -e test
poetry run tox -e flake
poetry run tox -e pycodestyle
935 changes: 935 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[tool.poetry]
name = "rtcclient"
version = "0.8.3"
homepage = "https://github.com/dixudx/rtcclient"
description = "RTCClient for Rational Team Concert"
authors = ["Di Xu <[email protected]>"]
readme = "README.rst"
license = "Apache License Version 2.0"
keywords = ["rtcclient", "Rational Team Concert", "RTC"]
classifiers=[
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
packages = [
{ include = "rtcclient" },
{ include = "tests", format = "sdist" },
]

[tool.poetry.dependencies]
python = ">=3.7.0,<4.0"
PySocks = ">=1.5.6"
jinja2 = ">=2.2"
requests = ">=2.10.0"
six = "*"
xmltodict = "^0.13.0"
lxml = "^4.9.2"


[tool.poetry.group.devel]
optional = true
[tool.poetry.group.devel.dependencies]
pip = "^23.0.1"
pycodestyle = "*"
pytest = "*"
pytest-env = "*"
pytest-mock = ">=0.6.0"
flake8 = [
{ version = "^6.0.0", python = ">=3.8.1" },
{ version = "^5.0.4", python = "<3.8.1" }
]
yapf = "*"
tox = "*"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

67 changes: 0 additions & 67 deletions setup.py

This file was deleted.

4 changes: 0 additions & 4 deletions test-requirements.txt

This file was deleted.

34 changes: 20 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,47 @@
minversion = 3.18
envlist = test,pycodestyle,flake
skipsdist = True
isolated_build = True

[testenv:test]
description = Invoke pytest to run automated tests
install_command = pip install -U {opts} {packages}
sitepackages = True
isolated_build = True
allowlist_externals =
poetry
setenv =
TOXINIDIR = {toxinidir}
VIRTUAL_ENV = {envdir}
deps = .
-r{toxinidir}/test-requirements.txt
commands =
pytest -v {posargs}
poetry run pytest -v {posargs}

[testenv:pycodestyle]
description = Check for PEP8 compliance of code.
skip_install = true
deps = pycodestyle
commands =
pycodestyle rtcclient tests --show-source --show-pep8 -v {posargs}
isolated_build = True
allowlist_externals =
poetry
commands =
poetry run pycodestyle rtcclient tests --show-source --show-pep8 -v {posargs}

[testenv:flake]
description = Check for PEP8 compliance of code with flake.
skip_install = true
deps = flake8
commands =
flake8 rtcclient tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 rtcclient tests/ --count --max-complexity=20 --max-line-length=127 --statistics
isolated_build = True
allowlist_externals =
poetry
commands =
poetry run flake8 rtcclient tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 rtcclient tests/ --count --max-complexity=20 --max-line-length=127 --statistics

[testenv:format]
description = Autoformat code.
skip_install = true
deps =
yapf
isolated_build = True
allowlist_externals =
poetry
commands =
yapf --style google --recursive --in-place rtcclient tests
poetry run yapf --style google --recursive --in-place rtcclient tests

[pycodestyle]
count = False
Expand Down

0 comments on commit da253d2

Please sign in to comment.