From e9b9b966cbd8b21bca985ae62066f07eb4d8766d Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 11:13:03 +0100 Subject: [PATCH 01/13] add .venv to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 67de323..5ae6ae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Environments env/ venv/ +.venv/ # pycharm .idea/ From 8ec002932482f5b2c55906e8e07b63c8b9f8e832 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 11:21:54 +0100 Subject: [PATCH 02/13] migrate settings from setup.py to pyproject.toml --- pyproject.toml | 52 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2d85b1a..f11b8d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,52 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "bro" +authors = [{ name = "VIKTOR", email = "support@viktor.ai" }] +description = "Open source python library for accessing BRO API" +requires-python = ">=3.7" +readme = { file = "README.md", content-type = "text/markdown" } +license = { file = "LICENSE.txt" } +classifiers = [ + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "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", +] +dynamic = ["version", "dependencies"] + +[project.urls] +"Source code" = "https://github.com/viktor-platform/bro" +"Example VIKTOR application" = "https://demo.viktor.ai/public/bro-app" +"Source code VIKTOR application" = "https://github.com/viktor-platform/bro-app" + +[tool.setuptools.dynamic] +version = { attr = "bro.__version__" } +dependencies = { file = "requirements.txt" } + +[tool.setuptools.packages.find] +include = ["bro*"] +exclude = ["tests"] + [tool.isort] -profile="black" +profile = "black" line_length = 120 -multi_line_output=1 -include_trailing_comma= true -force_grid_wrap=0 -use_parentheses= false +multi_line_output = 1 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = false [tool.pylint] max-line-length = 120 -disable= [ +disable = [ "missing-docstring", "no-name-in-module", "duplicate-code", @@ -19,7 +57,7 @@ disable= [ "fixme", "too-many-arguments", "too-many-branches", - "unspecified-encoding" + "unspecified-encoding", ] max-attributes = 25 From fbfe7e463d3f93896e5c81d95d2f28d77cbae333 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 11:24:56 +0100 Subject: [PATCH 03/13] fix black line length setting in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f11b8d1..0f8d01f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,4 +62,4 @@ disable = [ max-attributes = 25 [tool.black] -line_length = 120 +line-length = 120 From 37ee63c47fbc3e9b4ab3151cba9745d57bdddb77 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 11:25:17 +0100 Subject: [PATCH 04/13] remove setup.py --- setup.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index e3587b5..0000000 --- a/setup.py +++ /dev/null @@ -1,48 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages -from setuptools import setup - -about = {} -with open(Path(__file__).parent / "bro" / "__version__.py", "r") as f: - exec(f.read(), about) - -long_description = (Path(__file__).parent / "README.md").read_text() -long_description = long_description.replace("X.Y.Z", about["__version__"]) - -setup( - name="bro", - version=about["__version__"], - description="Open source python library for accessing BRO API", - long_description=long_description, - long_description_content_type="text/markdown", - author="VIKTOR", - author_email="support@viktor.ai", - license="see LICENSE.txt", - license_files=("LICENSE.txt",), - packages=find_packages(exclude=["tests"]), - install_requires=[ - "xmltodict==0.13.0", - "requests==2.28.2", - "lxml==4.9.2", - "pyproj==3.4.1", - ], - classifiers=[ - "Environment :: Web Environment", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX :: Linux", - "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", - ], - test_suite="tests", - project_urls={ - "Source code": "https://github.com/viktor-platform/bro", - "Example VIKTOR application": "https://demo.viktor.ai/public/bro-app", - "Source code VIKTOR application": "https://github.com/viktor-platform/bro-app", - }, -) From fa0924a169a8d61b4a43f660f3203c990501930a Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 11:48:48 +0100 Subject: [PATCH 05/13] pip install from pyproject.toml --- .github/workflows/test_and_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_and_publish.yml b/.github/workflows/test_and_publish.yml index 28e582a..7e4d932 100644 --- a/.github/workflows/test_and_publish.yml +++ b/.github/workflows/test_and_publish.yml @@ -18,7 +18,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest pytest-cov coverage - pip install -r requirements.txt + pip install . - name: Run tests run: python -m unittest discover -b --start-directory ./tests - name: Build coverage file From c3049c4cc9a0f0484fa74e4bb78b1617f1a59a8c Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 12:25:01 +0100 Subject: [PATCH 06/13] remove tests from packages find --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0f8d01f..03a0285 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ dependencies = { file = "requirements.txt" } [tool.setuptools.packages.find] include = ["bro*"] -exclude = ["tests"] [tool.isort] profile = "black" From c33b1de3fafbbab88668b035cd7ff850188e2b1d Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 12:25:24 +0100 Subject: [PATCH 07/13] import __version__ in init --- bro/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bro/__init__.py b/bro/__init__.py index 326122c..aef5afa 100644 --- a/bro/__init__.py +++ b/bro/__init__.py @@ -1,3 +1,4 @@ +from bro.__version__ import __version__ from bro.api import * from bro.helper_functions import * from bro.objects import * From 9aba34850d84dac7b47fedd7ce84cc9105f471b5 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 12:50:23 +0100 Subject: [PATCH 08/13] add __version__ to bro.__init__ to make it readable for pyproject.toml --- bro/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bro/__init__.py b/bro/__init__.py index aef5afa..24e7e7c 100644 --- a/bro/__init__.py +++ b/bro/__init__.py @@ -1,4 +1,6 @@ -from bro.__version__ import __version__ +import bro.__version__ as _version from bro.api import * from bro.helper_functions import * from bro.objects import * + +__version__ = _version.__version__ From a11d56816c7c831a6d2601790a94f3391a0e6306 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 13:11:02 +0100 Subject: [PATCH 09/13] add comment --- bro/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bro/__init__.py b/bro/__init__.py index 24e7e7c..f2432b4 100644 --- a/bro/__init__.py +++ b/bro/__init__.py @@ -3,4 +3,5 @@ from bro.helper_functions import * from bro.objects import * +# has to be set explicitly as attribute to be accessible from pyproject.toml # TODO: pyproject.tom can also get version directly from git tag, sounds like a better idea __version__ = _version.__version__ From 442bcf5ba42ea3936de684b3a06f428d240b2e9c Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 14:05:30 +0100 Subject: [PATCH 10/13] add builds to gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 5ae6ae7..67b20d5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,8 @@ venv/ # pycharm .idea/ __pycache__/ + +# Distribution / packaging +build/ +dist/ +*.egg-info/ From 4c701cdbd38a6d3f8f479067a434f6160896f89c Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 14:06:11 +0100 Subject: [PATCH 11/13] fix version readout for build --- bro/__init__.py | 4 ---- pyproject.toml | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bro/__init__.py b/bro/__init__.py index f2432b4..326122c 100644 --- a/bro/__init__.py +++ b/bro/__init__.py @@ -1,7 +1,3 @@ -import bro.__version__ as _version from bro.api import * from bro.helper_functions import * from bro.objects import * - -# has to be set explicitly as attribute to be accessible from pyproject.toml # TODO: pyproject.tom can also get version directly from git tag, sounds like a better idea -__version__ = _version.__version__ diff --git a/pyproject.toml b/pyproject.toml index 03a0285..d9248ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,11 +29,11 @@ dynamic = ["version", "dependencies"] "Source code VIKTOR application" = "https://github.com/viktor-platform/bro-app" [tool.setuptools.dynamic] -version = { attr = "bro.__version__" } dependencies = { file = "requirements.txt" } +version = { attr = "bro.__version__.__version__" } [tool.setuptools.packages.find] -include = ["bro*"] +exclude = ["tests*"] [tool.isort] profile = "black" From b51dca262e512cf76e69d7eb520751c2c984a8a4 Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 14:11:54 +0100 Subject: [PATCH 12/13] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 715d88f..09730ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Added extra workflow to test master branch regularly ### Changed +- (#6) removed deprecated setup.py and change to pyproject.toml ### Deprecated From 08fa545433ce8769013d3cd97c7c3eb8cb25036c Mon Sep 17 00:00:00 2001 From: Wichard Bron Date: Wed, 20 Mar 2024 14:12:00 +0100 Subject: [PATCH 13/13] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09730ab..07880b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - Added extra workflow to test master branch regularly ### Changed -- (#6) removed deprecated setup.py and change to pyproject.toml +- (#6) removed setup.py and replaced by pyproject.toml ### Deprecated