Skip to content

Commit

Permalink
Fix for publishing
Browse files Browse the repository at this point in the history
We fix a couple of minor points so that we can automatically publish
using ``twine``.

Notably, ``twine`` does not allow for dependencies given as direct
repository links, so we had to move the development dependencies out of
the ``pyproject.toml``.
  • Loading branch information
mristin committed Nov 4, 2024
1 parent dbd871b commit 7c54001
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
37 changes: 32 additions & 5 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,58 @@ 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
=========

The test data is automatically generated by `aas-core3.0-testgen`_, and copied to this repository on every change.

.. _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):

Expand Down
17 changes: 0 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"
]
14 changes: 14 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7c54001

Please sign in to comment.