Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CellDecoratorSettings to give ability to change default behavior of cell_without_validator function #1659

Merged
merged 2 commits into from May 18, 2023

Conversation

Vivswan
Copy link
Member

@Vivswan Vivswan commented May 18, 2023

I was challenging to define the setting everywhere in my code when using this to turn off cache or always do flatten.
This way user will be able to change the default behavior of cell_without_validator by just updating the CellDecoratorSettings class variables.

For example: If the use do not want to use cache for some reason then (My use case is related to that)
This way cache can be turned off defaultly everywhere just by:

pdk = get_active_pdk()
pdk.cell_decorator_settings.cache = False

Instead of adding cache=False in every argument or clearing cache with gf.clear_cache() everywhere.

@tvt173
Copy link
Collaborator

tvt173 commented May 18, 2023

in principle, I'm not opposed, but if we do this, you should probably mimic the pattern we used for GDS and OASIS write settings... Add the CellDecoratorSettings to the PDK, and get the settings of the active PDK by default. The way you have it, getting the values from the class, rather than an instance of the class will be difficult to customize reliably

See
https://github.com/gdsfactory/gdsfactory/blob/main/gdsfactory/component.py#LL1770C39-L1770C39

@drinwater
Copy link

Curious how this would be used if you don;t add to the pdk and plan on using it in multiple files, do you have to import and set cache to false ever single time...

Why not just add args to the cell_without_validator, and add cell settings there.

-Skandan

@Vivswan
Copy link
Member Author

Vivswan commented May 18, 2023

@drinwater, In my opinion

  • With the args in _cell: already present.
  • With the args in cell_without_validator: we can also add this as well.
  • For the entire project: PDK will be a good way to change the default setting for the entire project.

The priority order for these setting can be in the order: _cell > cell_without_validator > PDK

@joamatab
Copy link
Contributor

Looks good to me,

if you don't use the cache, don't you end up with lots of duplicated cells?

as far as I understand klayout will have issues opening the file and Calibre DRC won't run on your devices

@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Merging #1659 (eda82a4) into main (17f1d1c) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1659      +/-   ##
==========================================
+ Coverage   68.43%   68.44%   +0.01%     
==========================================
  Files         377      377              
  Lines       23252    23264      +12     
  Branches     3394     3394              
==========================================
+ Hits        15912    15924      +12     
  Misses       6398     6398              
  Partials      942      942              
Impacted Files Coverage Δ
gdsfactory/cell.py 79.28% <100.00%> (+0.12%) ⬆️
gdsfactory/pdk.py 57.01% <100.00%> (+1.42%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@joamatab joamatab merged commit c5f34cc into gdsfactory:main May 18, 2023
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants