Skip to content

Commit

Permalink
D335: Open sourcing process: use ansys-api-edb (#334)
Browse files Browse the repository at this point in the history
* REFACT: remove proto files

* REFACT: update build deps and use ansys-api-edb

* MISC: update project name and description

* REFACT: architecture renaming

Changes:
- use ansys.edb.core instead of ansys.edb
- use ansys.api.edb instead of files from local protos

* MISC: update licence year

* MISC: set optional dependencies in pyproject.toml

Changes:
- remove all requirements files
- add project.optional-dependencies : notebook, tests, doc
- update README.rest, tox.ini and ci_cd.yml accordingly

* MISC: update pre-commit config

Changes:
- use newer repo revisions
- add common pyansys repo

* MISC: fix codespell pre-commit

Changes are to leverage common pyansys file directory structure

* CI: add twine install to build job

* MISC: disable licence pre-commit

* MISC: exclude notebooks from codespell hook

* MISC: pass pre-commit hooks

Changes:
- sort imports
- format using black
- format to match flake8
- format some docstring to match pydocstyle
- trim trailing whitespace (and exclude files)

* CI: fix workflows

The main issue we had was to retrieve `ansys-api-edb`.
It is now accessible through private pypi.

Changes:
- use PIP_EXTRA_INDEX_URL to leverage private pypi
- remove python3.7 from CI and tox.ini
- fix doc-build deps
- fix tox.ini by installing with .[tests]
- change project extra deps to be compatible with private pypi

* CI: update new doc cname
  • Loading branch information
SMoraisAnsys authored Dec 11, 2023
1 parent 34bffae commit c0e3c29
Show file tree
Hide file tree
Showing 270 changed files with 1,287 additions and 7,557 deletions.
51 changes: 24 additions & 27 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
workflow_dispatch:

env:
DOCUMENTATION_CNAME: 'edb.docs.pyansys.com'
DOCUMENTATION_CNAME: 'edb.core.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.10'
PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -21,17 +23,27 @@ jobs:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/code-style@v4
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v4
with:
python-version: 3.7
python-version: ${{ env.MAIN_PYTHON_VERSION }}

doc-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

tests:
name: Tests and coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10']
fail-fast: false

steps:
Expand All @@ -40,23 +52,16 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade -r requirements/requirements_tox.txt
python -m pip install --upgrade .[tests]
python -m pip install --upgrade tox-gh-actions
- name: Test with tox
# Only the tox environment specified in the tox.ini gh-actions is run
run: tox -e test -- --ignore=tests/e2e

doc-style:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: "Check documentation style"
uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

# TODO: convert to ansys/actions/doc-build
doc-build:
name: Build documentation
Expand All @@ -67,11 +72,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade -r requirements/requirements_tox.txt
python -m pip install --upgrade .[doc] tox
- name: Generate the documentation with tox
run: tox -e doc
Expand All @@ -91,18 +96,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip flit
python -m pip install -r protos/requirements/requirements_build.txt
python -m pip install -r requirements/requirements_build.txt
- name: Build API
run: |
cd protos
python setup.py develop
python setup.py bdist_wheel
cp -a dist/. ../dist/
python -m pip install --upgrade pip flit twine
- name: Build Core
run: |
flit build
Expand All @@ -129,7 +126,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.7
python-version: 3.8

- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
Expand Down
65 changes: 32 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
repos:

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.9.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
exclude: |
(?x)(
^src/ansys/api/|
^protos
)

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.9.1]

- repo: https://github.com/pycqa/isort
rev: 5.11.5
rev: 5.12.0
hooks:
- id: isort
exclude: |
(?x)(
^src/ansys/api/|
^protos
)

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
exclude: |
(?x)(
^src/ansys/api/|
^protos
)

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.6
hooks:
- id: codespell
exclude: |
(?x)(
^src/ansys/api/|
^protos|
^notebooks
)
exclude: (?x)(^notebooks)
args: ["--ignore-words", "doc/styles/Vocab/ANSYS/accept.txt", "-w"]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: [toml]
exclude: |
(?x)(
^tests/|
^src/ansys/api/|
^protos
)
additional_dependencies: [tomli]
exclude: "tests/"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: check-yaml
- id: trailing-whitespace
exclude: (?x)^(.*\.def)

# - repo: https://github.com/ansys/pre-commit-hooks
# rev: v0.2.2
# hooks:
# - id: add-license-headers
# args: ["--loc", "./"]

# FIXME: See if this local hooks could be replaced with using
# https://github.com/kynan/nbstripout
- repo: local
hooks:
- id: cleanipynb-helpers
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 ANSYS, Inc. All rights reserved.
Copyright (c) 2023 ANSYS, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 6 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For developers
Installing Pyedb in developer mode allows
you to modify the source and enhance it.

Before contributing to the project, please refer to the `PyAnsys Developer's guide`_. You will
Before contributing to the project, please refer to the `PyAnsys Developer's guide`_. You will
need to follow these steps:

1. Start by cloning this repository:
Expand Down Expand Up @@ -77,7 +77,7 @@ need to follow these steps:
4. Finally, verify your development installation by running:

.. code:: bash
tox
Expand All @@ -86,7 +86,7 @@ How to testing

This project takes advantage of `tox`_. This tool allows to automate common
development tasks (similar to Makefile) but it is oriented towards Python
development.
development.

Using tox
^^^^^^^^^
Expand Down Expand Up @@ -141,14 +141,7 @@ However, the recommended way of checking documentation integrity is using:
Distributing
------------

If you would like to create either source or wheel files, start by installing
the building requirements:

.. code:: bash
python -m pip install -r requirements/requirements_build.txt
Then, you can execute:
If you would like to create either source or wheel files, then you can execute:

.. code:: bash
Expand Down Expand Up @@ -184,13 +177,12 @@ Follow these steps as necessary to run the notebooks :
.. code:: bash
python -m pip install -e .
python -m pip install -e ./protos
3. Install requirements_notebook.txt :
3. Install notebook requirements :

.. code:: bash
python -m pip install -r ./requirements/requirements_notebook.txt
python -m pip install .[notebook]
4. Install ipython kernel :

Expand Down
2 changes: 1 addition & 1 deletion doc/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if errorlevel 9009 (
goto end

:clean
rmdir /s /q %BUILDDIR% > /NUL 2>&1
rmdir /s /q %BUILDDIR% > /NUL 2>&1
for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d"
goto end

Expand Down
2 changes: 1 addition & 1 deletion doc/source/_templates/sidebar-nav-bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
{% else %}
{{ generate_toctree_html("sidebar", maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
{% endif %}

</div>
</nav>
2 changes: 1 addition & 1 deletion doc/source/api/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Database
Classes
-------

.. currentmodule:: ansys.edb.database
.. currentmodule:: ansys.edb.core.database


.. autosummary::
Expand Down
2 changes: 1 addition & 1 deletion doc/source/api/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Definition
Classes
-------

.. currentmodule:: ansys.edb.definition
.. currentmodule:: ansys.edb.core.definition

.. autosummary::
:toctree: _autosummary
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Geometry
Classes
-------

.. currentmodule:: ansys.edb.geometry
.. currentmodule:: ansys.edb.core.geometry

.. autosummary::
:toctree: _autosummary
Expand All @@ -15,7 +15,7 @@ Classes
PointData
Point3DData
Triangle3DData

Enums
-----

Expand Down
22 changes: 11 additions & 11 deletions doc/source/api/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ Glossary
Connectable

The generic type for most objects in Layout.

Objects of the following types are all connectables :

.. toctree::
:maxdepth: 1

primitive
hierarchy
terminal

Zone

Multizone stackups allow a design to be divided into areas called zones.
Each zone contains a subset of layers available to the entire circuit board and is spatially defined by polygons on the Outline layer.
Multizone stackups allow a design to be divided into areas called zones.

Each zone contains a subset of layers available to the entire circuit board and is spatially defined by polygons on the Outline layer.

ValueLike

:obj:`Union <typing.Union>`\[:obj:`int`, :obj:`float`, :obj:`complex`, :obj:`str`, :class:`Value <ansys.edb.utility.Value>`\]
:obj:`Union <typing.Union>`\[:obj:`int`, :obj:`float`, :obj:`complex`, :obj:`str`, :class:`Value <ansys.edb.core.utility.Value>`\]

Point3DLike

:obj:`tuple`\[:term:`ValueLike`, :term:`ValueLike`, :term:`ValueLike`\]

PointDataTuple

:obj:`tuple`\[:class:`PointData <ansys.edb.geometry.PointData>`, :class:`PointData <ansys.edb.geometry.PointData>`\]`
:obj:`tuple`\[:class:`PointData <ansys.edb.core.geometry.PointData>`, :class:`PointData <ansys.edb.core.geometry.PointData>`\]`

Triangle3DLike

Expand All @@ -51,12 +51,12 @@ Glossary

HFSS solver properties are represented by a tuple of the form [dc_thickness_type, dc_thickness_value, solve_inside_enabled]

:obj:`tuple`\[:class:`DCThicknessType <ansys.edb.layer.DCThicknessType>`, :term:`ValueLike`, :obj:`bool`\]
:obj:`tuple`\[:class:`DCThicknessType <ansys.edb.core.layer.DCThicknessType>`, :term:`ValueLike`, :obj:`bool`\]

HFSSExtents

Extent box around the design, represented by a :obj:`dict` with the following key:values

| **dielectric**: (:obj:`float`, :obj:`bool`)
| Dielectric extent size. First parameter is the value and second parameter indicates if the value is a multiple.
| **airbox_horizontal**: (:obj:`float`, :obj:`bool`)
Expand Down
Loading

0 comments on commit c0e3c29

Please sign in to comment.