Skip to content

Commit

Permalink
Switch to pyproject.toml
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Viicos committed Jun 20, 2024
1 parent 2970d8e commit de161b4
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 303 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E731,W504,E501
max-complexity = 22
max-line-length = 200
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ jobs:
make install-test
- name: Run linters
run: |
make pycodestyle
make flake8
make black
- name: Run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
PIP=pip
BLACK=black
FLAKE8=flake8
PYTEST=pytest
PYCODESTYLE=pycodestyle
COVERAGE=coverage
COVERAGE_CONFIG=tests/coverage.rc
PEP8_CONFIG=tests/pep8.rc
MAIN_SOURCE=src/onelogin/saml2
DEMOS=demo-django demo-flask demo-tornado demo_pyramid
TESTS=tests/src/OneLogin/saml2_tests
Expand All @@ -14,19 +13,19 @@ install-req:
$(PIP) install .

install-test:
$(PIP) install -e ".[test]"
$(PIP) install -e ".[test]"

pytest:
$(COVERAGE) run --source $(MAIN_SOURCE) --rcfile=$(COVERAGE_CONFIG) -m pytest
$(COVERAGE) report -m --rcfile=$(COVERAGE_CONFIG)

pycodestyle:
$(PYCODESTYLE) --ignore=E501,E731,W504 $(SOURCES) --config=$(PEP8_CONFIG)
black:
$(BLACK) $(SOURCES)

flake8:
$(FLAKE8) $(SOURCES)

clean:
clean:
rm -rf .pytest_cache/
rm -rf .eggs/
find . -type d -name "__pycache__" -exec rm -r {} +
Expand Down
176 changes: 44 additions & 132 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[tool.poetry]
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "python3-saml"
version = "1.16.0"
description = "Saml Python Toolkit. Add SAML support to your Python software using this library"
license = "Apache-2.0"
authors = ["SAML-Toolkits <[email protected]>"]
maintainers = ["Sixto Martin <[email protected]>"]
license = {file = "LICENSE"}
authors = [
{name = "SAML-Toolkits", email = "[email protected]"}
]
maintainers = [
{name = "Sixto Martin", email = "[email protected]"}
]
readme = "README.md"
homepage = "https://saml.info"
repository = "https://github.com/SAML-Toolkits/python3-saml"
keywords = [
"saml",
"saml2",
Expand All @@ -17,71 +23,44 @@ keywords = [
"identity",
]
classifiers = [
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"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",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
packages = [
{ include = "onelogin", from = "src" },
{ include = "onelogin/saml2", from = "src" },
dependencies = [
"lxml>=4.6.5,!=4.7.0",
"xmlsec>=1.3.9",
"isodate>=0.6.1",
]
requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"

include = [
{ path = "src/onelogin/saml2/schemas"},
{ path = "tests", format = "sdist" }
]

[tool.poetry.urls]
[project.urls]
Homepage = "https://saml.info"
Source = "https://github.com/SAML-Toolkits/python3-saml"
"Bug Tracker" = "https://github.com/SAML-Toolkits/python3-saml/issues"
Changelog = "https://github.com/SAML-Toolkits/python3-saml/blob/master/changelog.md"

[tool.poetry.dependencies]
python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
lxml = ">=4.6.5, !=4.7.0"
xmlsec = ">=1.3.9"
isodate = ">=0.6.1"

#[tool.poetry.group.dev]
#optional = true

#[tool.poetry.group.dev.dependencies]
#black = "*"
#isort = {version = "^5.10.1", extras = ["pyproject"]}
flake8 = { version = ">=3.6.0, <=5.0.0", optional = true}
#Flake8-pyproject = "^1.1.0.post0"
#flake8-bugbear = "^22.8.23"
#flake8-logging-format = "^0.7.5"
#ipdb = "^0.13.9"

#[tool.poetry.group.test.dependencies]
pytest = { version = ">=4.6.11", optional = true}
coverage = { version = ">=4.5.2", optional = true}
#pylint = ">=1.9.4"

[tool.poetry.extras]
test = ["flake8", "pytest", "coverage"]

#[tool.poetry.group.test]
#optional = true

#[tool.poetry.group.coverage]
#optional = true

#[tool.poetry.group.coverage.dependencies]
#coverage = ">=4.5.2"
#pytest-cov = "*"

#[tool.poetry.group.docs]
#optional = true
[project.optional-dependencies]
test = [
"coverage>=4.5.2",
"flake8>=3.6.0, <=5.0.0",
"pytest>=4.6",
]

#[tool.poetry.group.docs.dependencies]
#sphinx = "*"
[tool.setuptools]
package-dir = {"" = "src"}

[build-system]
requires = [
"poetry>=1.1.15",
"setuptools >= 40.1.0",
"wheel"
]
build-backend = "poetry.core.masonry.api"
[tool.setuptools.package-data]
"onelogin.saml2.schemas" = ["*.xsd"]

[tool.pytest.ini_options]
minversion = "4.6.11"
Expand All @@ -93,75 +72,11 @@ pythonpath = [
"tests",
]

[tool.coverage.run]
branch = true
source = ["src/onelogin/saml2"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"def __str__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
]
ignore_errors = true

[tool.coverage.html]
directory = "cov_html"

[tool.flake8]
max-line-length = 210
max-complexity = 22
count = true
show-source = true
statistics = true
disable-noqa = false
# 'ignore' defaults to: E121,E123,E126,E226,E24,E704,W503,W504
extend-ignore = [
'B904',
'B006',
'B950',
'B017',
'C901',
'E501',
'E731',
]
per-file-ignores = [
'__init__.py:F401',
]
# 'select' defaults to: E,F,W,C90
extend-select = [
# * Default warnings reported by flake8-bugbear (B) -
# https://github.com/PyCQA/flake8-bugbear#list-of-warnings
'B',
# * The B950 flake8-bugbear opinionated warnings -
# https://github.com/PyCQA/flake8-bugbear#opinionated-warnings
'B9',
]
extend-exclude = [
'.github', '.gitlab',
'.Python', '.*.pyc', '.*.pyo', '.*.pyd', '.*.py.class', '*.egg-info',
'venv*', '.venv*', '.*_cache',
'lib', 'lib64', '.*.so',
'build', 'dist', 'sdist', 'wheels',
]

[tool.black]
line-length = 200
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
(
\.pytest_cache
)
'''

[tool.isort]
profile = 'black'
profile = "black"
# The 'black' profile means:
# multi_line_output = 3
# include_trailing_comma = true
Expand All @@ -179,7 +94,4 @@ honor_noqa = true
atomic = true
ignore_comments = true
skip_gitignore = true
src_paths = [
'src',
'tests',
]
src_paths = ['src']
4 changes: 0 additions & 4 deletions setup.cfg

This file was deleted.

51 changes: 0 additions & 51 deletions setup.py

This file was deleted.

Loading

0 comments on commit de161b4

Please sign in to comment.