Skip to content

Commit

Permalink
Update branding (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-kirienko authored Apr 11, 2022
1 parent 3d3d492 commit f95fc78
Show file tree
Hide file tree
Showing 37 changed files with 307 additions and 306 deletions.
2 changes: 2 additions & 0 deletions .idea/dictionaries/pavel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 UAVCAN Consortium
Copyright (c) 2018 OpenCyphal

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build status](https://ci.appveyor.com/api/projects/status/lurx5gihhcl9wq1w/branch/master?svg=true)](https://ci.appveyor.com/project/Zubax/pydsdl/branch/master)
[![Documentation Status](https://readthedocs.org/projects/pydsdl/badge/?version=latest)](https://pydsdl.readthedocs.io/en/latest/?badge=latest)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pydsdl)](https://pypi.org/project/pydsdl/)
[![Forum](https://img.shields.io/discourse/https/forum.uavcan.org/users.svg)](https://forum.uavcan.org)
[![Forum](https://img.shields.io/discourse/https/forum.opencyphal.org/users.svg)](https://forum.opencyphal.org)

PyDSDL is a [Cyphal](https://opencyphal.org) DSDL compiler front-end implemented in Python.
It accepts a DSDL namespace at the input and produces a well-annotated abstract syntax tree (AST) at the output,
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ for:
# MS Windows test.
- cmd: nox --forcecolor --non-interactive --error-on-missing-interpreters --session test lint
# Shared test for all platforms.
- git clone https://github.com/UAVCAN/public_regulated_data_types .dsdl-test
- git clone https://github.com/OpenCyphal/public_regulated_data_types .dsdl-test
- python -c "import pydsdl; pydsdl.read_namespace('.dsdl-test/uavcan', [])"

# DEPLOYMENT PIPELINE
Expand All @@ -85,7 +85,7 @@ for:
# Configure git credentials.
- echo "https://${GIT_TOKEN}:[email protected]" > ~/.git-credentials
- git config --global credential.helper store
- git config --global user.email "devnull@uavcan.org"
- git config --global user.email "devnull@opencyphal.org"
- git config --global user.name "Release Automation"
# Tag and publish this release. Push the tag after the release is out in case it could not be published.
- 'git tag $(python3 -c "import pydsdl; print(pydsdl.__version__)")'
Expand Down
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2020 UAVCAN Consortium
# Copyright (c) 2020 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

import sys
import pathlib
import datetime


GITHUB_USER_REPO = "UAVCAN", "pydsdl"
GITHUB_USER_REPO = "OpenCyphal", "pydsdl"

DESCRIPTION = "A Cyphal DSDL compiler front-end in Python"

Expand All @@ -23,13 +23,13 @@

EXTERNAL_LINKS = {
"OpenCyphal homepage": "https://opencyphal.org/",
"Support forum": "https://forum.uavcan.org/",
"Support forum": "https://forum.opencyphal.org/",
}

project = "PyDSDL"
author = "OpenCyphal"
# noinspection PyShadowingBuiltins
copyright = str(datetime.datetime.now().year) + ", UAVCAN Development Team"
author = "UAVCAN Development Team"
copyright = str(datetime.datetime.now().year) + ", " + author

version = ".".join(map(str, pydsdl.__version_info__))
release = pydsdl.__version__ # The full version, including alpha/beta/rc tags
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It accepts a DSDL namespace at the input and produces a well-annotated abstract
evaluating all constant expressions in the process.
All DSDL features defined in the Cyphal Specification are supported.

If you have questions, please bring them to the `support forum <https://forum.uavcan.org/>`_.
If you have questions, please bring them to the `support forum <https://forum.opencyphal.org/>`_.

Contributors, please read the :ref:`dev`!

Expand Down
60 changes: 30 additions & 30 deletions docs/ref_fixer_hack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
I've constructed this Sphinx extension as a quick and dirty "solution" to the problem of broken cross-linking.
The problem is that Autodoc fails to realize that an entity, say, pyuavcan.transport._session.InputSession is
exposed to the user as pyuavcan.transport.InputSession, and that the original name is not a part of the API
The problem is that Autodoc fails to realize that an entity, say, pycyphal.transport._session.InputSession is
exposed to the user as pycyphal.transport.InputSession, and that the original name is not a part of the API
and it shouldn't even be mentioned in the documentation at all. I've described this problem in this Sphinx issue
at https://github.com/sphinx-doc/sphinx/issues/6574. Since the original name is not exported, Autodoc can't find
it in the output and generates no link at all, requiring the user to search manually instead of just clicking on
Expand All @@ -24,39 +24,41 @@
import docutils.nodes


_ACCEPTANCE_PATTERN = r'.*([a-zA-Z][a-zA-Z0-9_]*\.)+_[a-zA-Z0-9_]*\..+'
_REFTYPES = 'class', 'meth', 'func'
_ACCEPTANCE_PATTERN = r".*([a-zA-Z][a-zA-Z0-9_]*\.)+_[a-zA-Z0-9_]*\..+"
_REFTYPES = "class", "meth", "func"

_replacements_made: typing.List[typing.Tuple[str, str]] = []


def missing_reference(app: sphinx.application.Sphinx,
_env: sphinx.environment.BuildEnvironment,
node: docutils.nodes.Element,
contnode: docutils.nodes.Node) -> typing.Optional[docutils.nodes.Node]:
old_reftarget = node['reftarget']
if node['reftype'] in _REFTYPES and re.match(_ACCEPTANCE_PATTERN, old_reftarget):
new_reftarget = re.sub(r'\._[a-zA-Z0-9_]*', '', old_reftarget)
def missing_reference(
app: sphinx.application.Sphinx,
_env: sphinx.environment.BuildEnvironment,
node: docutils.nodes.Element,
contnode: docutils.nodes.Node,
) -> typing.Optional[docutils.nodes.Node]:
old_reftarget = node["reftarget"]
if node["reftype"] in _REFTYPES and re.match(_ACCEPTANCE_PATTERN, old_reftarget):
new_reftarget = re.sub(r"\._[a-zA-Z0-9_]*", "", old_reftarget)
if new_reftarget != old_reftarget:
_replacements_made.append((old_reftarget, new_reftarget))
attrs = contnode.attributes if isinstance(contnode, docutils.nodes.Element) else {}
try:
old_refdoc = node['refdoc']
old_refdoc = node["refdoc"]
except KeyError:
return None
new_refdoc = old_refdoc.rsplit(os.path.sep, 1)[0] + os.path.sep + new_reftarget.rsplit('.', 1)[0]
return sphinx.util.nodes.make_refnode(app.builder,
old_refdoc,
new_refdoc,
node.get('refid', new_reftarget),
docutils.nodes.literal(new_reftarget, new_reftarget, **attrs),
new_reftarget)
new_refdoc = old_refdoc.rsplit(os.path.sep, 1)[0] + os.path.sep + new_reftarget.rsplit(".", 1)[0]
return sphinx.util.nodes.make_refnode(
app.builder,
old_refdoc,
new_refdoc,
node.get("refid", new_reftarget),
docutils.nodes.literal(new_reftarget, new_reftarget, **attrs),
new_reftarget,
)
return None


def doctree_resolved(_app: sphinx.application.Sphinx,
doctree: docutils.nodes.document,
_docname: str) -> None:
def doctree_resolved(_app: sphinx.application.Sphinx, doctree: docutils.nodes.document, _docname: str) -> None:
def predicate(n: docutils.nodes.Node) -> bool:
if isinstance(n, docutils.nodes.FixedTextElement):
is_text_primitive = len(n.children) == 1 and isinstance(n.children[0], docutils.nodes.Text)
Expand All @@ -65,22 +67,20 @@ def predicate(n: docutils.nodes.Node) -> bool:
return False

def substitute_once(text: str) -> str:
out = re.sub(r'\._[a-zA-Z0-9_]*', '', text)
out = re.sub(r"\._[a-zA-Z0-9_]*", "", text)
_replacements_made.append((text, out))
return out

# The objective here is to replace all references to hidden objects with their exported aliases.
# For example: pyuavcan.presentation._typed_session._publisher.Publisher --> pyuavcan.presentation.Publisher
# For example: pycyphal.presentation._typed_session._publisher.Publisher --> pycyphal.presentation.Publisher
for node in doctree.traverse(predicate):
assert isinstance(node, docutils.nodes.FixedTextElement)
node.children = [
docutils.nodes.Text(substitute_once(node.children[0].astext()))
]
node.children = [docutils.nodes.Text(substitute_once(node.children[0].astext()))]


def setup(app: sphinx.application.Sphinx):
app.connect('missing-reference', missing_reference)
app.connect('doctree-resolved', doctree_resolved)
app.connect("missing-reference", missing_reference)
app.connect("doctree-resolved", doctree_resolved)
return {
'parallel_read_safe': True,
"parallel_read_safe": True,
}
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2021 UAVCAN Consortium
# Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>
# type: ignore

import os
Expand Down
12 changes: 6 additions & 6 deletions pydsdl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

# pylint: disable=wrong-import-position

import os as _os
import sys as _sys

__version__ = "1.15.1"
__version__ = "1.16.0"
__version_info__ = tuple(map(int, __version__.split(".")[:3]))
__license__ = "MIT"
__author__ = "UAVCAN Consortium"
__copyright__ = "Copyright (c) 2018 UAVCAN Consortium"
__email__ = "consortium@uavcan.org"
__author__ = "OpenCyphal"
__copyright__ = "Copyright (c) 2018 OpenCyphal"
__email__ = "maintainers@opencyphal.org"

# Our unorthodox approach to dependency management requires us to apply certain workarounds.
# Here, the objective is to allow our library to import stuff from its third-party dependency directory,
Expand Down
4 changes: 2 additions & 2 deletions pydsdl/_bit_length_set/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2021 UAVCAN Consortium
# Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

from ._bit_length_set import BitLengthSet as BitLengthSet
6 changes: 3 additions & 3 deletions pydsdl/_bit_length_set/_bit_length_set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

import typing
import warnings
Expand All @@ -14,7 +14,7 @@ class BitLengthSet:
Most of the methods are evaluated analytically in nearly constant time rather than numerically.
This is critical for complex layouts where numerical methods break due to combinatorial explosion and/or memory
limits (see this discussed in https://github.com/UAVCAN/pydsdl/issues/23).
limits (see this discussed in https://github.com/OpenCyphal/pydsdl/issues/23).
There are several methods that trigger numerical expansion of the solution;
due to the aforementioned combinatorial difficulties, they may be effectively incomputable in reasonable time,
so production systems should not rely on them.
Expand Down
4 changes: 2 additions & 2 deletions pydsdl/_bit_length_set/_symbolic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2021 UAVCAN Consortium
# Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

import os
import abc
Expand Down
4 changes: 2 additions & 2 deletions pydsdl/_bit_length_set/_symbolic_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2021 UAVCAN Consortium
# Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

import typing
import random
Expand Down
4 changes: 2 additions & 2 deletions pydsdl/_data_schema_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

from typing import List, Optional
from . import _error
Expand Down
6 changes: 3 additions & 3 deletions pydsdl/_data_type_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

from typing import Optional, Callable, Iterable
import logging
Expand Down Expand Up @@ -198,7 +198,7 @@ def resolve_versioned_data_type(self, name: str, version: _serializable.Version)
del name
found = list(filter(lambda d: d.full_name == full_name and d.version == version, self._lookup_definitions))
if not found:
# Play Sherlock to help the user with mistakes like https://forum.uavcan.org/t/dsdl-compilation-error/904/2
# Play Sherlock to help the user with mistakes like https://forum.opencyphal.org/t/904/2
requested_ns = full_name.split(_serializable.CompositeType.NAME_COMPONENT_SEPARATOR)[0]
lookup_nss = set(x.root_namespace for x in self._lookup_definitions)
subroot_ns = self._definition.name_components[1] if len(self._definition.name_components) > 2 else None
Expand Down
8 changes: 4 additions & 4 deletions pydsdl/_dsdl_definition.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

import os
import time
Expand Down Expand Up @@ -54,7 +54,7 @@ def __init__(self, file_path: Path, root_namespace_path: Path):

relative_directory, basename = [str(x) for x in os.path.split(relative_path)] # type: str, str

# Parsing the basename, e.g., 434.GetTransportStatistics.0.1.uavcan
# Parsing the basename, e.g., 434.GetTransportStatistics.0.1.dsdl
basename_components = basename.split(".")[:-1]
str_fixed_port_id: Optional[str] = None
if len(basename_components) == 4:
Expand All @@ -72,7 +72,7 @@ def __init__(self, file_path: Path, root_namespace_path: Path):
raise FileNameFormatError(
"Not a valid fixed port-ID: %s. "
"Namespaces are defined as directories; putting the namespace name in the file name will not work. "
'For example: "foo/Bar.1.0.uavcan" is OK (where "foo" is a directory); "foo.Bar.1.0.uavcan" is not.'
'For example: "foo/Bar.1.0.dsdl" is OK (where "foo" is a directory); "foo.Bar.1.0.dsdl" is not.'
% str_fixed_port_id,
path=self._file_path,
) from None
Expand Down
25 changes: 13 additions & 12 deletions pydsdl/_error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

# pylint: disable=broad-except

Expand Down Expand Up @@ -57,7 +57,7 @@ def __str__(self) -> str:
Nicely formats an error string in the typical error format ``[file:[line:]]description``.
Example::
uavcan/internet/udp/500.HandleIncomingPacket.1.0.uavcan:33: Error such and such
uavcan/internet/udp/500.HandleIncomingPacket.1.0.dsdl:33: Error such and such
"""
if self.path and self.line:
return "%s:%d: %s" % (self.path.as_posix(), self.line, self.text)
Expand Down Expand Up @@ -85,8 +85,9 @@ def __init__(
culprit: typing.Optional[Exception] = None,
):
if culprit is not None:
report_text = "PLEASE REPORT AT https://github.com/UAVCAN/pydsdl/issues/new?title=" + urllib.parse.quote(
repr(culprit)
report_text = (
"PLEASE REPORT AT https://github.com/OpenCyphal/pydsdl/issues/new?title="
+ urllib.parse.quote(repr(culprit))
)
if text:
text = text + " " + report_text
Expand Down Expand Up @@ -115,16 +116,16 @@ def _unittest_error() -> None:
assert repr(ex) == "FrontendError: 'Hello world!'"

try:
raise FrontendError("Hello world!", path=Path("path/to/file.uavcan"), line=123)
raise FrontendError("Hello world!", path=Path("path/to/file.dsdl"), line=123)
except Exception as ex:
assert str(ex) == "path/to/file.uavcan:123: Hello world!"
assert repr(ex) == "FrontendError: 'path/to/file.uavcan:123: Hello world!'"
assert str(ex) == "path/to/file.dsdl:123: Hello world!"
assert repr(ex) == "FrontendError: 'path/to/file.dsdl:123: Hello world!'"

try:
raise FrontendError("Hello world!", path=Path("path/to/file.uavcan"))
raise FrontendError("Hello world!", path=Path("path/to/file.dsdl"))
except Exception as ex:
assert str(ex) == "path/to/file.uavcan: Hello world!"
assert repr(ex) == "FrontendError: 'path/to/file.uavcan: Hello world!'"
assert str(ex) == "path/to/file.dsdl: Hello world!"
assert repr(ex) == "FrontendError: 'path/to/file.dsdl: Hello world!'"


def _unittest_internal_error_github_reporting() -> None:
Expand Down Expand Up @@ -155,7 +156,7 @@ def _unittest_internal_error_github_reporting() -> None:
# Exception('ERROR TEXT')
assert str(ex).startswith(
"FILE_PATH:42: BASE TEXT "
"PLEASE REPORT AT https://github.com/UAVCAN/pydsdl/issues/new?title=Exception%28%27ERROR%20TEXT%27"
"PLEASE REPORT AT https://github.com/OpenCyphal/pydsdl/issues/new?title=Exception%28%27ERROR%20TEXT%27"
)

try:
Expand Down
4 changes: 2 additions & 2 deletions pydsdl/_expression/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018 UAVCAN Consortium
# Copyright (c) 2018 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
# Author: Pavel Kirienko <pavel@opencyphal.org>

from ._any import Any as Any
from ._any import UndefinedOperatorError as UndefinedOperatorError
Expand Down
Loading

0 comments on commit f95fc78

Please sign in to comment.