Replies: 4 comments 7 replies
-
Thanks for the great write-up. In my understanding, namespaces are on the textual level already possible, but not used inside Sphinx-Needs. However, parts of this namespace are not automatically created based on the folder or file they are part of. From the technical point I have no concerns using namespace and see the big benefit, but from the usability point of view I have some concerns and open questions: How does linking work?What ID needs to be given to create a valid link?
Which information to take into account to create the namespace elements?I can think of the following sphinx-related elements:
Restructuring the docsWhat happens if:
Expected new features?And most importantly, why spend this extra work? What is the benefit for the user?
If we can answer these questions and keep the usability as good as it is, I would be very happy to support namespaces in one of the next releases. |
Beta Was this translation helpful? Give feedback.
-
How about this:
Just my quick 2 cents. |
Beta Was this translation helpful? Give feedback.
-
I dont know if it is generally a good idea to couple the namespace into the needs.id as mandatory. In directives (eg.) needextend: For the :need: role however there could be a syntax like :need: Validation however should always use namespace+id for uniqueness. |
Beta Was this translation helpful? Give feedback.
-
Rather than implementing another proprietary namespace concept from scratch, how about employing a proven and widely used standard, such as Uniform Resource Names (URNs)? This is supported across varying tools and programming languages. For python, there is rdflib which supports URNs as follows: from rdflib import Namespace
COMP1 = Namespace("urn:COMPANY1:PROJECT1:COMP1:")
requirement = COMP1.REQ_SW_001 Example fully qualified need ID prefixed: Pros
Cons
|
Beta Was this translation helpful? Give feedback.
-
I'm exploring a way to introduce a namespace concept for IDs within Sphinx-Needs.
Why do we need a namespace in Sphinx-Needs?
This aims to align with common software development practices that allows the creation and maintenance of human-readable IDs to uniquely identify elements.
Unlike database-centric systems, docs-as-code relies on human-readable IDs instead of GUIDs. However, longer human-readable IDs can be challenging to maintain, necessitating the division of IDs into namespaces and individual identifiers.
EDIT:
See detailed usecases here.
Drawing Parallels with Programming Languages
Component A
Component B
In the above example
Component A
defines a namespace and owns it.Component B
utilizes this namespace to referenceComponent A
Current state in Sphinx-Needs
Sphinx-Needs currently offers partial support for namespaces when using needs_external_needs. By employing the
id_prefix
configuration, it's possible to add a "namespace" to all imported IDs. Consequently, other needs can refer to IDs using this designated namespace, mirroring the software example provided earlier.Open Issues
Several issues need resolution for complete namespace support within Sphinx-Needs:
Namespace support is limited to
needs_external_needs
Namespace support remains confined to
needs_external_needs
. Consequently, the possibility to create a prefix (namespace) is solely available when using this feature. For instance, during aneeds.json
export, there's no mechanism to prefix a namespace. In the end, external tools consuming these IDs might encounter conflicts or need to implement similar mechanisms toneeds_external_needs
to append a namespace to each ID.Ownership of namespace in
needs_external_needs
Unlike the conventional concept where namespaces are defined and owned by the source (e.g., "ComponentA" defining and owning the namespace used by "ComponentB"), in
needs_external_needs
, the namespace is defined and owned by the importer (e.g., "ComponentB"). This results in the need for each component to redefine the namespace independently, deviating from the conventional "namespace" concept and resembling the Python "import - as" keyword alias concept. (Thanks @StephanKuempel for this hint.)A potential workaround involves centrally defining a namespace variable in
conf.py
for "ComponentA" and utilizing it in the id_prefix of "ComponentB." However, this approach isn't entirely elegant when viewed from a namespace rather than an alias perspective.Namespace usage within the same project not possible
needs_external_needs
facilitates referencing elements via a namespace from an external project but restricts such referencing within the confines of the same project. This implies that while a namespace can be employed to reference "ComponentA" from "ComponentB," it cannot be used reciprocally within "ComponentA" itself.There exist scenarios where employing namespaces consistently to refer to elements, regardless of their origin within or outside the project, makes sense.
Namespace support at project level only
Contrary to languages like C++ or Python that support namespaces at various levels (e.g., C++ at class level, Python at module level), using
needs_external_needs
, Sphinx-Needs only allows namespace emulation at the project level. This limitation might prompt the creation of multiple documentation projects solely to leverage the namespace feature.@StephanKuempel @mb-emag @r-o-b-e-r-t-o fyi
Beta Was this translation helpful? Give feedback.
All reactions