Skip to content

Commit 21a1562

Browse files
authored
Rel25 9 1 (#197)
* post v25.6.1 cleanups/fixes * polish AI policy and docs * first bunch of changes migrating to new uv based build and CI/CD; some AI policy polish; prepare for v25.9.1 * add modern pyproject.toml configuration * migrate from legacy setup.py/setup.cfg/requirements.txt to modern pyproject.toml: - Project metadata: name, version, description, authors, keywords, classifiers - Dependencies: migrate twisted/asyncio/dev/all optional-dependencies - Build system: setuptools backend with wheel support - Tool configurations: black, flake8, pytest, coverage, mypy, tox - Python support: bump minimum to 3.11, support 3.11-3.14 on CPython/PyPy - Universal wheel configuration and package data setup * fixes for CI/CD * upgrade GH workflows to use just+uv * relax mypy a bit; disable coverage + typing jobs in CI
1 parent d85785d commit 21a1562

45 files changed

Lines changed: 2160 additions & 963 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ai/AI_ACKNOWLEDGEMENT.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Disclosure of Use of AI Assistance
2+
3+
*This acknowledgement may be added when AI assistants were used collaborating on WAMP and related projects.*
4+
5+
---
6+
7+
In the preparation of this manuscript and code, the author utilized
8+
AI large language models (LLMs) for assistance:
9+
10+
* **[Claude](https://www.anthropic.com/claude)** by *Anthropic Ireland Limited*
11+
* **[Gemini](https://deepmind.google/models/gemini/)** by *Google Ireland Limited*
12+
13+
under respective terms of service for customers in the European
14+
Economic Area (“EEA”).
15+
16+
The tool functions included brainstorming conceptual frameworks
17+
organizing content structure, and refining language for clarity,
18+
serving the role like an editor or a ghostwriter in the world of
19+
writing and publishing. The author maintained full intellectual
20+
responsibility and creative control over all final ideas, arguments,
21+
and text. The final work remains the product of the authors skill,
22+
judgment, and creative labor.
23+
24+
---

.ai/AI_GUIDELINES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# AI Collaboration Guide for the WAMP Project
2+
3+
*This guide is maintained for AI assistants collaborating on WAMP and related projects. When in doubt, be explicit and paranoid.*
4+
5+
---
6+
7+
**Philosophy**: "Dead simple, paranoid, hands-on engineering"
8+
9+
- Explicit is better than magic
10+
- If it's not in version control, it doesn't exist
11+
- Everything must be self-contained and reproducible
12+
- Zero tolerance for system (Python) pollution
13+
14+
---

.ai/AI_POLICY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../AI_POLICY.md

.ai/CLAUDE.md

Lines changed: 320 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
# AI Assistants Policy
2+
3+
Instructions **TO** _AI assistants_, e.g. Anthropic Claude,
4+
Google Gemini, OpenAI ChatGPT, Microsoft Copilot, etc.
5+
6+
- Machine-readable guidelines that AI systems should follow
7+
- not intended (primarily) for human contributors
8+
9+
For notes and policies **FOR** _human contributors_ about using
10+
AI assistants, see top-level file `AI_POLICY.md` in this repo.
11+
12+
---
13+
14+
## AI Assistants Policy: Purpose
15+
16+
This document establishes guidelines for AI assistants e.g.
17+
Anthropic Claude, Google Gemini, OpenAI ChatGPT, Microsoft
18+
Copilot, etc. when working with this project's codebase. It aims
19+
to ensure AI-generated contributions maintain our project's
20+
quality standards and development practices.
21+
22+
## General Mantras
23+
24+
General mantras this project aims to follow:
25+
26+
- Do The Right Thing
27+
- Secure by Design
28+
- Secure by Default
29+
- Make the Right Thing the Easy Thing
30+
- Batteries included - It just works!
31+
- No bullshit Bingo - No time to waste.
32+
33+
## Project Overview
34+
35+
The purpose of and an overview of this specific project can be
36+
found in the top-level file `README.md` in this repo.
37+
38+
## Group of Projects and WAMP
39+
40+
This project is member of a _group of projects_ all related to
41+
[WAMP](https://wamp-proto.org/), and it is _crucial_ to
42+
understand the interelation and dependencies between the projects
43+
in the group. This is because those project "all fit together"
44+
not by accident, but because they were _designed_ for this from
45+
the very beginning. That's the whole reason they exist. WAMP.
46+
47+
It all starts fromq
48+
49+
- [WAMP](https://github.com/wamp-proto/wamp-proto/): The Web
50+
Application Messaging Protocol (the protocol specification and
51+
website)
52+
53+
The WAMP protocol is the umbrella project, and compliance to its
54+
specification is a _top-priority_ for the _WAMP Client Library
55+
implementation projects_ in the _group of projects_:
56+
57+
- [Autobahn|Python](https://github.com/crossbario/autobahn-python/):
58+
WebSocket & WAMP for Python on Twisted and asyncio.
59+
- [Autobahn|JS](https://github.com/crossbario/autobahn-js): WAMP
60+
for Browsers and NodeJS.
61+
- [Autobahn|Java](https://github.com/crossbario/autobahn-java):
62+
WebSocket & WAMP in Java for Android and Java 8
63+
- [Autobahn|C++](https://github.com/crossbario/autobahn-cpp):
64+
WAMP for C++ in Boost/Asio
65+
66+
The only _WAMP Router implementation project_ (currently) in the
67+
_group of projects_ is
68+
69+
- [Crossbar.io](https://github.com/crossbario/crossbar):
70+
Crossbar.io is an open source networking platform for
71+
distributed and microservice applications. It implements the
72+
open Web Application Messaging Protocol (WAMP)
73+
74+
Again, compliance to the WAMP protocol implementation is a
75+
_top-priority_ for Crossbar.io, as is compatibility with all
76+
_WAMP Client Library implementation projects_ in the _group of
77+
projects_.
78+
79+
Further, it is crucial to understand that **Crossbar.io** is a
80+
Python project which builds on **Autobahn|Python**, and more so,
81+
it builds on [Twisted](https://twisted.org/).
82+
83+
While **Crossbar.io** only runs on **Twisted**,
84+
**Autobahn|Python** itself crucially supports _both_ **Twisted**
85+
_and_ **asyncio** (in the Python standard library).
86+
87+
The flexibility to allow users to switch the underlying
88+
networking framework in **Autobahn|Python** between **Twisted**
89+
and **asyncio** seamlessly, and with almost zero code changes on
90+
the user side, is also crucial, and this capability is provided
91+
by
92+
93+
- [txaio](https://github.com/crossbario/txaio/): txaio is a
94+
helper library for writing code that runs unmodified on both
95+
Twisted and asyncio / Trollius.
96+
97+
**Autobahn|Python** further provides both
98+
[WebSocket](https://www.rfc-editor.org/rfc/rfc6455.html) _Client_
99+
and _Server_ implementations, another crucial capability used in
100+
Crossbar.io, the groups _WAMP Router implementation project_, and
101+
in Autobahn|Python, the groups _WAMP Client Library
102+
implementation project_ for Python application code.
103+
104+
Stemming from the participation of the original developer (Tobias
105+
Oberstein) of the _group of projects_ in the IETF HyBi working
106+
group during the RFC6455 specification, **Autobahn|Python** is
107+
also the basis for
108+
109+
- [Autobahn|Testsuite](https://github.com/crossbario/autobahn-testsuite):
110+
The Autobahn|Testsuite provides a fully automated test suite to
111+
verify client and server implementations of The WebSocket
112+
Protocol (and WAMP) for specification conformance and
113+
implementation robustness.
114+
115+
Finally, **Crossbar.io** has a number of advanced features
116+
requiring persistence, for example _WAMP Event History_ (see
117+
_WAMP Avanced Profile_) and others, and these capabilities build
118+
on
119+
120+
- [zLMDB](https://github.com/crossbario/zlmdb): Object-relational
121+
in-memory database layer based on LMDB
122+
123+
which in turn is then used for the **Crossbar.io** specific
124+
embedded database features
125+
126+
- [cfxdb](https://github.com/crossbario/cfxdb): cfxdb is a
127+
Crossbar.io Python support package with core database access
128+
classes written in native Python.
129+
130+
---
131+
132+
All Python projects within the _group of projects_, that is
133+
134+
- Autobahn|Python
135+
- Crossbar.io
136+
- txaio
137+
- zLMDB
138+
- cfxdb
139+
140+
must aim to
141+
142+
- Maintain compatibility across Python versions
143+
144+
when applicable
145+
146+
- Ensure consistent behavior between Twisted and asyncio backends
147+
148+
Further all Python projects must support both
149+
150+
- [CPython](https://www.python.org/), and
151+
- [PyPy](https://pypy.org/)
152+
153+
as the Python (the language itself) run-time environment (the
154+
language implementation).
155+
156+
This support is a MUST and a top-priority. Compatibility with
157+
other Python run-time environments is currently not a priority.
158+
159+
Running on PyPy allows "almost C-like" performance, since PyPy is
160+
a _tracing JIT compiler_ for Python with a _generational garbage
161+
collector_. Both of these features are crucial for
162+
high-performance, throughput/bandwidth and consistent low-latency
163+
in networking or WAMP in particular.
164+
165+
For reasons too long to lay out here, it is of the essence to
166+
only depend on Python-level dependencies in all of the Python
167+
projects within the _group of projects_ which
168+
169+
- DO use [CFFI](https://cffi.readthedocs.io/en/latest/) to link
170+
native code, and
171+
- NOT use CPyExt, the historically grown CPython extension API
172+
that is implementation defined only
173+
174+
This is a deep rabbit hole, but here is
175+
[one link](https://pypy.org/posts/2018/09/inside-cpyext-why-emulating-cpython-c-8083064623681286567.html)
176+
to dig into for some background.
177+
178+
---
179+
180+
## AI Assistant Guidelines
181+
182+
### 1. Code Contributions
183+
184+
The project requires careful attention to:
185+
186+
- **Maintain API compatibility**: Do not break existing public
187+
APIs
188+
- **Follow existing patterns**: Study similar code in the project
189+
before proposing changes
190+
- **Include type hints**: All new code should have proper type
191+
annotations
192+
- **Write tests**: Every code change must include corresponding
193+
tests
194+
- **Always check both backends** (when applicable): Any change
195+
must work correctly with both Twisted AND asyncio
196+
197+
### 2. Development Workflow
198+
199+
In generall, all development must follow the branch-per-feature
200+
[GitHub Flow](https://docs.github.com/en/get-started/using-github/github-flow)
201+
branch strategy and development workflow.
202+
203+
Further, all development must follow
204+
205+
1. **Create an issue first**: All changes start with a GitHub
206+
issue describing the problem/feature
207+
2. **Reference the issue**: PRs must reference the originating
208+
issue
209+
3. **Pass all CI checks**: Code must pass all tests, linting, and
210+
coverage requirements
211+
4. **Update documentation**: Changes affecting public APIs need
212+
documentation updates
213+
214+
Further, we aim for fully automated CI/CD (_not yet reality
215+
everywhere unfortunately_) using
216+
[GitHub Actions](https://docs.github.com/en/actions).
217+
218+
### 3. Code Style and Standards
219+
220+
- Use [Black](https://black.readthedocs.io/) for Python code
221+
formatting
222+
- Use [Prettier](https://prettier.io/) for Markdown documentation
223+
formatting
224+
- Use [rstfmt](https://github.com/dzhu/rstfmt) for ReST
225+
documentation formatting
226+
- Use [Mypy](https://www.mypy-lang.org/) for additional type
227+
hinting (in addition to Python standard type hinting)
228+
- Use [tox](https://tox.wiki/) for driving tests
229+
- Use [Sphinx](https://www.sphinx-doc.org/) for Python
230+
documentation
231+
- Use [Read the Docs](https://about.readthedocs.com/) to host
232+
documentation
233+
- Follow PEP 8 with project-specific exceptions (see .flake8
234+
config)
235+
- Use consistent import ordering (stdlib, third-party, local)
236+
- Maintain existing code formatting patterns
237+
- Preserve comment style and docstring format
238+
239+
### 4. Testing Requirements
240+
241+
- Write tests for both Twisted and asyncio backends
242+
- Use the project's test utilities and fixtures
243+
- Ensure tests are deterministic and don't rely on timing
244+
- Cover edge cases, especially around error handling
245+
246+
### 5. Documentation
247+
248+
- Use reStructuredText format for all documentation
249+
- Include docstrings for all public APIs
250+
- Provide usage examples for new features
251+
- Update CHANGELOG.md following existing format
252+
253+
## IP Policy Restrictions
254+
255+
### AI assistants MUST NOT:
256+
257+
1. **Generate substantial original algorithms** - Only assist
258+
with boilerplate, refactoring, or minor edits
259+
2. **Create entire functions from scratch** - Limit assistance to
260+
modifying existing code patterns
261+
3. **Produce novel architectural designs** - Refer users to
262+
maintainers for design decisions
263+
4. **Generate more than 10 consecutive lines** of new logic
264+
without explicit human modification
265+
266+
### Acceptable AI Assistance:
267+
268+
- ✅ Fixing syntax errors
269+
- ✅ Adapting existing patterns to new use cases
270+
- ✅ Generating test boilerplate based on existing tests
271+
- ✅ Refactoring for style compliance
272+
- ✅ Writing docstrings for existing code
273+
274+
### Unacceptable AI Generation:
275+
276+
- ❌ Creating new algorithms or data structures
277+
- ❌ Designing new API interfaces
278+
- ❌ Implementing complete features from description alone
279+
- ❌ Generating security-critical code
280+
281+
### Required Disclaimers:
282+
283+
When providing code assistance, AI must remind users:
284+
285+
```
286+
"This AI-generated code requires human review and modification.
287+
Contributors must comply with the project's AI_POLICY.md regarding
288+
disclosure and authorship warranties."
289+
```
290+
291+
## What AI Should NOT Do
292+
293+
1. **Don't make breaking changes** without explicit discussion
294+
2. **Don't add new dependencies** without maintainer approval
295+
3. **Don't change CI/CD configuration** without understanding the
296+
full pipeline
297+
4. **Don't modify licensing** or copyright headers
298+
5. **Don't generate code that only works with one backend**
299+
6. **Don't circumvent the IP Policy** restrictions defined above
300+
301+
## Getting Help
302+
303+
If an AI assistant is unsure about:
304+
305+
- Project conventions or patterns
306+
- Compatibility requirements
307+
- Testing approaches
308+
309+
It should recommend:
310+
311+
1. Reviewing similar existing code in the project
312+
2. Checking the documentation at https://txaio.readthedocs.io
313+
3. Asking for clarification in the GitHub issue
314+
4. Consulting maintainer guidelines in CONTRIBUTING.md
315+
316+
---
317+
318+
_This document helps AI assistants provide better contributions
319+
to this project. It is not a replacement for human review and
320+
maintainer decisions._

0 commit comments

Comments
 (0)