diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a895b179fd..67d6de9252 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,7 +3,7 @@ current_version = 6.7.1 commit = True tag = True -[bumpversion:file:setup.py] +[bumpversion:file:pyproject.toml] [bumpversion:file:README.md] diff --git a/.darglint b/.darglint deleted file mode 100644 index 874330e2a1..0000000000 --- a/.darglint +++ /dev/null @@ -1,2 +0,0 @@ -[darglint] -ignore=DAR402,DAR103 diff --git a/.flake8 b/.flake8 index 1e97cdc456..87c1ec45c4 100644 --- a/.flake8 +++ b/.flake8 @@ -2,7 +2,7 @@ max-line-length = 88 max-complexity = 57 select = B,C,E,F,W,T4,B9 -ignore = E501, E503, E722, W503, W503, E203, B950, B305, B018, B902, B020 +ignore = E501, E503, E722, W503, W503, E203, B950, B305, B018, B902, B020, B905 extend-ignore = RST303 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e686b0748e..70429976eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.x + cache-dependency-path: pyproject.toml - name: Install dependencies run: | python -m pip install --upgrade pip @@ -23,7 +24,7 @@ jobs: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + make build twine upload dist/* release_installers: diff --git a/.github/workflows/test_code.yml b/.github/workflows/test_code.yml index a3efe8dc8a..ad504ac579 100644 --- a/.github/workflows/test_code.yml +++ b/.github/workflows/test_code.yml @@ -29,10 +29,10 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "pip" + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install . - pip install flake8 pytest pytest_regressions + pip install .[dev] make install gdslib gf tool install - name: Lint with flake8 @@ -83,7 +83,6 @@ jobs: python -m pip install --upgrade pip make gdslib plugins make install - pip install -r requirements_full.txt - name: Test with pytest env: TIDY3D_USER: ${{ secrets.TIDY3D_EMAIL }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 42eb51eb9c..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,93 +0,0 @@ -image: python:3.9 - -before_script: - - pip list - - python -V # Print out python version for debugging - - which python # Print out which python for debugging - - pip install -r requirements.txt --upgrade - - pip install -r requirements_full.txt --upgrade - - pip install -r requirements_pip.txt --upgrade - - pip install -r requirements_dev.txt --upgrade - - python setup.py develop - -stages: - - test - - release - - docs - -pre-commit: - stage: test - script: - - pip install pre-commit - - pre-commit install - - pre-commit run -a - -test: - stage: test - script: - - pytest - -pages: - stage: docs - script: - - pip install -r requirements_dev.txt - - mkdir public - - cd docs - - make html - - cp -r build/html/* ../public - artifacts: - paths: - - public - only: - - master - - /docs/ - - -# python37: -# image: python:3.7 -# stage: test -# script: -# - python -m pip install tox -# - python -m tox -e py37 - -# python38: -# image: python:3.8 -# stage: test -# script: -# - python -m pip install tox -# - python -m tox -e py38 - -# python39: -# image: python:3.9 -# stage: test -# script: -# - python -m pip install tox -# - python -m tox -e py39 - - -# doctest: -# stage: test -# script: -# - python -m pip install tox -# - python -m tox -e docs - -flake8: - stage: test - script: - - python -m pip install tox - - python -m tox -e flake8 - -# mypy: -# stage: test -# script: -# - python -m pip install tox -# - python -m tox -e mypy - - -# docs: -# stage: release -# script: -# - cd docs -# - make install clean html upload -# only: -# - release diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index aa7e7666d4..0000000000 --- a/.isort.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[tool.isort] -profile = "black" -multi_line_output = 3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bc48279d0..4f09b27191 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,6 +37,9 @@ repos: rev: 647996c743f9e77368ce46cc74abe98549dd4c3a hooks: - id: flake8 + entry: pflake8 + additional_dependencies: [flake8-docstrings, pyproject-flake8] + - repo: https://github.com/kynan/nbstripout rev: 4e0f64cf03b52e2aa54f7dd57c722e1a04a439f6 hooks: @@ -110,7 +113,8 @@ repos: - repo: https://github.com/pycqa/pydocstyle rev: "a6fe4222012e990042c86cdaaa904a8d059752ee" hooks: - - id: pydocstyle + - id: pydocstyle + additional_dependencies: ["pydocstyle[toml]"] # - repo: https://github.com/asottile/reorder_python_imports # rev: 2b2f0c74acdb3de316e23ceb7dd0d7945c354050 # hooks: diff --git a/.pydeps b/.pydeps deleted file mode 100644 index 6e7df01594..0000000000 --- a/.pydeps +++ /dev/null @@ -1,15 +0,0 @@ -[pydeps] -max_bacon = 2 -no_show = True -verbose = 0 -pylib = False -exclude = - os - re - sys - collections - __future__ - gdsfactory/components - gdsfactory/simulation - gdsfactory/tests - gdsfactory/samples diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index a23d6544a9..0000000000 --- a/.pylintrc +++ /dev/null @@ -1,373 +0,0 @@ - -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=compat.py,regions.py - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Use multiple processes to speed up Pylint. -jobs=1 - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist= - -# Allow optimization of some AST trees. This will activate a peephole AST -# optimizer, which will apply various small optimizations. For instance, it can -# be used to obtain the result of joining multiple strings with the addition -# operator. Joining a lot of strings can lead to a maximum recursion error in -# Pylint and this flag can prevent that. It has one side effect, the resulting -# AST will be different than the one from reality. -optimize-ast=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. See also the "--disable" option for examples. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -disable=R0201,W0613,I0021,I0020,C0111,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,R0205,R1705,R1710,W0403,C0415 - - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=no - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - - -[BASIC] - -# List of builtins function names that should not be used, separated by a comma -bad-functions=apply,reduce - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,n,ex,_,c,p,f,x,y,w,df - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,50}$ - -# Naming hint for function names -function-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct variable names -variable-rgx=[a-z_][a-z0-9_]{0,50}$ - -# Naming hint for variable names -variable-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct constant names -const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$ - -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct attribute names -attr-rgx=[a-z_][a-z0-9_]{1,50}$ - -# Naming hint for attribute names -attr-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct argument names -argument-rgx=[a-z_][a-z0-9_]{0,50}$ - -# Naming hint for argument names -argument-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct method names -# Allow for the ast visitor method names of visit_CamelCase. -# Allow for do_HTTPMETHOD used in chalice local. -method-rgx=([a-z_][a-z0-9_]{2,50}|visit_[a-zA-Z]+|do_[A-Z]+)$ - -# Naming hint for method names -method-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=.* - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=88 - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - -# List of optional constructs for which whitespace checking is disabled -no-space-check=trailing-comma,dict-separator - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=5 - -# Ignore comments when computing similarities. -ignore-comments=no - -# Ignore docstrings when computing similarities. -ignore-docstrings=no - -# Ignore imports when computing similarities. -ignore-imports=no - - -[SPELLING] - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis -ignored-modules=six.moves - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent,objects,DoesNotExist,md5,sha1,sha224,sha256,sha384,sha512 - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_|dummy|ignore - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of statements in function / method body -max-statements=30 - -# Maximum number of parents for a class (see R0901). -max-parents=6 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=0 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec,UserDict - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Typing is a third party package in python 2, but built-in to the standard -# library for Python 3. This causes linting issues when typing get grouped -# with the third party package imports. Since chalice was originally written -# just for Python 2, the code standard is to treat as a third party library -# and thus mark it as so when linting. -known-third-party=typing - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 6c50f18882..0000000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -# .readthedocs.yaml -# Read the Docs configuration file -# https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Set the version of Python and other tools you might need -build: - os: ubuntu-20.04 - tools: - python: "3.8" - # python: "miniconda3-4.7" - # python: "mambaforge-4.10" - # You can also specify other tool versions: - # nodejs: "16" - # rust: "1.55" - # golang: "1.17" - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -# If using Sphinx, optionally build your docs in additional formats such as PDF -# formats: -# - pdf - -# Optionally declare the Python requirements required to build your docs -# conda: -# environment: environment.yml -python: - install: - - requirements: requirements.txt - - requirements: requirements_dev.txt - - requirements: requirements_full.txt diff --git a/Dockerfile.dev b/Dockerfile.dev index b53d422087..f429f229a4 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -35,11 +35,5 @@ RUN pip install jax jaxlib RUN pip install gdsfactory[tidy3d] RUN pip install gdsfactory[full] RUN pip install gdsfactory[sipann] -# COPY requirements.txt /opt/app/requirements.txt -# COPY requirements_dev.txt /opt/app/requirements_dev.txt -# WORKDIR /opt/app -# RUN pip install -r requirements.txt -# RUN pip install -r requirements_dev.txt - WORKDIR /home/jovyan # VOLUME /home/jovyan/work diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index ce959869c4..0000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,24 +0,0 @@ -include gdsfactory/tests/gds/alphabet.gds -include gdsfactory/components/csv_data/*.csv -include gdsfactory/components/grating_coupler/csv_data/*.csv -recursive-include gdsfactory/samples/* -global-include *.csv -global-include *.yaml -include requirements.txt -include requirements_full.txt -include requirements_dev.txt -include requirements_exp.txt -include requirements_sipann.txt -include requirements_tidy3d.txt -include requirements_devsim.txt -include requirements_gmsh.txt -include gdsfactory/klayout/pymacros/*.lym -include gdsfactory/klayout/drc/generic.lydrc -include gdsfactory/klayout/tech/generic.layerstack -include gdsfactory/klayout/tech/layers.lyp -include gdsfactory/klayout/tech/tech.lyt -include gdsfactory/klayout/tech/xsection.lym -include gdsfactory/klayout/tech/xsection_generic.lym -include gdsfactory/klayout/tech/xsection_generic.xs -include gdsfactory/klayout/tech/xsection_planarized.xs -include gdsfactory/tech.yml diff --git a/Makefile b/Makefile index ddc76f04cd..9a65b8f867 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,10 @@ help: @echo 'make test-force: Rebuilds regression test' full: gdslib - pip install -r requirements_dev.txt - pip install -r requirements_full.txt - pip install -e . - pip install -r requirements_tidy3d.txt - pip install -r requirements_sipann.txt - pip install -r requirements_devsim.txt + pip install -e .[docs,dev,full,tidy3d,sipann,devsim] install: gdslib - pip install -r requirements_dev.txt - pip install -r requirements_full.txt - pip install -e . + pip install -e .[dev,full] pre-commit install gf tool install @@ -34,18 +27,16 @@ major: python docs/write_components_doc.py plugins: - pip install -e .[tidy3d] + pip install -e .[tidy3d,sipann] pip install jax jaxlib mamba install pymeep=*=mpi_mpich_* -y - pip install -r requirements_sipann.txt pip install --upgrade "protobuf<=3.20.1" plugins-debian: sudo apt install libgl1-mesa-glx -y - pip install -e .[tidy3d] + pip install -e .[tidy3d,sipann] pip install jax jaxlib mamba install pymeep=*=mpi_mpich_* -y - pip install -r requirements_sipann.txt pip install --upgrade "protobuf<=3.20.1" thermal: @@ -60,10 +51,6 @@ meep: sax: pip install jax jaxlib -update: - pur - pur -r requirements_dev.txt - publish: anaconda upload environment.yml @@ -140,7 +127,8 @@ mypy: mypy gdsfactory --ignore-missing-imports build: - python setup.py sdist bdist_wheel + pip install build + python -m build upload-devpi: pip install devpi-client wheel @@ -184,7 +172,5 @@ git-rm-merged: link: lygadgets_link gdsfactory/klayout -spell: - codespell -i 3 -w -L TE,TE/TM,te,ba,FPR,fpr_spacing .PHONY: gdsdiff build conda diff --git a/fixme/pydantic_validator2_fix.py b/fixme/pydantic_validator2_fix.py index ce247fa754..3351cee3da 100644 --- a/fixme/pydantic_validator2_fix.py +++ b/fixme/pydantic_validator2_fix.py @@ -1,3 +1,4 @@ +"""Fix pydantic.""" import gdsfactory as gf from gdsfactory.types import CrossSectionSpec from pydantic import validate_arguments @@ -9,16 +10,15 @@ def straight2a( length2: float = 10, cross_section1: CrossSectionSpec = gf.cross_section.strip, cross_section2: CrossSectionSpec = gf.cross_section.pin, - **kwargs + **kwargs, ) -> gf.Component: - """Returns a concatenation of two cross_sections. + """Return a concatenation of two cross_sections. Args: length1: for the first section. length1: for the second section. cross_section1: for the input. cross_section2: for the output. - """ c = gf.Component() diff --git a/gdsfactory/tests/test_import_from_phidl.py b/gdsfactory/tests/test_import_from_phidl.py deleted file mode 100644 index 93c26772f3..0000000000 --- a/gdsfactory/tests/test_import_from_phidl.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import annotations - -from pytest_regressions.data_regression import DataRegressionFixture - -import gdsfactory as gf -from gdsfactory.difftest import difftest - - -def test_import_from_phidl(data_regression: DataRegressionFixture) -> None: - """Read ports from markers.""" - import phidl.geometry as pg - - c1 = pg.ytron_round() - c2 = gf.read.from_phidl(component=c1) - data_regression.check(c2.to_dict()) - difftest(c2) - - -if __name__ == "__main__": - import phidl.geometry as pg - - c1 = pg.ytron_round() - c2 = gf.read.from_phidl(component=c1) - c2.show(show_ports=True) diff --git a/gdsfactory/tests/test_schema.py b/gdsfactory/tests/test_schema.py.disable similarity index 100% rename from gdsfactory/tests/test_schema.py rename to gdsfactory/tests/test_schema.py.disable diff --git a/install.sh b/install.sh index 86dddf34cd..bfde5cfc7b 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,6 @@ #!/bin/bash -pip install gdsfactory[tidy3d] -pip install gdsfactory[full] --upgrade +pip install gdsfactory[full,tidy3d,devsim] --upgrade pip install devsim pip install gdsfactory==6.7.1 gf tool install diff --git a/pyproject.toml b/pyproject.toml index f9210b9827..cca62e75f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,40 +1,212 @@ +# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta:__legacy__" - -# [tool.pytest.ini_options] -# testpaths = ['gdsfactory'] -# addopts = '--tb=short' -# norecursedirs = [ -# 'gdsfactory/simulation', -# 'gdsfactory/icyaml', -# ] -# filterwarnings = -# ignore::UserWarning -# ignore::DeprecationWarning +requires = ["setuptools>=60", "wheel", "build", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "gdsfactory" +description = "python library to generate GDS layouts" +classifiers = [ + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", +] +version = "6.7.1" +authors = [ + {name = "gdsfactory community", email = "contact@gdsfactory.com"}, +] +keywords = ["eda", "photonics", "python"] +license = {text = "MIT"} +dependencies = [ + "klayout >= 0.27.11", + "click", + "flatdict", + "gdstk", + "jsondiff", + "loguru", + "matplotlib", + "numpy", + "omegaconf", + "orjson", + "pandas", + "pydantic", + "pyyaml", + "qrcode", + "rectpack", + "scipy", + "shapely", + "toolz", + "tqdm", + "types-PyYAML", + "typing_extensions", + "watchdog", + "xmltodict", +] +readme = "README.md" +requires-python = ">=3.7" + +[project.optional-dependencies] +full = [ + "autograd", + "bokeh", + "flayout", + "freetype-py", + "holoviews", + "ipympl", + "ipywidgets", + "klayout", + "mapbox_earcut", + "networkx", + "nlopt", + "pyglet", + "pygmsh", + "sax==0.8.4", + "scikit-fem", + "scikit-image", + "scikit-learn", + "simphony==0.6.1", + "triangle", + "trimesh", + ] +gmsh = [ + "gmsh", + "h5py", + "mapbox_earcut", + "meshio", + "pygmsh", + "pyvista", + "trimesh", + ] +sipann = ["SIPANN==2.0.0"] +tidy3d = ["tidy3d-beta==1.7.1"] +devsim = [ + "devsim", + "mkl", + "pyvista", + "tidy3d-beta==1.7.1", + ] +dev = [ + "autotyping", + "black>=21", + "doc8", + "mypy", + "pre-commit", + "pylsp-mypy", + "types-cachetools", + "flake8", + "flake8-bugbear", + "ipykernel", + "pytest", + "pytest-cov", + "pytest_regressions", + "types-PyYAML", + "xdoctest", + "pyproject-flake8", + ] +docs = [ + "autodoc_pydantic", + "docutils==0.17.1", + "matplotlib", + "myst-parser", + "nbsphinx", + "sphinx", + "sphinx-autodoc-typehints", + "sphinx-book-theme==0.3.3", + "sphinx-click", + "sphinx-copybutton", + "sphinx-markdown-tables==0.0.16", + "sphinxcontrib-video", + ] + + + +[tool.setuptools.packages] +find = {} + +[project.scripts] +gf = "gdsfactory.cli:cli" + +[tool.black] +line-length = 88 +target-version = ['py310'] +include = '\.pyi?$' +exclude = ''' # Specify the files/dirs that should be ignored by the black formatter +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | env + | _build + | buck-out + | build + | dist +)/ +''' + +[tool.pytest.ini_options] +testpaths = ["gdsfactory/"] # addopts = --tb=no -#usefixtures = -# cleandir -# addopts = '--html=test_report.html' '--self-contained-html' +addopts = '--tb=short' +python_files = ["gdsfactory/*.py","notebooks/*.ipynb"] +norecursedirs = ["gdsfactory/simulation", "extra/*.py", "gdsfactory/watch.py"] + +[tool.flake8] +max-line-length = 88 +max-complexity = 57 +select = ["B","C","E","F","W","T4","B9"] +ignore = [ "E501", "E503", "E722", "W503", "W503", "E203", "B950", "B305", "B018", "B902", "B020", "B905"] +extend-ignore = "RST303" -[tool.mypy] -# strict = true exclude = [ - 'gdsfactory/icyaml/', - 'gdsfactory/simulation/', - 'gdsfactory/extra/', - 'gdsfactory/tests/', - 'extra/', - 'gdsfactory/components/extra/', + ".git", + "__pycache__", + "lib", + "docs/source/conf.py", + "build", + "dist", + ".ipynb_checkpoints", + ".tox", + "extra", + "deprecated", + "gdslib", + ".mypy_cache", + "venv", + "devsim" ] - -[tool.ufmt] -excludes = [ - "gdsfactory/__init__.py", +[tool.commitizen] +name = "cz_conventional_commits" +version = "0.1.0" +version_files = [ + "pyproject.toml:version", ] +[tool.mypy] +python_version = "3.10" +strict = true + +[tool.pylsp-mypy] +enabled = true +live_mode = true +strict = true + [tool.isort] -profile = "black" -src_paths = ["gdsfactory"] -skip = ['build', '.tox', 'venv'] +multi_line_output = 3 +line_length = 88 +include_trailing_comma = true +skip = "gdsfactory/__init__.py" + +[tool.setuptools.package-data] +mypkg = ["*.gds", "*.lym", "*.lyp", "*.lyt", "*.csv", "*.yaml"] + +[tool.pydocstyle] +inherit = false +match = "(?!test).*\\.py" +add-ignore = ["D100","D101","D102","D103","D104","D203","D405","D417"] +convention = "google" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index b6385bd02d..0000000000 --- a/pytest.ini +++ /dev/null @@ -1,15 +0,0 @@ -[pytest] -testpaths = gdsfactory/ -# addopts = --tb=no -addopts = '--tb=short' -python_files = gdsfactory/*.py notebooks/*.ipynb -norecursedirs = gdsfactory/simulation extra/*.py gdsfactory/watch.py - - -#filterwarnings = -# ignore::UserWarning -# ignore::DeprecationWarning -# -#usefixtures = -# cleandir -# addopts = '--html=test_report.html' '--self-contained-html' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 009d166e62..0000000000 --- a/requirements.txt +++ /dev/null @@ -1,23 +0,0 @@ --e . -click -flatdict -gdstk -jsondiff -loguru -matplotlib -numpy -omegaconf -orjson -pandas -pydantic -pyyaml -qrcode -rectpack -scipy -shapely -toolz -tqdm -types-PyYAML -typing_extensions -watchdog -xmltodict diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 51c360c9d0..0000000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,24 +0,0 @@ -autodoc_pydantic -autotyping -doc8 -docutils==0.17.1 -flake8 -flake8-bugbear -ipykernel -mypy -myst-parser -nbsphinx -pre-commit -pur -pydocstyle -pytest -pytest-cov -pytest-regressions -sphinx-autodoc-typehints -sphinx-book-theme==0.3.3 -sphinx-click -sphinx-copybutton -sphinx-markdown-tables==0.0.16 -types-PyYAML -types-waitress -xdoctest diff --git a/requirements_devsim.txt b/requirements_devsim.txt deleted file mode 100644 index 15a273baed..0000000000 --- a/requirements_devsim.txt +++ /dev/null @@ -1,4 +0,0 @@ -devsim -mkl -pyvista -tidy3d-beta==1.7.1 diff --git a/requirements_exp.txt b/requirements_exp.txt deleted file mode 100644 index 435ed79ac8..0000000000 --- a/requirements_exp.txt +++ /dev/null @@ -1,4 +0,0 @@ -dash -dash-bootstrap-components>=0.8.2 -jsonschema -Werkzeug==2.2.2 diff --git a/requirements_full.txt b/requirements_full.txt deleted file mode 100644 index 0606d49ab0..0000000000 --- a/requirements_full.txt +++ /dev/null @@ -1,21 +0,0 @@ -autograd -bokeh -flayout -freetype-py -holoviews -ipympl -ipywidgets -klayout -mapbox_earcut -networkx -nlopt -phidl -pyglet -pygmsh -sax==0.8.4 -scikit-fem -scikit-image -scikit-learn -simphony==0.6.1 -triangle -trimesh diff --git a/requirements_gmsh.txt b/requirements_gmsh.txt deleted file mode 100644 index c649550a98..0000000000 --- a/requirements_gmsh.txt +++ /dev/null @@ -1,7 +0,0 @@ -gmsh -h5py -mapbox_earcut -meshio -pygmsh -pyvista -trimesh diff --git a/requirements_sipann.txt b/requirements_sipann.txt deleted file mode 100644 index 4eb67e7c7a..0000000000 --- a/requirements_sipann.txt +++ /dev/null @@ -1 +0,0 @@ -SIPANN==2.0.0 diff --git a/requirements_tidy3d.txt b/requirements_tidy3d.txt deleted file mode 100644 index ddd9415c6a..0000000000 --- a/requirements_tidy3d.txt +++ /dev/null @@ -1 +0,0 @@ -tidy3d-beta==1.7.1 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5f7a293f51..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,65 +0,0 @@ -[options] -python_requires = >= 3.7 - -[coverage:run] -omit = **/test_*.py - -[coverage:html] -directory = _build/coverage_html_report - -[pytype] -python_version = 3.8 -inputs = gdsfactory - -exclude = - gdsfactory/autoplacer/ - gdsfactory/drc/ - -disable = - pyi-error - -[yapf] -based_on_style = google -allow_multiline_lambdas = True - -[doc8] -ignore-path=docs/build/html,docs/notebooks/build,cache -max-line-length=99 -verbose=1 -ignore-path-errors=/tmp/other_thing.rst;D001;D002 - - -[flake8] -max-line-length = 88 -max-complexity = 45 -select = B,C,E,F,W,T4,B9 -ignore = E501, E503, E722, W503, W503, E203, B950, B902, B905 - -extend-ignore = - RST303 - -exclude = - .git, - __pycache__, - docs/source/conf.py, - build, - dist, - .ipynb_checkpoints, - .tox, - extra, - deprecated, - gdslib, - .tox, - .mypy_cache - -[pydocstyle] -inherit = false -match = (?!test).*\.py -add-ignore = D100,D101,D102,D103,D104,D203,D405,D417 -convention = google - - -[codespell] -skip = *.po,*.ts,./src/3rdParty,./src/Test,.mypy_cache,Makefile,.git,extra,docs/notebooks,docs/build -count = -quiet-level = 3 diff --git a/setup.py b/setup.py deleted file mode 100644 index 24f197ab95..0000000000 --- a/setup.py +++ /dev/null @@ -1,89 +0,0 @@ -from setuptools import find_packages, setup - -with open("requirements.txt") as f: - requirements = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_dev.txt") as f: - requirements_dev = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_full.txt") as f: - requirements_full = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_exp.txt") as f: - requirements_exp = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_sipann.txt") as f: - requirements_sipann = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_gmsh.txt") as f: - requirements_gmsh = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_tidy3d.txt") as f: - requirements_tidy3d = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("requirements_devsim.txt") as f: - requirements_devsim = [ - line.strip() for line in f.readlines() if not line.strip().startswith("-") - ] - -with open("README.md") as f: - long_description = f.read() - - -setup( - name="gdsfactory", - url="https://github.com/gdsfactory/gdsfactory", - version="6.7.1", - author="gdsfactory community", - description="python library to generate GDS layouts", - long_description=long_description, - long_description_content_type="text/markdown", - packages=find_packages(), - include_package_data=True, - install_requires=requirements, - python_requires=">=3.7", - license="MIT", - entry_points=""" - [console_scripts] - gf=gdsfactory.cli:cli - """, - extras_require={ - "full": list(set(requirements + requirements_full + requirements_gmsh)), - "sipann": requirements_sipann, - "tidy3d": requirements_tidy3d, - "devsim": requirements_devsim, - "gmsh": requirements_gmsh, - "dev": list(set(requirements + requirements_dev)), - "exp": list(set(requirements + requirements_exp)), - }, - package_data={ - "": ["*.gds", "*.yml", "*.lyp", "*.json"], - }, - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Developers", - "Framework :: Pytest", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", - ], -) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index de726bd6f3..0000000000 --- a/tox.ini +++ /dev/null @@ -1,96 +0,0 @@ -[tox] -envlist = py37, py38, py39 - -[pytest] -addopts = --ignore=setup.py -nb_file_fnmatch = notebooks/*.ipynb - -[testenv] -deps= - pytest - -rrequirements.txt - -rrequirements_full.txt - -rrequirements_dev.txt -commands = pytest - -[testenv:windows] -deps= - pytest - -rrequirements.txt - -rrequirements_full.txt - -rrequirements_dev.txt -conda_deps= - gdstk -conda_channels= - conda-forge -commands = pytest - -[gh-actions] -python = - 3.6: py36 - 3.7: py37 - 3.8: py38 - - -[testenv:deploy] -whitelist_externals= - sh -deps= - -rrequirements.txt - twine - wheel -commands= - sh -c 'mkdir -p dist && rm -f dist/*' - pip wheel -w dist . - sh -c 'twine upload -p none -u none --repository-url http://pypi.com dist/*.whl || echo "COULD NOT UPLOAD RELEASE. (Did you bump the version?)"' - - -# Linters -[testenv:flake8] -basepython = python3 -skip_install = true -deps = - flake8 - flake8-bugbear - flake8-docstrings>=1.3.1 - flake8-import-order>=0.9 - flake8-typing-imports>=1.1 - pep8-naming -commands = - flake8 gdsfactory - - -# Flake8 Configuration -[flake8] -ignore = D203, W503, E203, B950, B018 -exclude = - .tox, - .git, - __pycache__, - docs/source/conf.py, - build, - dist, - tests/fixtures/*, - *.pyc, - *.egg-info, - .cache, - .eggs -max-complexity = 10 -import-order-style = google -application-import-names = flake8 - - -[testenv:docs] -commands = - py.test --doctest-glob="*.md" --doctest-glob="README.md" README.md gdsfactory/ - - -[testenv:plugins] -conda_deps= - pymeep - -conda_channels= - conda-forge -commands = - pytest gdsfactory/simulation/meep - pytest gdsfactory/simulation/mpb