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
2 changes: 1 addition & 1 deletion .devcontainer/toxic/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
]
}
},
"postCreateCommand": "git submodule update --init --recursive && tox -e local"
"postCreateCommand": "git submodule update --init --recursive && nox -s local"
}
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: setup nox
run: pip install nox
- name: version-check
# Fails the release if the release-tag doesn't match the Nunavut version at that tag.
run: |
python3 ./src/nunavut/_version.py -v --fail-on-mismatch --tag=${{ github.ref }}
- name: lint
run: tox -e lint
run: nox -s lint
- name: test-nnvg
run: tox -e py311-nnvg
run: nox -s nnvg-3.11
- name: test-doctest
run: tox -e py311-doctest,py311-rstdoctest
run: nox -s doctest-3.11 rstdoctest-3.11
- name: test-pytest
run: tox -e py311-test
run: nox -s test-3.11
- name: package
run: tox -e package
run: nox -s package
- name: upload
run: |
pip3 install twine
twine upload -u __token__ -p ${{ secrets.PYPI_PASSWORD }} .tox/package/dist/*
twine upload -u __token__ -p ${{ secrets.PYPI_PASSWORD }} .nox/package/tmp/dist/*
46 changes: 25 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,35 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: setup nox
run: pip install nox
- name: lint
run: tox -e lint
run: nox -s lint
- name: test-nnvg
run: tox -e py311-nnvg
run: nox -s nnvg-3.11
- name: test-doctest
run: tox -e py311-doctest,py311-rstdoctest
run: nox -s doctest-3.11 rstdoctest-3.11
- name: test-pytest
run: tox -e py311-test
run: nox -s test-3.11
- name: test-report
run: tox -e report
run: nox -s report
- name: package
run: tox -e package
run: nox -s package
- name: upload-coverage-reports
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: .tox/report/tmp/*
path: .nox/report/tmp/*
- name: upload-xunit-results
uses: actions/upload-artifact@v4
with:
name: xunit-results
path: .tox/py311-test/tmp/xunit-result.xml
path: .nox/test-3-11/tmp/xunit-result.xml
- name: upload-package
uses: actions/upload-artifact@v4
with:
name: pypi-package
path: .tox/package/dist/*
path: .nox/package/tmp/dist/*

sonar:
runs-on: ubuntu-latest
Expand All @@ -58,18 +60,18 @@ jobs:
uses: actions/download-artifact@v4
with:
name: coverage-reports
path: .tox/report/tmp/
path: .nox/report/tmp/
- name: download-xunit-results
uses: actions/download-artifact@v4
with:
name: xunit-results
path: .tox/py311-test/tmp/
path: .nox/test-3-11/tmp/
- name: set-environment
run: |
echo NUNAVUT_MAJOR_MINOR_VERSION=$(./src/nunavut/_version.py --major-minor-only) >> $GITHUB_ENV
- name: verify tox artifacts
- name: verify nox artifacts
run: ls -R
working-directory: .tox
working-directory: .nox
- name: report-release
if: ${{ github.event_name != 'pull_request' }}
uses: SonarSource/sonarqube-scan-action@v4.2.1
Expand All @@ -82,8 +84,8 @@ jobs:
-Dsonar.buildString=${{ env.GITHUB_RUN_ID }}
-Dsonar.projectVersion=${{ env.NUNAVUT_MAJOR_MINOR_VERSION }}
-Dsonar.python.version=python3.11
-Dsonar.python.coverage.reportPaths=.tox/report/tmp/coverage.xml
-Dsonar.python.xunit.reportPath=.tox/py311-test/tmp/xunit-result.xml
-Dsonar.python.coverage.reportPaths=.nox/report/tmp/coverage.xml
-Dsonar.python.xunit.reportPath=.nox/test-3-11/tmp/xunit-result.xml
- name: report-pr
if: ${{ github.event_name == 'pull_request' }}
uses: SonarSource/sonarqube-scan-action@v4.2.1
Expand All @@ -96,8 +98,8 @@ jobs:
-Dsonar.buildString=${{ env.GITHUB_RUN_ID }}
-Dsonar.projectVersion=${{ env.NUNAVUT_MAJOR_MINOR_VERSION }}
-Dsonar.python.version=python3.11
-Dsonar.python.coverage.reportPaths=.tox/report/tmp/coverage.xml
-Dsonar.python.xunit.reportPath=.tox/py311-test/tmp/xunit-result.xml
-Dsonar.python.coverage.reportPaths=.nox/report/tmp/coverage.xml
-Dsonar.python.xunit.reportPath=.nox/test-3-11/tmp/xunit-result.xml

compat-test-python3-windows-and-mac:
strategy:
Expand All @@ -114,10 +116,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.${{ matrix.python3-version }}
- name: setup tox
run: pip3 install tox
- name: setup nox
run: pip3 install nox
- name: python3.${{ matrix.python3-version }} test
run: tox -e py3${{ matrix.python3-version }}-nnvg,py3${{ matrix.python3-version }}-test
run: nox -s nnvg-3.${{ matrix.python3-version }} test-3.${{ matrix.python3-version }}

compat-test-python3-ubuntu:
strategy:
Expand All @@ -130,8 +132,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: setup nox
run: pip install nox
- name: python3.${{ matrix.python3-version }} test
run: tox -e py3${{ matrix.python3-version }}-nnvg,py3${{ matrix.python3-version }}-test
run: nox -s nnvg-3.${{ matrix.python3-version }} test-3.${{ matrix.python3-version }}

language-verification-c-cpp:
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[MAIN]
ignore-paths = .*/(jinja2|markupsafe)/.*
source-roots = src

[FORMAT]
max-line-length = 120

[DESIGN]
max-args = 8
max-attributes = 12
min-public-methods = 0

[MESSAGES CONTROL]
disable = no-else-return,invalid-name,too-many-positional-arguments
10 changes: 7 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["-vv"],
"pylint.args": [
"--rcfile=${workspaceFolder}/tox.ini"
"--rcfile=${workspaceFolder}/.pylintrc"
],
"isort.args": [
"--line-length=120"
Expand All @@ -15,7 +15,7 @@
],
"mypy-type-checker.args": [
"--config-file",
"${workspaceFolder}/tox.ini"
"${workspaceFolder}/pyproject.toml"
],
"mypy-type-checker.importStrategy": "fromEnvironment",
"flake8.args": [
Expand Down Expand Up @@ -142,5 +142,9 @@
"sonarlint.connectedMode.project": {
"connectionId": "opencyphal",
"projectKey": "OpenCyphal_nunavut"
}
},
"python-envs.workspaceSearchPaths": [
"./**/.venv",
"./.nox/local"
]
}
48 changes: 25 additions & 23 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@ will kickoff and do the rest for you.
Tools
************************************************

tox devenv -e local
nox -s local
================================================

I highly recommend using the local tox environment when doing python development. It'll save you hours
I highly recommend using the local nox session when doing python development. It'll save you hours
of lost productivity the first time it keeps you from pulling in an unexpected dependency from your
global python environment. You can install tox from brew on osx or apt-get on GNU/Linux. I'd
global python environment. You can install nox from brew on osx or pip on any platform. I'd
recommend the following environment for vscode::

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

On Windows that last line is instead::

./venv/Scripts/activate
.\.nox\local\Scripts\activate

cmake
================================================
Expand All @@ -58,15 +59,16 @@ To use vscode you'll need:

1. vscode
2. install vscode command line (`Shell Command: Install`)
3. tox
3. nox
4. cmake (and an available GCC or Clang toolchain, or Docker to use our toolchain-as-container)

Do::

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

Then install recommended extensions.
Expand All @@ -75,15 +77,15 @@ Then install recommended extensions.
Running The Tests
************************************************

To run the full suite of `tox`_ tests locally you'll need docker. Once you have docker installed
To run the full suite of `nox`_ tests locally you'll need docker. Once you have docker installed
and running do::

git submodule update --init --recursive
docker pull ghcr.io/opencyphal/toxic:tx22.4.3
docker run --rm -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.3 tox
docker run --rm -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.3 /bin/sh -c "pip install nox && nox"

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

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

Expand Down Expand Up @@ -210,13 +212,13 @@ 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
as part of our nox 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.3 /bin/sh -c "tox run -e docs"` to build
the docs target. You can open the index.html under ``.tox_{host platform}/docs/tmp/index.html`` or run a local
:code:`docker run --rm -t -v $PWD:/repo ghcr.io/opencyphal/toxic:tx22.4.3 /bin/sh -c "pip install nox && nox -s docs"` to build
the docs target. You can open the index.html under ``.nox/docs/tmp/index.html`` or run a local
web-server::

python3 -m http.server --directory .tox_{host platform}/docs/tmp &
python3 -m http.server --directory .nox/docs/tmp &
open http://localhost:8000/docs/index.html

Of course, you can just use `Visual Studio Code`_ to build and preview the docs using
Expand All @@ -227,25 +229,25 @@ Of course, you can just use `Visual Studio Code`_ to build and preview the docs
Coverage and Linting Reports
************************************************

We publish the results of our coverage data to `sonarcloud`_ and the tox build will fail for any mypy
or black errors but you can view additional reports locally under the :code:`.tox_{host platform}` dir.
We publish the results of our coverage data to `sonarcloud`_ and the nox build will fail for any mypy
or black errors but you can view additional reports locally under the :code:`.nox` dir.

Coverage
================================================

We generate a local html coverage report. You can open the index.html under .tox_{host platform}/report/tmp
We generate a local html coverage report. You can open the index.html under .nox/report/tmp
or run a local web-server::

python -m http.server --directory .tox_{host platform}/report/tmp &
python -m http.server --directory .nox/report/tmp &
open http://localhost:8000/index.html

Mypy
================================================

At the end of the mypy run we generate the following summaries:

- .tox_{host platform}/mypy/tmp/mypy-report-lib/index.txt
- .tox_{host platform}/mypy/tmp/mypy-report-script/index.txt
- .nox/lint/tmp/mypy-report-lib/index.txt
- .nox/lint/tmp/mypy-report-script/index.txt

************************************************
Nunavut Verification Suite
Expand Down Expand Up @@ -326,7 +328,7 @@ three variables you can set in your environment or pass into cmake if using cmak
All other options set when generating code are provided by setting ``NUNAVUT_EXTRA_GENERATOR_ARGS`` in your environment.

.. _`read the docs`: https://readthedocs.org/
.. _`tox`: https://tox.readthedocs.io/en/latest/
.. _`nox`: https://nox.thea.codes/en/stable/
.. _`sonarcloud`: https://sonarcloud.io/dashboard?id=OpenCyphal_nunavut
.. _`OpenCyphal website`: http://opencyphal.org
.. _`OpenCyphal forum`: https://forum.opencyphal.org
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Nunavut: DSDL transpiler
################################################

+--------------------------------+-----------------------------------+
| tox build (main) | |badge_build|_ |
| nox build (main) | |badge_build|_ |
+--------------------------------+-----------------------------------+
| static analysis | |badge_analysis|_ |badge_issues|_ |
+--------------------------------+-----------------------------------+
Expand Down Expand Up @@ -222,9 +222,9 @@ Nunavut is part of the OpenCyphal project:
:alt: Documentation Status
.. _badge_docs: https://nunavut.readthedocs.io/en/latest/?badge=latest

.. |badge_build| image:: https://github.com/OpenCyphal/nunavut/actions/workflows/test_and_release.yml/badge.svg
.. |badge_build| image:: https://github.com/OpenCyphal/nunavut/actions/workflows/test.yml/badge.svg
:alt: Build status
.. _badge_build: https://github.com/OpenCyphal/nunavut/actions/workflows/test_and_release.yml
.. _badge_build: https://github.com/OpenCyphal/nunavut/actions/workflows/test.yml

.. |badge_pypi_support| image:: https://img.shields.io/pypi/pyversions/nunavut.svg
:alt: Supported Python Versions
Expand Down
Loading
Loading