Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.bumpversion]
current_version = "0.0.1"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = true
commit = true
message = "Bump version: {current_version} → {new_version}"
moveable_tags = []
commit_args = "-i CHANGELOG.md"
setup_hooks = []
pre_commit_hooks = ["python scripts/advance_changelog.py"]
post_commit_hooks = []

[[tool.bumpversion.files]]
filename = "CMakeLists.txt"
search = "VERSION {current_version}"
replace = "VERSION {new_version}"

[[tool.bumpversion.files]]
filename = "code-gen/src/poly_scribe_code_gen/__about__.py"
search = "__version__ = \"{current_version}\""
replace = "__version__ = \"{new_version}\""
41 changes: 41 additions & 0 deletions .github/workflows/doc-pub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy PR Preview

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
deploy:
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: pip install -r doc_req.txt

- name: Configure Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Deploy dev version using mike
if: github.ref == 'refs/heads/main'
run: mike deploy dev --update-aliases --push

- name: Deploy release version using mike
if: startsWith(github.ref, 'refs/tags/v')
run: |
version=${GITHUB_REF##*/}
echo "Deploying release version $version"
mike deploy "$version" latest --update-aliases --push
3 changes: 2 additions & 1 deletion .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ jobs:
PR: pr-${{ github.event.number }}
run: |
git fetch origin gh-pages --depth=1
mike delete $PR --ignore --push
mike list
mike delete "$PR" --ignore --push
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Switch from `cereal` to `reflectcpp` (#36)
- Rework the python code generation and add unit tests (#37)
- Rework the integration tests (#39)
- Add support for `yaml` and `cbor` serialization (#40)
- Add python code generation type checks (#41)
- Test that that default strings are quoted in the generated code (#42)
- Test that optional vectors and maps are handled correctly in the generated code (#43)
- Generate full python projects with `pyproject.toml` (#44)
- Docstring rendering (#45)
- Add documentation site (#46)
- Improve the CMake functionality (#49)
- Add CMake install commands (#51)
- Refine optional values in C++ code generation (#53)
- Handle multiple inheritance in C++ code generation (#54)
- Handle user defined default values (#55)
- Refine optional values in python code generation (#56)
- Refine python and json schema generation (#57)
- Final todos for v1.0.0 release (#58)

### Changed

- Fixed wrongly associated docstrings (#48)
- Fix `false` as valid default value (#52)

## `cereal-impl`

- Previous implementation idea using `cereal`.
For more information, please see the PRs on the git repository.
15 changes: 15 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: poly-scribe
message: 'If you use this software, please cite it as below.'
type: software
authors:
- given-names: Pascal
family-names: Palenda
email: pascal.palenda@akustik.rwth-aachen.de
orcid: 'https://orcid.org/0009-0008-0087-9963'
repository-code: >-
https://github.com/pingelit/poly-scribe
license: MIT
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
<pascal.palenda@akustik.rwth-aachen.de>.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing Guidelines

Thank you for considering contributing to our project!
We welcome contributions from the community to help improve and grow our project.
Before contributing, please take a moment to review the following guidelines:

## How to Contribute

1. Fork the repository and clone it to your local machine.
2. Create a new branch for your contribution: `git checkout -b feature/my-feature`.
The branch name should describe the changes you are making.
3. Make your changes and ensure they align with our project's goals and coding standards.
4. Test your changes thoroughly to ensure they work as expected.
5. Commit your changes with clear and descriptive commit messages following the [EU Commit Guidelines](https://ec.europa.eu/component-library/v1.15.0/eu/docs/conventions/git/).
6. Add your changes to the `CHANGELOG.md` file under the `[Unreleased]` section and follow the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
7. Push your changes to your fork.
8. Open a pull request (PR) against the main branch of our repository.
9. Provide a detailed description of your changes in the PR, including any relevant context or references.
10. Ensure your PR passes all automated checks and tests.
11. Be responsive to feedback and be willing to make further changes if requested.

## Code Style and Standards

- Follow our project's coding style and conventions.
- Write clear, concise, and maintainable code.
- Use meaningful variable names and document your code to improve code readability and usability.

## Reporting Issues

If you encounter a bug or have a feature request, please open an issue on our [repository](https://github.com/pingelit/poly-scribe).
Provide detailed information about the issue, including steps to reproduce it if applicable.

## Code of Conduct

Please adhere to our [project's Code of Conduct](CODE_OF_CONDUCT.md) in all interactions and contributions.

## Licensing

By contributing to our project, you agree to license your contributions under the same license as the project.
Ensure that you have the right to contribute the code under the project's license.

We appreciate your interest in contributing to our project and look forward to your contributions!
If you have any questions or need assistance, feel free to contact us.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@

## About poly-scribe

`poly-scribe` is a convenience wrapper around the [`cereal`](https://github.com/USCiLab/cereal) serialization library for saving or "scribing" data objects.
This includes polymorphic objects as well as data validation.
`cereal` can already serialize polymorphic objects, however, this library pursues a less sophisticated approach to scribing data objects.
Polymorphic data objects are serialized with a simple type tag which is used to serialize the correct type.
At the time of loading the data is then validated.
These features make this library a good fit for configurations and scribing data objects.
`poly-scribe` is a software environment designed to facilitate easy (polymorphic) data structure serialization, deserialization and exchange between different programming languages.
The intend is to provide a type-safe and similar interface across multiple languages, allowing developers to work with data structures without worrying about the underlying serialization format.
This is achieved by generating code based on a common interface definition.
For this purpose, `poly-scribe` uses WebIDL (Web Interface Definition Language) to define the data structures.
The generated code can then be used in various programming languages such as C++ or Python.
As such, a simple call to a `load` and `save` function will serialize and deserialize the data structure to and from a file respectively.

To simplify the process of generating code, `poly-scribe` provides a python package called `poly_scribe_code_gen` as well as a CMake function to generate code for a C++ project.

For more information on how to write WebIDL definitions and what the generated code looks like, please refer to the [Quick Start Guide](https://pingelit.github.io/poly-scribe/latest/quick_start/).
For more detailed information on the code generation process, please refer to the [Code Generation API](https://pingelit.github.io/poly-scribe/latest/reference/).
1 change: 1 addition & 0 deletions dev_req.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump-my-version==1.2.1
41 changes: 41 additions & 0 deletions docs/additional.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Additional features

## Default values

Sometimes, you may want to provide default values for user defined types.
This can be achieved by setting the default value in the IDL to `{}`, like in this example:

``` webidl
dictionary SubConfig
{
int answer = 42;
};

dictionary Config
{
SubConfig sub = {};
};
```

This will create a new instance of `SubConfig` in `Config`.
Note, that this is only really possible if `SubConfig` has no required fields.

As an extension to this, this approach can also be used with polymorphic types.
Here, there might not be a single concrete type to instantiate, but rather a family of types that share a common base.
In this case you can define the desired default type in the IDL via the extra attribute `Default` like so:

``` webidl
dictionary Base
{};

dictionary A : Base
{};

dictionary B : Base
{};

dictionary Container
{
[Default=A] Base sub = {};
}
```
Loading
Loading