Issue1719

classification
Title: dev doc for adding builtin modules is not enough.
Type: Severity: minor
Components: Documentation Versions:
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, juneau001, pjenvey, yyamano
Priority: normal Keywords:

Created on 2011-03-16.05:07:22 by yyamano, last changed 2013-02-26.17:51:00 by fwierzbicki.

Messages
msg6439 (view) Author: Yuji Yamano (yyamano) Date: 2011-03-16.05:07:21
We don't have developers doc for adding builtin modules.

Here is the incomplete instructions to add a builtin module.
Looking at org.python.modules.zipimport might be help.

- Add the mpodule to src/org/python/modules/Setup.java
- Create a module directory as a org.python.modules.YOUR_PACKAGE
- Create a Module as a class. It implements ClassDictInit and add a static
  method classDictInit(PyObject dict).
- Add name of exposed classes in the module to the dict in classDictInit().
- Add @ExposedType to the classes
- Add TYPE field to the classes
- Add a constructor with single PyType argument.
- Add super() to constructors
- Add src/templates/EXPOSED_CLASS_NAME.derived
- Add new entry for EXPOSED_CLASS_NAME.derived to mappings file in the same directory.
- Move src/templates/ and run the following command.
  % python gderived.py EXPOSED_CLASS_NAME.derived
msg6441 (view) Author: Yuji Yamano (yyamano) Date: 2011-03-17.13:44:43
Fixes and one more tip.

> - Add TYPE field to the classes

- Add TYPE field to the classes and set PyType.fromClass(YOUR_CLASS.class)

> - Add super() to constructors

- Call super() or super(TYPE) in all constructors

- Add the exposed classes to CoreExposed.includes in the roor directory
msg6444 (view) Author: Philip Jenvey (pjenvey) Date: 2011-03-21.05:44:01
Thanks for this Yuji

Another thing we need to concentrate on for 2.6 is improving our docs. It might be a good idea to update the wiki with these additions (some of it would go in http://wiki.python.org/jython/PythonTypesInJava, some of it would probably be better elsewhere)

Eventually we should take some of those wiki entries and maintain them as more formal docs, in rST format. I think we could even extend CPython's new devguide (http://docs.python.org/devguide/ http://hg.python.org/devguide/) to cover jython development
History
Date User Action Args
2013-02-26 17:51:00fwierzbickisetpriority: normal
nosy: + fwierzbicki
2011-03-21 05:44:01pjenveysetnosy: + pjenvey, juneau001
messages: + msg6444
2011-03-17 13:44:44yyamanosetmessages: + msg6441
2011-03-16 05:07:22yyamanocreate