Skip to content

Commit 7658b88

Browse files
authored
Switch to pyproject.toml (#408)
* Switch to `pyproject.toml` Keep setuptools, remove Poetry. Remove references to pycodestyle, flake8 already runs it Make lint configurations consistent with each other Run black in CI Remove travis CI Remove pylint config, it is not enforced (can be added later) * Drop support for Python 3.6, update actions * Add black to dev deps * Fix deps specification
1 parent 2970d8e commit 7658b88

File tree

9 files changed

+68
-317
lines changed

9 files changed

+68
-317
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
ignore = E731,W504,E501
3+
max-complexity = 50
4+
max-line-length = 200

.github/workflows/python-package.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,65 +13,64 @@ on:
1313

1414
jobs:
1515
test_py3:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-22.04
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
python-version:
21-
- "3.6"
2221
- "3.7"
2322
- "3.8"
2423
- "3.9"
2524
- "3.10"
2625
- "3.11"
2726
- "3.12"
2827
steps:
29-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
3029
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v2
30+
uses: actions/setup-python@v5
3231
with:
3332
python-version: ${{ matrix.python-version }}
34-
- uses: actions/cache@v2
33+
- uses: actions/cache@v4
3534
with:
3635
path: ~/.cache/pip
37-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
36+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
3837
restore-keys: |
3938
${{ runner.os }}-pip-
4039
- name: Install dependencies
4140
run: |
4241
pip install -U setuptools
4342
sudo apt-get update -qq
44-
sudo apt-get install -qq swig python-dev libxml2-dev libxmlsec1-dev
43+
sudo apt-get install -qq swig libxml2-dev libxmlsec1-dev
4544
make install-req
4645
make install-test
4746
- name: Test
4847
run: make pytest
4948
lint:
50-
runs-on: ubuntu-20.04
49+
runs-on: ubuntu-22.04
5150
environment: CI
5251
steps:
53-
- uses: actions/checkout@v3
54-
- uses: actions/setup-python@v2
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
5554
with:
5655
python-version: "3.12"
57-
- uses: actions/cache@v2
56+
- uses: actions/cache@v4
5857
with:
5958
path: ~/.cache/pip
60-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
59+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
6160
restore-keys: |
6261
${{ runner.os }}-pip-
6362
- name: Install dependencies
6463
run: |
6564
pip install -U setuptools
6665
sudo apt-get update -qq
67-
sudo apt-get install -qq swig python-dev libxml2-dev libxmlsec1-dev
66+
sudo apt-get install -qq swig libxml2-dev libxmlsec1-dev
6867
pip install --force-reinstall --no-binary lxml lxml
6968
make install-req
70-
make install-test
69+
make install-lint
7170
- name: Run linters
7271
run: |
73-
make pycodestyle
7472
make flake8
73+
make black
7574
- name: Run coveralls
7675
env:
7776
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
PIP=pip
2+
BLACK=black
23
FLAKE8=flake8
34
PYTEST=pytest
4-
PYCODESTYLE=pycodestyle
55
COVERAGE=coverage
66
COVERAGE_CONFIG=tests/coverage.rc
7-
PEP8_CONFIG=tests/pep8.rc
87
MAIN_SOURCE=src/onelogin/saml2
98
DEMOS=demo-django demo-flask demo-tornado demo_pyramid
109
TESTS=tests/src/OneLogin/saml2_tests
@@ -14,19 +13,22 @@ install-req:
1413
$(PIP) install .
1514

1615
install-test:
17-
$(PIP) install -e ".[test]"
16+
$(PIP) install -e ".[test]"
17+
18+
install-lint:
19+
$(PIP) install -e ".[lint]"
1820

1921
pytest:
2022
$(COVERAGE) run --source $(MAIN_SOURCE) --rcfile=$(COVERAGE_CONFIG) -m pytest
2123
$(COVERAGE) report -m --rcfile=$(COVERAGE_CONFIG)
2224

23-
pycodestyle:
24-
$(PYCODESTYLE) --ignore=E501,E731,W504 $(SOURCES) --config=$(PEP8_CONFIG)
25+
black:
26+
$(BLACK) $(SOURCES)
2527

2628
flake8:
2729
$(FLAKE8) $(SOURCES)
2830

29-
clean:
31+
clean:
3032
rm -rf .pytest_cache/
3133
rm -rf .eggs/
3234
find . -type d -name "__pycache__" -exec rm -r {} +

pyproject.toml

Lines changed: 42 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = ["setuptools>=61.0.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
26
name = "python3-saml"
37
version = "1.16.0"
48
description = "Saml Python Toolkit. Add SAML support to your Python software using this library"
5-
license = "Apache-2.0"
6-
authors = ["SAML-Toolkits <contact@iamdigitalservices.com>"]
7-
maintainers = ["Sixto Martin <sixto.martin.garcia@gmail.com>"]
9+
license = {file = "LICENSE"}
10+
authors = [
11+
{name = "SAML-Toolkits", email = "contact@iamdigitalservices.com"}
12+
]
13+
maintainers = [
14+
{name = "Sixto Martin", email = "sixto.martin.garcia@gmail.com"}
15+
]
816
readme = "README.md"
9-
homepage = "https://saml.info"
10-
repository = "https://github.com/SAML-Toolkits/python3-saml"
1117
keywords = [
1218
"saml",
1319
"saml2",
@@ -17,71 +23,42 @@ keywords = [
1723
"identity",
1824
]
1925
classifiers = [
20-
"Topic :: Software Development :: Build Tools",
26+
"Programming Language :: Python :: 3.7",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
2132
"Topic :: Software Development :: Libraries :: Python Modules",
2233
]
23-
packages = [
24-
{ include = "onelogin", from = "src" },
25-
{ include = "onelogin/saml2", from = "src" },
34+
dependencies = [
35+
"lxml>=4.6.5,!=4.7.0",
36+
"xmlsec>=1.3.9",
37+
"isodate>=0.6.1",
2638
]
39+
requires-python = ">=3.7"
2740

28-
include = [
29-
{ path = "src/onelogin/saml2/schemas"},
30-
{ path = "tests", format = "sdist" }
31-
]
32-
33-
[tool.poetry.urls]
41+
[project.urls]
42+
Homepage = "https://saml.info"
43+
Source = "https://github.com/SAML-Toolkits/python3-saml"
3444
"Bug Tracker" = "https://github.com/SAML-Toolkits/python3-saml/issues"
45+
Changelog = "https://github.com/SAML-Toolkits/python3-saml/blob/master/changelog.md"
3546

36-
[tool.poetry.dependencies]
37-
python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
38-
lxml = ">=4.6.5, !=4.7.0"
39-
xmlsec = ">=1.3.9"
40-
isodate = ">=0.6.1"
41-
42-
#[tool.poetry.group.dev]
43-
#optional = true
44-
45-
#[tool.poetry.group.dev.dependencies]
46-
#black = "*"
47-
#isort = {version = "^5.10.1", extras = ["pyproject"]}
48-
flake8 = { version = ">=3.6.0, <=5.0.0", optional = true}
49-
#Flake8-pyproject = "^1.1.0.post0"
50-
#flake8-bugbear = "^22.8.23"
51-
#flake8-logging-format = "^0.7.5"
52-
#ipdb = "^0.13.9"
53-
54-
#[tool.poetry.group.test.dependencies]
55-
pytest = { version = ">=4.6.11", optional = true}
56-
coverage = { version = ">=4.5.2", optional = true}
57-
#pylint = ">=1.9.4"
58-
59-
[tool.poetry.extras]
60-
test = ["flake8", "pytest", "coverage"]
61-
62-
#[tool.poetry.group.test]
63-
#optional = true
64-
65-
#[tool.poetry.group.coverage]
66-
#optional = true
67-
68-
#[tool.poetry.group.coverage.dependencies]
69-
#coverage = ">=4.5.2"
70-
#pytest-cov = "*"
71-
72-
#[tool.poetry.group.docs]
73-
#optional = true
47+
[project.optional-dependencies]
48+
test = [
49+
"coverage>=4.5.2",
50+
"pytest>=4.6",
51+
]
52+
lint = [
53+
"black==24.4.2",
54+
"flake8>=3.6.0, <=5.0.0",
55+
]
7456

75-
#[tool.poetry.group.docs.dependencies]
76-
#sphinx = "*"
57+
[tool.setuptools]
58+
package-dir = {"" = "src"}
7759

78-
[build-system]
79-
requires = [
80-
"poetry>=1.1.15",
81-
"setuptools >= 40.1.0",
82-
"wheel"
83-
]
84-
build-backend = "poetry.core.masonry.api"
60+
[tool.setuptools.package-data]
61+
"onelogin.saml2.schemas" = ["*.xsd"]
8562

8663
[tool.pytest.ini_options]
8764
minversion = "4.6.11"
@@ -93,75 +70,11 @@ pythonpath = [
9370
"tests",
9471
]
9572

96-
[tool.coverage.run]
97-
branch = true
98-
source = ["src/onelogin/saml2"]
99-
100-
[tool.coverage.report]
101-
exclude_lines = [
102-
"pragma: no cover",
103-
"def __repr__",
104-
"def __str__",
105-
"raise AssertionError",
106-
"raise NotImplementedError",
107-
"if __name__ == .__main__.:",
108-
"if TYPE_CHECKING:",
109-
"if typing.TYPE_CHECKING:",
110-
]
111-
ignore_errors = true
112-
113-
[tool.coverage.html]
114-
directory = "cov_html"
115-
116-
[tool.flake8]
117-
max-line-length = 210
118-
max-complexity = 22
119-
count = true
120-
show-source = true
121-
statistics = true
122-
disable-noqa = false
123-
# 'ignore' defaults to: E121,E123,E126,E226,E24,E704,W503,W504
124-
extend-ignore = [
125-
'B904',
126-
'B006',
127-
'B950',
128-
'B017',
129-
'C901',
130-
'E501',
131-
'E731',
132-
]
133-
per-file-ignores = [
134-
'__init__.py:F401',
135-
]
136-
# 'select' defaults to: E,F,W,C90
137-
extend-select = [
138-
# * Default warnings reported by flake8-bugbear (B) -
139-
# https://github.com/PyCQA/flake8-bugbear#list-of-warnings
140-
'B',
141-
# * The B950 flake8-bugbear opinionated warnings -
142-
# https://github.com/PyCQA/flake8-bugbear#opinionated-warnings
143-
'B9',
144-
]
145-
extend-exclude = [
146-
'.github', '.gitlab',
147-
'.Python', '.*.pyc', '.*.pyo', '.*.pyd', '.*.py.class', '*.egg-info',
148-
'venv*', '.venv*', '.*_cache',
149-
'lib', 'lib64', '.*.so',
150-
'build', 'dist', 'sdist', 'wheels',
151-
]
152-
15373
[tool.black]
15474
line-length = 200
155-
extend-exclude = '''
156-
# A regex preceded with ^/ will apply only to files and directories
157-
# in the root of the project.
158-
(
159-
\.pytest_cache
160-
)
161-
'''
16275

16376
[tool.isort]
164-
profile = 'black'
77+
profile = "black"
16578
# The 'black' profile means:
16679
# multi_line_output = 3
16780
# include_trailing_comma = true
@@ -179,7 +92,4 @@ honor_noqa = true
17992
atomic = true
18093
ignore_comments = true
18194
skip_gitignore = true
182-
src_paths = [
183-
'src',
184-
'tests',
185-
]
95+
src_paths = ['src']

setup.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)