diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bcc580..41a485e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,8 @@ jobs: run: | python3 -m pip install --upgrade pip pip3 install --upgrade coveralls - pip3 install -e .[dev] + pip3 install -e . + pip3 install -r requirements-dev.txt - name: Run precommit run: | diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index da24d13..38f5d1f 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -25,12 +25,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build setuptools wheel twine - name: Build and publish env: TWINE_USERNAME: "__token__" TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} run: | - python setup.py sdist bdist_wheel + python -m build --sdist --wheel twine upload dist/* diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index aae5b12..cb7483f 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -19,15 +19,32 @@ It can well be that we already started working on the feature, or that there are .. _create a new issue: https://github.com/aas-core-works/aas-core3.0-python-protobuf/issues -SDK Code Generation -=================== +Code Generation +=============== -The biggest part of the code has been automatically generated by `aas-core-codegen`_. +The code for the conversion model instance ⟷ Protocol Buffer has been automatically generated by `aas-core-codegen`_. It probably makes most sense to change the generator rather than add new functionality. However, this needs to be decided on a case-by-case basis. .. _aas-core-codegen: https://github.com/aas-core-works/aas-core-codegen +To re-generate the conversion code, run ``dev_scripts/generate_pbization.py``: + +.. code-block:: + + python dev_scripts/generate_pbization.py + +The code for managing Protocol Buffers has been generated using `protoc`_. +You have to have `protoc`_ installed. + +.. _protoc: https://grpc.io/docs/protoc-installation/ + +To re-generate the code for Protocol Buffer management, run: + +.. code-block:: + + python dev_scripts/run_protoc.py + Test Data ========= @@ -35,15 +52,25 @@ The test data is automatically generated by `aas-core3.0-testgen`_, and copied t .. _aas-core3.0-testgen: https://github.com/aas-core-works/aas-core3.0-testgen +New Versions of the Meta-model +============================== +If there is a new patch version of the meta-model, you have to: + +* Update the Protocol Buffer definitions in ``dev_scripts/proto`` (see also ``dev_scripts/update_proto_definition.py``), +* Re-generate the code for the management of Protocol Buffers (see above), and +* Update the ``aas-core-meta`` commit hash in ``requirements-dev.txt`` and install the newest version, and +* Re-generate the conversion code (see above). + Pre-commit Checks ================= -Before you can run pre-commit checks, you need to all the development dependencies. +Before you can run pre-commit checks, you need to all the dependencies as well as the development dependencies. Run in your virtual environment: .. code-block:: - pip3 install --editable .[dev] + pip3 install --editable . + pip3 install -r requirements-dev.txt Now you can execute the checks (from the repository root): diff --git a/pyproject.toml b/pyproject.toml index 3a5729d..986b977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,6 @@ dependencies = [ [project.urls] repository = "https://github.com/aas-core-works/aas-core3.0-python-protobuf" -license = "MIT" - [tool.setuptools.packages.find] include = ["aas_core3_protobuf"] exclude = ["precommit.py"] @@ -71,18 +69,3 @@ strict = true [[tool.mypy.overrides]] module = "aas_core3_protobuf.types_pb2" ignore_errors = true - -[project.optional-dependencies] -dev = [ - "black==24.8.0", - "pylint==3.2.7", - "mypy==1.5.1", - "coverage>=7,<8", - "aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@f9cbdb3#egg=aas-core-meta", - "aas-core-codegen@git+https://github.com/aas-core-works/aas-core-codegen@f0f0925c#egg=aas-core-codegen", - # NOTE (mristin): - # We need at least aas-core3.0 1.1.0 for the general XML de-serialization in - # the test code. - "aas-core3.0>=1.1.0,<2", - "types-protobuf==5.28.3.20241030" -] diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..43d4864 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,14 @@ +black==24.8.0 +pylint==3.2.7 +mypy==1.5.1 +coverage>=7,<8 + +aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@f9cbdb3#egg=aas-core-meta +aas-core-codegen@git+https://github.com/aas-core-works/aas-core-codegen@f0f0925c#egg=aas-core-codegen + +# NOTE (mristin): +# We need at least aas-core3.0 1.1.0 for the general XML de-serialization in +# the test code. +aas-core3.0>=1.1.0,<2 + +types-protobuf==5.28.3.20241030" \ No newline at end of file