diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..915a258 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Semantic Release + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-24.04 + concurrency: release + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Python Semantic Release + uses: python-semantic-release/python-semantic-release@v9.8.2 + with: + # Note: This token expires July 2025 + # See: https://python-semantic-release.readthedocs.io/en/latest/index.html#index-creating-vcs-releases + github_token: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_CI_RELEASE }} \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..17b2499 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +# Need to use system python to access QGIS libraries +python system diff --git a/__init__.py b/__init__.py index 57a203b..1a236dd 100644 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,5 @@ +__version__ = "0.1.0" + import logging from .plugin import OFDSDedupPlugin diff --git a/dev_requirements.in b/dev_requirements.in index ac46706..d903501 100644 --- a/dev_requirements.in +++ b/dev_requirements.in @@ -10,3 +10,4 @@ mypy>=1.8,<2 PyQt5-stubs qgis-stubs pip-tools +python-semantic-release diff --git a/dev_requirements.txt b/dev_requirements.txt index 0760bdb..d9df822 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,9 +1,11 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile dev_requirements.in # +annotated-types==0.7.0 + # via pydantic astor==0.8.1 # via flake8-qgis attrs==23.2.0 @@ -12,14 +14,22 @@ black==24.3.0 # via -r dev_requirements.in build==1.2.1 # via pip-tools +certifi==2024.6.2 + # via requests +charset-normalizer==3.3.2 + # via requests click==8.1.7 # via # black + # click-option-group # pip-tools + # python-semantic-release +click-option-group==0.5.6 + # via python-semantic-release coverage[toml]==7.4.4 # via pytest-cov -exceptiongroup==1.2.0 - # via pytest +dotty-dict==1.3.1 + # via python-semantic-release flake8==7.0.0 # via # -r dev_requirements.in @@ -29,12 +39,28 @@ flake8-bugbear==24.2.6 # via -r dev_requirements.in flake8-qgis==1.0.0 # via -r dev_requirements.in +gitdb==4.0.11 + # via gitpython +gitpython==3.1.43 + # via python-semantic-release +idna==3.7 + # via requests +importlib-resources==6.4.0 + # via python-semantic-release iniconfig==2.0.0 # via pytest isort==5.13.2 # via -r dev_requirements.in +jinja2==3.1.4 + # via python-semantic-release +markdown-it-py==3.0.0 + # via rich +markupsafe==2.1.5 + # via jinja2 mccabe==0.7.0 # via flake8 +mdurl==0.1.2 + # via markdown-it-py mypy==1.9.0 # via -r dev_requirements.in mypy-extensions==1.0.0 @@ -56,8 +82,14 @@ pluggy==1.4.0 # via pytest pycodestyle==2.11.1 # via flake8 +pydantic==2.7.4 + # via python-semantic-release +pydantic-core==2.18.4 + # via pydantic pyflakes==3.2.0 # via flake8 +pygments==2.18.0 + # via rich pyproject-hooks==1.0.0 # via # build @@ -75,21 +107,34 @@ pytest-cov==5.0.0 # via -r dev_requirements.in pytest-qgis==2.0.0 # via -r dev_requirements.in +python-gitlab==4.6.0 + # via python-semantic-release +python-semantic-release==9.8.2 + # via -r dev_requirements.in qgis-stubs==0.2.0.post1 # via -r dev_requirements.in -tomli==2.0.1 +requests==2.32.3 # via - # black - # build - # coverage - # mypy - # pip-tools - # pyproject-hooks - # pytest + # python-gitlab + # python-semantic-release + # requests-toolbelt +requests-toolbelt==1.0.0 + # via python-gitlab +rich==13.7.1 + # via python-semantic-release +shellingham==1.5.4 + # via python-semantic-release +smmap==5.0.1 + # via gitdb +tomlkit==0.12.5 + # via python-semantic-release typing-extensions==4.11.0 # via - # black # mypy + # pydantic + # pydantic-core +urllib3==2.2.1 + # via requests wheel==0.43.0 # via pip-tools diff --git a/metadata.txt b/metadata.txt index 7034962..dcc2ecb 100644 --- a/metadata.txt +++ b/metadata.txt @@ -2,7 +2,7 @@ name=OFDS Consolidation Tool description=A tool to consolidate multiple data sets formatted using the Open Fibre Data Standard about=A tool to consolidate multiple data sets formatted using the Open Fibre Data Standard -version=0.1 +version=0.1.0 qgisMinimumVersion=3.28 author=ODSC email=code@opendataservices.coop diff --git a/plugin.py b/plugin.py index 1d4d883..7337f80 100644 --- a/plugin.py +++ b/plugin.py @@ -11,6 +11,7 @@ from .tool.tool import OFDSDedupToolDialog from .tool.style import OFDSStyleToolDialog +from . import __version__ logger = logging.getLogger(__name__) @@ -50,6 +51,7 @@ def unload(self): def run_consolidate(self): logger.debug("Opening OFDS Consolidate Tool Dialog") + logger.debug(f"OFDS Consolidation Tool Plugin v{__version__}") logger.debug( f"Qt: v{QT_VERSION_STR} PyQt: v{PYQT_VERSION_STR} Python: {sys.version}" ) @@ -63,6 +65,7 @@ def run_consolidate(self): def run_style(self): logger.debug("Opening OFDS Style Tool Dialog") + logger.debug(f"OFDS Consolidation Tool Plugin v{__version__}") project = QgsProject.instance() if not project: raise Exception diff --git a/pyproject.toml b/pyproject.toml index 64ce2f9..d79e0c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,29 +4,25 @@ version = "0.1.0" requires-python = ">=3.8" authors = [ - {name = "ODSC", email = "code@opendataservices.coop"} + { name = "ODSC", email = "code@opendataservices.coop" } ] description = "A tool to consolidate multiple fibre network datasets formatted using the Open Fibre Data Standard" readme = "README.md" -license = {file = "LICENSE"} +license = { file = "LICENSE" } keywords = ["open", "fibre", "data", "standard", "ofds", "consolidation", "tool", "gis", "qgis"] # See: https://pypi.org/classifiers/ classifiers = [ # Development Status - "Development Status :: 2 - Pre-Alpha", - + "Development Status :: 3 - Alpha", # Environment "Environment :: Plugins", - # Indicate who your project is intended for "Intended Audience :: Telecommunications Industry", "Topic :: Desktop Environment", "Topic :: Scientific/Engineering :: GIS", - # License "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - # Specify the Python versions you support here. "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", @@ -46,7 +42,7 @@ testpaths = [ [tool.black] line-length = 88 -force-exclude = "gui.py" # gui.py is generated by pyuic5, so don't format it +force-exclude = "gui(_style)?.py" # gui.py is generated by pyuic5, so don't format it [tool.isort] # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#isort @@ -60,5 +56,64 @@ warn_unused_configs = true check_untyped_defs = true exclude = [ "gui.py", + "gui_style.py", "_lib/jellyfish/_jellyfish.py", -] \ No newline at end of file +] + +[tool.semantic_release] +assets = [] +build_command_env = [] +commit_message = "{version}\n\nAutomatically generated by python-semantic-release" +commit_parser = "angular" +logging_use_named_masks = false +major_on_zero = true +allow_zero_version = true +no_git_verify = false +tag_format = "v{version}" +version_variables = ["__init__.py:__version__"] +toml_variables = ["metadata.txt:general.version"] + +[tool.semantic_release.branches.main] +match = '(main|master)' +prerelease_token = "rc" +prerelease = false + +[tool.semantic_release.changelog] +template_dir = "templates" +changelog_file = "CHANGELOG.md" +exclude_commit_patterns = [] + +[tool.semantic_release.changelog.environment] +block_start_string = "{%" +block_end_string = "%}" +variable_start_string = "{{" +variable_end_string = "}}" +comment_start_string = "{#" +comment_end_string = "#}" +trim_blocks = false +lstrip_blocks = false +newline_sequence = "\n" +keep_trailing_newline = false +extensions = [] +autoescape = true + +[tool.semantic_release.commit_author] +env = "GIT_COMMIT_AUTHOR" +default = "semantic-release " + +[tool.semantic_release.commit_parser_options] +allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"] +minor_tags = ["feat"] +patch_tags = ["fix", "perf"] +default_bump_level = 0 + +[tool.semantic_release.remote] +name = "origin" +type = "github" +ignore_token_for_push = false +insecure = false + +[tool.semantic_release.publish] +dist_glob_patterns = ["dist/*"] +upload_to_vcs_release = false # TODO: create release zip +