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

Chore/bring over code from old repo #11

Merged
merged 32 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2c126bf
chore: bring over code
tmpbeing Dec 21, 2023
f7554d9
chore: start working through pydocstyle errors
tmpbeing Dec 21, 2023
4182ed0
chore: switch to ruff
tmpbeing Dec 21, 2023
23335b8
chore: run and fix ruff flake8-bugbear rules
tmpbeing Dec 21, 2023
e5ae937
chore: ruff isort
tmpbeing Dec 21, 2023
b70dd06
chore: ruff C4
tmpbeing Dec 21, 2023
d6cebfd
chore: ruff eradicate
tmpbeing Dec 21, 2023
4c0dd45
chore: add more ruff linters
tmpbeing Dec 22, 2023
f93cea1
ruff: more linters activated
tmpbeing Dec 22, 2023
b1c24a2
dev: switch to ruff in precommit hooks
tmpbeing Dec 22, 2023
181fbfe
chore: more ruff checkers
tmpbeing Dec 22, 2023
a5102f1
chore: Update readme for ruff
tmpbeing Dec 22, 2023
80bc6c5
dev: Add pdm folder to .gitignore
tmpbeing Dec 22, 2023
a9a30b5
dev: uncomment doc building actions
tmpbeing Dec 22, 2023
17d9e56
dev: restore .vale.ini file
tmpbeing Dec 22, 2023
7f52901
chore: move doc to source
tmpbeing Dec 22, 2023
8ecfa54
dev: Add vale styles
tmpbeing Dec 22, 2023
95040c3
chore: Fix vale errors
tmpbeing Dec 23, 2023
454e255
fix: install required dependencies in actions
tmpbeing Dec 24, 2023
69f42bb
fix: remove api from package module
tmpbeing Dec 24, 2023
24be5bc
fix: documentation build and typehints
tmpbeing Dec 25, 2023
55a6395
fix: run pytest manually in actions
tmpbeing Dec 25, 2023
a222697
dev: test more python versions in actions
tmpbeing Dec 25, 2023
76b6fac
tweak: Activate meilisearch
tmpbeing Dec 27, 2023
259c7ce
dev: Update to latest ansys actions
tmpbeing Dec 27, 2023
483f235
nit: rename actions test runs
tmpbeing Dec 27, 2023
d8a818f
tweak: restore doc makefiles content
tmpbeing Dec 27, 2023
048b4eb
nit: move build-system at top of pyproject
tmpbeing Dec 27, 2023
5c6c9df
nit: remove unused linters configuration
tmpbeing Dec 27, 2023
d8655fa
tweak: change author and add maintainers
tmpbeing Dec 27, 2023
8af9898
dev: use ansys action for tests
tmpbeing Dec 27, 2023
392399d
dev: add release actions
tmpbeing Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 66 additions & 29 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ on:
- main

env:
MAIN_PYTHON_VERSION: '3.10'
DOCUMENTATION_CNAME: 'simai.docs.pyansys.com'
LIBRARY_NAME: 'ansys-simai-core'
MAIN_PYTHON_VERSION: "3.10"
DOCUMENTATION_CNAME: "simai.docs.pyansys.com"
LIBRARY_NAME: "ansys-simai-core"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

code-style:
name: "Code style"
runs-on: ubuntu-latest
Expand All @@ -42,7 +41,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10']
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: ansys/actions/build-wheelhouse@v5
with:
Expand All @@ -51,28 +50,43 @@ jobs:
python-version: ${{ matrix.python-version }}

tests:
name: "Tests"
name: "Test using Python ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
needs: [smoke-tests]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10']
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: pdm install --dev
- name: Generate test requirements
run: mkdir requirements && pdm export -G test --no-default -o requirements/requirements_tests.txt
- uses: ansys/actions/tests-pytest@v5
with:
pytest-extra-args: "--cov=ansys --cov-report=term --cov-report=html:.cov/html"
checkout: false

doc-build:
name: "Build documentation"
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
- uses: actions/checkout@v4
- name: Generate doc requirements
run: pdm export -G doc --no-default -o doc_requirements.txt
- uses: ansys/actions/doc-build@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
checkout: false
check-links: false
requirements-file: doc_requirements.txt
jorgepiloto marked this conversation as resolved.
Show resolved Hide resolved

build-library:
name: "Build library basic example"
Expand All @@ -84,26 +98,49 @@ jobs:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

#doc-deploy-dev:
# name: "Deploy development documentation"
# runs-on: ubuntu-latest
# needs: [build-library]
# if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
# steps:
# - uses: ansys/actions/doc-deploy-dev@v4
# with:
# cname: ${{ env.DOCUMENTATION_CNAME }}
# token: ${{ secrets.GITHUB_TOKEN }}
#
#doc-deploy-stable:
# name: "Deploy stable documentation"
# runs-on: ubuntu-latest
# needs: [build-library]
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
# steps:
# - uses: ansys/actions/doc-deploy-stable@v4
# with:
# cname: ${{ env.DOCUMENTATION_CNAME }}
# token: ${{ secrets.GITHUB_TOKEN }}
doc-deploy-dev:
name: "Deploy development documentation"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-dev@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-stable@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

release:
name: "Release to private and public PyPI and to GitHub"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [build-library]
steps:
- name: "Release to the private PyPI repository"
uses: ansys/actions/release-pypi-private@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}

# - name: "Release to the public PyPI repository"
# uses: ansys/actions/release-pypi-public@v5
# with:
# library-name: ${{ env.LIBRARY_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYPI_TOKEN }}

- name: "Release to GitHub"
uses: ansys/actions/release-github@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,6 @@ cython_debug/
#.idea/

# End of https://www.toptal.com/developers/gitignore/api/python

# pdm
.pdm-python
58 changes: 22 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.9
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: [toml]
exclude: "tests/"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.22.0
hooks:
- id: check-github-workflows
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.22.0
hooks:
- id: check-github-workflows
1 change: 0 additions & 1 deletion CHANGELOG.md

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Changelog
---------

0.0.1 (Unreleased)
******************

Initial release
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Contributing

74 changes: 23 additions & 51 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pysimai simai
=============
|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black|
|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |ruff|

.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
:target: https://docs.pyansys.com/
Expand All @@ -11,7 +11,7 @@ Pysimai simai
:alt: Python

.. |pypi| image:: https://img.shields.io/pypi/v/simai.svg?logo=python&logoColor=white
:target: https://pypi.org/project/simai
:target: https://pypi.org/project/ansys-simai-core
:alt: PyPI

.. |codecov| image:: https://codecov.io/gh/ansys/pysimai/branch/main/graph/badge.svg
Expand All @@ -26,12 +26,11 @@ Pysimai simai
:target: https://opensource.org/licenses/MIT
:alt: MIT

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
:target: https://github.com/psf/black
:alt: Black
.. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff


A Python wrapper for Ansys simai simai
A Python wrapper for Ansys SimAI


How to install
Expand All @@ -53,12 +52,12 @@ Then, you can simply execute:

.. code:: bash

python -m pip install ansys-pysimai-core
python -m pip install ansys-simai-core

For developers
^^^^^^^^^^^^^^

Installing Pysimai simai in developer mode allows
Installing PySimAI 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
Expand All @@ -70,47 +69,25 @@ need to follow these steps:

git clone https://github.com/ansys/pysimai

#. Create a fresh-clean Python environment and activate it:

.. code:: bash

# Create a virtual environment
python -m venv .venv

# Activate it in a POSIX system
source .venv/bin/activate

# Activate it in Windows CMD environment
.venv\Scripts\activate.bat
#. `Install PDM <https://pdm-project.org/latest/#recommended-installation-method>`_

# Activate it in Windows Powershell
.venv\Scripts\Activate.ps1

#. Make sure you have the latest required build system and doc, testing, and CI tools:
#. Use PDM to create a virtual env with the dependencies and activate it

.. code:: bash

python -m pip install -U pip flit tox
python -m pip install -r requirements/requirements_build.txt
python -m pip install -r requirements/requirements_doc.txt
python -m pip install -r requirements/requirements_tests.txt


#. Install the project in editable mode:
pdm install
eval $(pdm venv activate)

.. code:: bash

python -m pip install --editable ansys-pysimai-core

#. Finally, verify your development installation by running:
#. Finally, verify your development installation by running:

.. code:: bash

tox


How to testing
--------------
How to test
-----------

This project takes advantage of `tox`_. This tool allows to automate common
development tasks (similar to Makefile) but it is oriented towards Python
Expand All @@ -132,8 +109,7 @@ order to guarantee project's integrity. The following environments commands are
Raw testing
^^^^^^^^^^^

If required, you can always call the style commands (`black`_, `isort`_,
`flake8`_...) or unit testing ones (`pytest`_) from the command line. However,
If required, you can always call the style commands (`ruff`_) or unit testing ones (`pytest`_) from the command line. However,
this does not guarantee that your project is being tested in an isolated
environment, which is the reason why tools like `tox`_ exist.

Expand All @@ -153,36 +129,32 @@ Documentation
-------------

For building documentation, you can either run the usual rules provided in the
`Sphinx`_ Makefile, such us:
`Sphinx`_ Makefile, such as:

.. code:: bash

make -C doc/ html && your_browser_name doc/html/index.html
make -C doc/ html && open doc/html/index.html

However, the recommended way of checking documentation integrity is using:

.. code:: bash

tox -e doc && your_browser_name .tox/doc_out/index.html
tox -e doc && open .tox/doc_out/index.html


Distributing
------------

If you would like to create either source or wheel files, start by installing
the building requirements and then executing the build module:
PDM commands can help you build or publish the package

.. code:: bash

python -m pip install -r requirements/requirements_build.txt
python -m build
python -m twine check dist/*
pdm build
pdm publish


.. LINKS AND REFERENCES
.. _black: https://github.com/psf/black
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _ruff: https://github.com/astral-sh/ruff
.. _pip: https://pypi.org/project/pip/
.. _pre-commit: https://pre-commit.com/
.. _PyAnsys Developer's guide: https://dev.docs.pyansys.com/
Expand Down
3 changes: 3 additions & 0 deletions doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Vocab = ANSYS

# Apply the following styles
BasedOnStyles = Vale, Google

# Inline roles are ignored
TokenIgnores = (:.*:`.*`)
Loading