Comments (7)
@doddgray seems reasonable to me. I am totally on board with doing this at least from the quick read through I did. I think in general it might also be better in the ipython (and probably shell) case to use a temp file. My motivation behind the build folder was so that there is traceability (and we don't need to care too much about tempfiles as they can be nasty if we or python clean up too fast). As it will allow you to go back and inspect the gds in case something went wrong or you accidentally close a gds which takes some time to build, etc.
Feel free to open the PR on kfactory. I am the main maintainer over there and @joamatab is the one that finds most of the bugs ^^
from gdsfactory.
What version of klayout are you using?
You need to update klayout to a somewhat recent version
from gdsfactory.
I am currently using KLayout v0.29.0
from gdsfactory.
What version on klive?
from gdsfactory.
@joamatab you only overwrote Component.show
right, or only gf.show
?
I think one might go to KFactory directly and therefore write a oasis (default behavior for kfactory on show).
from gdsfactory.
@joamatab I have klive v0.3.2
from gdsfactory.
I also ran into this issue after upgrading to v8 and needed to find a quick fix.
To do this I added a special case in kfactory.kcell
to recognize calls from IPython kernels in the handling of name
and used tempfile
paths for the OAS files in that scenario. It seems to fix the issue, at least interactive sessions can stream GDS data to KLayout again. Maybe not the right way to do this in the long run.
In a local branch I modified the code here:
https://github.com/gdsfactory/kfactory/blob/2e8612db42b7da756ff84eafd6ab9a667d695de8/src/kfactory/kcell.py#L7577
to look like
# Find the file that calls stack
try:
stk = inspect.getouterframes(inspect.currentframe())
frame = stk[2]
frame_filename_stem = Path(frame.filename).stem
if frame_filename_stem.startswith("<ipython-input"): # Case 1: IPython Kernel call
ipython_shell_id = frame_filename_stem.rstrip(">").split("-")[-1]
name = f"ipython-{ipython_shell_id}"
else: # Case 2: Not IPython Kernel call
if frame.function != "<module>":
name = frame_filename_stem + "_" + frame.function
else:
name = frame_filename_stem
and the code here:
https://github.com/gdsfactory/kfactory/blob/2e8612db42b7da756ff84eafd6ab9a667d695de8/src/kfactory/kcell.py#L7659C1-L7661C63
to look like:
if wtd is not None:
if name.startswith("ipython-"):
root = Path(tempfile.gettempdir()) / "gdsfactory"
else:
root = Path(wtd) / "build/gds"
root.mkdir(parents=True, exist_ok=True)
tf = root / Path(name).with_suffix(".oas")
I'm happy to create a pull request, but not sure if this is how the maintainers want to approach this.
from gdsfactory.
Related Issues (20)
- Question: Roughness in euler_bend_all_angle HOT 6
- Improper cache hits for some components in v7 HOT 1
- type object 'LAYER' has not attribute 'kcl' HOT 1
- RuntimeError: Cannot write layer numbers larger than 65535 to GDS2 streams HOT 2
- remap_layers does not remap layers HOT 3
- The get_ports_list() function does not work in the reference device. HOT 1
- The port doesn't seem to work HOT 2
- `route_from_single_steps` is missing a straight `ComponentSpec` argument
- get_cells looks at cell decorated functions instead of type annotations
- import gds error: borrowing component from another PDK HOT 4
- Pass list of the components or references to boolean function HOT 1
- Importing gdsfactory changes `yaml.safe_load` behavior HOT 1
- Klayout integration stopped working HOT 1
- ValueError: ref() is deprecated. Use add_ref() instead HOT 1
- Resolve Port Positions Recursively from a Top Component in V8 HOT 5
- Colab examples on docs site no longer run after gf requiring python 3.11 HOT 3
- Consistency of the commands. HOT 2
- .dmove() (and .move()) not compatible with Port or DPoint arguments
- How to Obtain the Rotation of a ComponentReference in V8 HOT 2
- No module named 'kfactory.routing.generic' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdsfactory.