Skip to content

Commit

Permalink
Issue #324 and #318 fixes
Browse files Browse the repository at this point in the history
Things in this PR
1. fix issue #324 to add `--embed-auditing-info` and to remove, by default, all ephemeral meta data from the built-in templates.
2. fix issue #318 by adding `pascal` to the reserved word list for C
3. fixup copyrights to be dateless (in library)
4. general cleanup based on linter feedback as I encountered it.
5. modernized pytest dependencies
6. updated pydsdl dependency to use the latest
7. updated development environment detils (e.g. newer toxic container,
   improvements to coverage configuration and cSpell, switch to pylint, etc.)
8.various documentation improvements and cleanup
  • Loading branch information
thirtytwobits committed Mar 9, 2024
1 parent 09d9112 commit b190599
Show file tree
Hide file tree
Showing 61 changed files with 1,948 additions and 937 deletions.
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"ms-python.python",
"ms-python.mypy-type-checker",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.autopep8"
"ms-python.pylint"
]
}
},
Expand Down
6 changes: 3 additions & 3 deletions .github/verify.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
#
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Copyright (C) 2018-2021 OpenCyphal Development Team <opencyphal.org>
# This software is distributed under the terms of the MIT License.
# Copyright (C) OpenCyphal Development Team <opencyphal.org>
# Copyright Amazon.com Inc. or its affiliates.
# SPDX-License-Identifier: MIT
#
"""
Command-line helper for running verification builds.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
release:
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toxic:tx22.4.1
container: ghcr.io/opencyphal/toxic:tx22.4.2
steps:
- uses: actions/checkout@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toxic:tx22.4.1
container: ghcr.io/opencyphal/toxic:tx22.4.2
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
matrix:
python3-version: ['7', '8', '9', '10', '11']
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toxic:tx22.4.1
container: ghcr.io/opencyphal/toxic:tx22.4.2
needs: test
steps:
- uses: actions/checkout@v3
Expand All @@ -129,7 +129,7 @@ jobs:
language-verification-c:
runs-on: ubuntu-latest
needs: test
container: ghcr.io/opencyphal/toolshed:ts22.4.1
container: ghcr.io/opencyphal/toolshed:ts22.4.2
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
language-verification-python:
runs-on: ubuntu-latest
needs: test
container: ghcr.io/opencyphal/toxic:tx22.4.1
container: ghcr.io/opencyphal/toxic:tx22.4.2
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ __pycache__
*.egg-info
*.patch
.tox
.nox
.coverage*
.venv
coverage.xml
Expand All @@ -26,6 +27,7 @@ dist
.DS_Store
prof
out
venv

# Eclipse
.metadata
Expand Down
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"ms-python.python",
"ms-python.mypy-type-checker",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.autopep8"
"ms-python.pylint"
]
}
21 changes: 16 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"configurations": [
{
"name": "Python: nnvg c++",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "nunavut",
"cwd": "${workspaceFolder}/src",
Expand All @@ -18,22 +18,33 @@
},
{
"name": "Pytest: current test",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"--keep-generated",
"--rootdir=${workspaceFolder}",
"${file}"
],
"console": "internalConsole",
"cwd": "${workspaceFolder}"
},
{
"name": "Pytest: all doc tests",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"--keep-generated",
"--rootdir=${workspaceFolder}",
"${workspaceFolder}/src"
],
"cwd": "${workspaceFolder}"
},
{
"name": "Pytest: all tests",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"console": "internalConsole",
"cwd": "${workspaceFolder}"
},
{
Expand Down
52 changes: 52 additions & 0 deletions .vscode/nunavut-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
addoption
allclose
astype
autouse
behaviour
bitorder
bools
builtins
Bxxx
caplog
CDEF
codegen
doctests
dryrun
dtype
EDCB
elementwise
emptylines
endianness
errstate
fillvalue
finalizer
fpid
frombuffer
functor
functors
htmlcov
itemsize
lctx
markupsafe
maxsplit
nbytes
ndarray
ndim
nnvg
noxfile
outdir
packbits
postprocessor
postprocessors
roadmap
rtype
Sriram
tobytes
transcompilation
typecheck
Unionant
unpackbits
unseparate
unstropped
WKCV
Xlang
74 changes: 22 additions & 52 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
"python.testing.cwd": "${workspaceFolder}",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"pylint.args": [
"--rcfile=${workspaceFolder}/tox.ini"
],
"black-formatter.args": [
"--line-length=120"
],
"mypy-type-checker.args": [
"--config-file=${workspaceFolder}/tox.ini"
],
"flake8.args": [
"--line-length=120"
],
"files.exclude": {
"**/.git": true,
"**/.svn": true,
Expand Down Expand Up @@ -168,56 +174,20 @@
"environment": "",
"sourceFileMap": "${sourceFileMapObj}"
},
"cSpell.words": [
"allclose",
"astype",
"autouse",
"bitorder",
"bools",
"builtins",
"Bxxx",
"caplog",
"CDEF",
"codegen",
"Cyphal",
"doctests",
"DSDL",
"dtype",
"EDCB",
"elementwise",
"emptylines",
"endianness",
"errstate",
"fillvalue",
"fpid",
"frombuffer",
"htmlcov",
"itemsize",
"Kirienko",
"maxsplit",
"nbytes",
"ndarray",
"ndim",
"nnvg",
"noxfile",
"opencyphal",
"outdir",
"packbits",
"Pavel",
"postprocessor",
"postprocessors",
"pycyphal",
"pydsdl",
"roadmap",
"Sriram",
"tobytes",
"transcompilation",
"typecheck",
"uavcan",
"unpackbits",
"unseparate",
"unstropped",
"WKCV",
"Unionant"
],
"cSpell.allowCompoundWords": true,
"cSpell.caseSensitive": false,
"cSpell.customDictionaries": {
"cyphal" : {
"name": "Cyphal-words",
"path": "${workspaceRoot}/cyphal-words.txt",
"description": "Words used in Cyphal and UAVCAN to add to spell checker dictionaries.",
"addWords": true
},
"nunavut" : {
"name": "Nunavut-words",
"path": "${workspaceRoot}/.vscode/nunavut-words.txt",
"description": "Words used in in the Nunavut codebase to add to spell checker dictionaries.",
"addWords": true
}
}
}
31 changes: 11 additions & 20 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ your dev environment setup.
Tools
************************************************

tox -e local
tox devenv -e local
================================================

I highly recommend using the local tox environment when doing python development. It'll save you hours
Expand All @@ -33,8 +33,8 @@ global python environment. You can install tox from brew on osx or apt-get on GN
recommend the following environment for vscode::

git submodule update --init --recursive
tox -e local
source .tox/local/bin/activate
tox devenv -e local
source venv/bin/activate


cmake
Expand All @@ -58,8 +58,8 @@ Do::

cd path/to/nunavut
git submodule update --init --recursive
tox -e local
source .tox/local/bin/activate
tox devenv -e local
source venv/bin/activate
code .

Then install recommended extensions.
Expand All @@ -72,16 +72,16 @@ To run the full suite of `tox`_ tests locally you'll need docker. Once you have
and running do::

git submodule update --init --recursive
docker pull ghcr.io/opencyphal/toxic:tx22.4.1
docker run --rm -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.1 tox
docker pull ghcr.io/opencyphal/toxic:tx22.4.2
docker run --rm -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.2 tox

To run a limited suite using only locally available interpreters directly on your host machine,
skip the docker invocations and use ``tox -s``.
skip the docker invocations and use ``tox run -s``.

To run the language verification build you'll need to use a different docker container::

docker pull ghcr.io/opencyphal/toolshed:ts22.4.3
docker run --rm -it -v $PWD:/workspace ghcr.io/opencyphal/toolshed:ts22.4.3
docker pull ghcr.io/opencyphal/toolshed:ts22.4.5
docker run --rm -it -v $PWD:/workspace ghcr.io/opencyphal/toolshed:ts22.4.5
cd /workspace
./.github/verify.py -l c
./.github/verify.py -l cpp
Expand Down Expand Up @@ -187,7 +187,7 @@ Building The Docs
We rely on `read the docs`_ to build our documentation from github but we also verify this build
as part of our tox build. This means you can view a local copy after completing a full, successful
test run (See `Running The Tests`_) or do
:code:`docker run --rm -t -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.1 /bin/sh -c "tox -e docs"` to build
:code:`docker run --rm -t -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.2 /bin/sh -c "tox run -e docs"` to build
the docs target. You can open the index.html under ``.tox/docs/tmp/index.html`` or run a local
web-server::

Expand All @@ -198,15 +198,6 @@ Of course, you can just use `Visual Studio Code`_ to build and preview the docs
:code:`> reStructuredText: Open Preview`.


apidoc
================================================

We manually generate the api doc using ``sphinx-apidoc``. To regenerate use ``tox -e gen-apidoc``.

.. warning::

``tox -e gen-apidoc`` will start by deleting the docs/api directory.

************************************************
Coverage and Linting Reports
************************************************
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################
Licence
License
################################################

*************************************
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Nunavut is invoked to generate code for the former.

.. code-block:: shell
nnvg --target-language c --target-endianness=little --enable-serialization-asserts public_regulated_data_types/reg --lookup-dir public_regulated_data_types/uavcan
nnvg --target-language c --enable-serialization-asserts public_regulated_data_types/reg --lookup-dir public_regulated_data_types/uavcan
Generate HTML documentation pages using the command-line tool
-------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

_version_tuple = nunavut_version.split(".")
# The short X.Y version
version = "{}.{}".format(_version_tuple[0], _version_tuple[1])
version = f"{_version_tuple[0]}.{_version_tuple[1]}"
# The full version, including alpha/beta/rc tags
release = nunavut_version

exclude_patterns = ["**/test", "**/.nox"]
exclude_patterns = ["**/test"]

with open(".gitignore", "r") as gif:
with open(".gitignore", "r", encoding="utf-8") as gif:
for line in gif:
stripped = line.strip()
if len(stripped) > 0 and not stripped.startswith("#"):
Expand Down

0 comments on commit b190599

Please sign in to comment.