Commit Graph

91 Commits

Author SHA1 Message Date
Thomas Ferreira de Lima 4d4f4b643b Added python stubs with type hinting and documentation. (#1125)
* Added python stubs with type hinting and documentation.

The documentation was extracted by inspecting the docstrings within each class and methods.
This should enable type hinting and checking by IDEs like VSCode.
The stubs were automatically generated, and have not been manually curated. (TODO)

* created tl ArgType to python type translator

* Fixing a pyaModule.cc bug

* almost finished stubgen

* fixing little bug in classes defined within classes

* Release version of the stubgen script. Good enough for release.

* Adding notes

* Including stubs when installing from source

* typechecking bugfix: missed checking is_iter()

* Cleaning up unused code for merge review

* Including stubs when installing from source (part deux)

* Putting the GenericDeviceExtractor name setting into the right place.

* Updating python stubs

Co-authored-by: Matthias Koefferlein <matthias@koefferlein.de>
2022-09-01 00:41:42 +02:00
Matthias Koefferlein d8f51a5ef0 Qt4 compatibility 2022-05-16 00:07:31 +02:00
Matthias Koefferlein bdc8fc2801 WIP: some fixes at unit test level 2022-05-15 21:47:15 +02:00
Matthias Koefferlein 249642d5f3 Python module tests generalized 2022-05-15 20:17:23 +02:00
Matthias Koefferlein 104975a14e WIP: fixed pymod 2022-05-15 19:34:46 +02:00
Matthias Koefferlein 684ece41d1 Fixed qmake-based builds after changing setup.py 2022-05-14 00:00:35 +02:00
Matthias Koefferlein 5facc418cb WIP: futher improvements on Python module for Qt-less case 2022-05-12 23:42:21 +02:00
Matthias Koefferlein d01ea49246 [CONSIDER MERGING] fixed a typo in gsiDeclBasic.cc which might cause a duplicate GSI class duplicatge registration assertion 2022-05-12 23:42:06 +02:00
Matthias Koefferlein b2b5e5ad55 Modifications to enable building of Qt-less canvas in setup.py 2022-05-12 01:53:16 +02:00
Matthias Koefferlein 86cee4118b Updated copyright for 2022 for remaining files. 2022-01-07 22:22:31 +01:00
Matthias Koefferlein 12fd26663d Merge branch 'qt6' 2022-01-06 21:48:02 +01:00
Matthias Koefferlein 10456516db Updated copyright to 2022, preparations for 0.27.6 (was delayed due to code signing certificate issues) 2022-01-04 21:20:04 +01:00
Matthias Koefferlein 9aed8529f8 Build needs C++11 2021-12-11 16:37:05 +01:00
Matthias Koefferlein eecda3222b Fixed pymod_tests 2021-12-11 15:17:16 +01:00
Matthias Koefferlein 0aca56b1c6 Fixed pymod tests 2021-12-10 01:23:54 +01:00
Matthias Koefferlein 3ef28c8a9d WIP: fixed some string extractors 2021-12-04 23:57:24 +01:00
Matthias Koefferlein 82909001c4 Build fixes with pymod 2021-12-03 07:28:09 +01:00
Matthias Koefferlein a4d2e7891c WIP 2021-11-24 23:59:36 +01:00
Matthias Koefferlein ca15d9ec9d WIP 2021-10-18 00:12:46 +02:00
Matthias Koefferlein 1285868546 Skip private-only tests without private data access 2021-05-01 21:36:52 +02:00
Matthias Koefferlein 687059525c Fine-grained Qt module selection for Qt binding and disabling of view_25d plugin without OpenGL 2021-03-02 23:28:35 +01:00
Matthias Koefferlein 2a9564856b Fixed Qt-binding less builds 2021-02-28 23:31:06 +01:00
Matthias Koefferlein 33ae3b0239 Added a build system option to enable/disable uitools support as some distributions do not support that 2021-02-27 18:03:37 +01:00
Matthias Koefferlein 9350b33bcb Squashed commit of the following:
commit 2a8a2d228d
Author: Matthias Koefferlein <matthias@koefferlein.de>
Date:   Fri Feb 26 23:54:08 2021 +0100

    One more fix.

commit 8c4d76505c
Author: Matthias Koefferlein <matthias@koefferlein.de>
Date:   Fri Feb 26 23:03:07 2021 +0100

    More patches for uitools-less build for CentOS 8

commit 2ac28292b8
Author: Matthias Koefferlein <matthias@koefferlein.de>
Date:   Fri Feb 26 22:52:27 2021 +0100

    First steps for fixing build on CentOS 8 without uitools
2021-02-26 23:59:23 +01:00
Matthias Köfferlein b968f2b47f
#730: providing a new Qt module named QtUiTools for QUiLoader class s… (#735)
* #730: providing a new Qt module named QtUiTools for QUiLoader class support.

* Fixed a compile error on Mac

* Added QtUiTools to some more places

* Fixed a linker issue in the QtUiTools Python lib

* On occasion fixed a infinite recursion problem in the debugger

The recursion happened because by mistake I instantiated a
QApplication inside an in-application Python script. This
crashed the debugger due to infinite recursion. This is not
a real use case but to prevent similar issues, a recursion
sentinel was added.

* Removed QCoreApplication#notify from script bindings

Reasoning: "notify" made standalone scripts using QApplication and
QUiLoader virtually impossible.

Problem description:
- When a QApplication object is instantiated, e.g. in Python, the Qt binding
  will install reimplementation hooks as the object may be dynamically
  extended.
- A notify is virtual this means the *every* "notify" call in the application
  is routed through the interpreter.
- For one thing this will slow down the application
- But as "notify" is called a zillion times this has more than this side effect.
- Specifically "notify" is called from within the QWidget constructor to
  indicate a new widget. Then, if a QDialog for example is instatiated, it's
  base class constructor will call "notify" when the object isn't ready yet.
- This has another severe side effect: as the object isn't ready yet, it gets
  registered in the Python space with the wrong class and QDialog is not visible
  as such.

To mitigate these problems, the most efficient solution is to disable "notify"
in general. There is hardly any use case in a script environment (in C++,
apart from hacking the only reasonable use case is exception handling, but
this does not apply to scripts). For providing the call functionality of
"notify" you should better use "postEvent" or "sendEvent" anyway.

So farewell QCoreApplication.notify ...

* Fixed python test for QtUiTools module

* Fixed UiTools test on Qt4 - QUiLoader needs an application object

Co-authored-by: Kazunari Sekigawa <kazunari.sekigawa@gmail.com>
2021-02-25 21:29:21 +01:00
Matthias Koefferlein 245bf93429 Some build fixes to enable basic compilation on CentOS6 2021-01-24 17:37:46 +00:00
Matthias Koefferlein 7d4310d343 Updated copyright to 2021 2021-01-05 22:57:48 +01:00
Matthias Koefferlein 1a30fdf4b7 Exceptions must not be strings in Python 2020-04-25 23:25:53 +02:00
Matthias Koefferlein b8c82c4f8b Updated copyright notice to 2020 2020-01-05 00:59:43 +01:00
Matthias Koefferlein 61a61a2a5a WIP: added lib module to qmake-based python module build
This works:

  import klayout.db
  import klayout.lib
  print(klayout.db.Library.library_names())   # says ["Basic"]

Also works:

  from klayout import *

Does not work:

  # import klayout.lib needs to be done before the libraries
  # are used initially
  import klayout.db
  print(klayout.db.Library.library_names())   # says []
  import klayout.lib
  print(klayout.db.Library.library_names())   # says []
2019-04-03 01:07:22 +02:00
Matthias Koefferlein b0d7f5f7f5 Updated copyright. 2019-01-08 00:58:45 +01:00
Thomas Ferreira de Lima 6b37e67de6
fixing pya module. adding tests 2018-12-20 16:10:55 -05:00
Matthias Koefferlein a36cf6a2e5 Force relink of pymod/tl to trigger correct build for MSVC 2018-11-18 22:57:17 +01:00
Matthias Koefferlein 7ade9cf079 Added standard Python tests to pymod too
This will include the normal Python tests also
in pymod, hence aligning the test base for pymod
and pya.

This feature requires the pya compatibility module.
2018-11-18 22:42:13 +01:00
Matthias Koefferlein 00a124ce64 Added pya compatibility module 2018-10-23 23:43:52 +02:00
Matthias Koefferlein 863144603c Fixed MSVC builds ... 2018-10-22 23:48:15 +02:00
Matthias Koefferlein 58239650aa Fixed pymod initialization for Python 2
Python 2 is a bit more picky with respect to
the correct name of the module. If passing "db"
to a module called dbcore, it will exit with
a SystemError.
2018-10-22 23:28:55 +02:00
Matthias Koefferlein a25db86046 Fixed pymod.pri for Linux builds. 2018-10-22 21:25:53 +02:00
Matthias Koefferlein b80ce12c12 Some refactoring to fix qmake-based pymod builds
- Unify structure of Python module sources so the pymod.pri can be used for all modules
- switch to tlcore, dbcore and rdbcore + distutils_src wrapper modules
2018-10-22 20:53:49 +02:00
Thomas Ferreira de Lima c1dbb023ae
fixing editable install 'python setup.py develop' 2018-10-19 19:09:20 -04:00
Thomas Ferreira de Lima c3ab951c8a
passing python unit tests 2018-10-19 19:02:38 -04:00
Thomas Ferreira de Lima 87a49007ff
Fixing distutils_src folder structure due to setuptools bug
Also: adding PCellDeclarationHelper to klayout.db
2018-10-19 18:53:37 -04:00
Thomas Ferreira de Lima d3fa4465f6
Renaming core modules to klayout.dbcore, klayout.rdbcore and klayout.tlcore 2018-10-19 17:55:56 -04:00
Matthias Koefferlein 222b98fd70 Some fixes for the testsuite
With these fixes, unit tests pass with MacOS
(set DYLD_LIBRARY_PATH!)

1.) MacOS takes popen vs. pclose seriously
By using fopen we basically spoil the system and other popen
won't work.

2.) For system integrity, MacOS does not propagate DYLD_LIBRARY_PATH
to child processes such as sh. This has to be done explictly.

3.) Search the klayout binary in the right path (klayout.app/...)

4.) Reset KLAYOUT_HOME for less intervention by installed macros
2018-10-09 13:57:26 -07:00
Matthias Köfferlein fe26785203 Fixed install target for MSVC - copy needs to use Windows paths. 2018-09-13 22:31:45 +02:00
Matthias Koefferlein ad03533a7b OASIS tests made robust against hash implementation
The text writer was made "normalizing": it will introduce
a certain element order (string sorting). This way, OASIS
files can be compared against golden data without
changes in the order due to different implementation of
hash containers.
2018-09-10 01:16:49 +02:00
Matthias Köfferlein 5be469af90 Support "klayout-bits" for building on MSVC 2018-09-06 00:23:10 +02:00
Matthias Köfferlein 356a468d66 A couple of changes to make MSVC work - not done yet. 2018-09-02 00:40:35 +02:00
Matthias Köfferlein af50c0f0c3 Many warnings fixed for MSVC 2018-08-29 01:46:18 +02:00
Matthias Köfferlein 860014e3ae MSVC builds for the first time - still a lot of patches required
Some suspicious compiler warnings remain.
2018-08-28 23:19:58 +02:00