Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ exclude = venv, __init__.py, doc/_build
select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403
count = True
max-complexity = 10
max-line-length = 100
max-line-length = 120
statistics = True
77 changes: 44 additions & 33 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,53 @@ jobs:

- name: Install pre-commit requirements
run: |
pip install poetry
poetry install -E pre-commit
pip install pre-commit

- name: Run pre-commit
run: |
poetry run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

main:
name: Build and Testing
runs-on: ubuntu-latest
timeout-minutes: 20
container:
image: ghcr.io/pyansys/mapdl:v22.2-ubuntu
options: "-u=0:0 --entrypoint /bin/bash"
credentials:
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.MY_TOKEN }}
env:
ON_LOCAL: true
ON_UBUNTU: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Create wheel
run: |
pip install build
python -m pip install build
python -m build --wheel

- name: Validate wheel
run: |
pip install twine
twine check dist/*
python -m pip install twine
python -m twine check dist/*

- name: Install library, with test extra
run: pip install $(echo dist/*)[test]
run: python -m pip install $(echo dist/*)[test]

- name: Unit testing
run: |
cd tests # so we're testing the install, not local
pytest -vx
python -m pytest -vx --cov=ansys.tools.path --cov-report=html

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

- name: Upload wheel
uses: actions/upload-artifact@v2
Expand All @@ -80,32 +92,31 @@ jobs:

- name: Install library, with docs extra
run: |
pip install poetry
poetry install -E docs
pip install .[doc]

- name: Build HTML
run: |
poetry run make -C doc html SPHINXOPTS="-W"

- name: Build PDF Documentation
run: |
sudo apt update
sudo apt-get install -y texlive-latex-extra latexmk
poetry run make -C doc latexpdf

- name: Upload HTML Documentation
uses: actions/upload-artifact@v2
with:
name: Documentation-html
path: doc/build/html
retention-days: 7

- name: Upload PDF Documentation
uses: actions/upload-artifact@v2
with:
name: Documentation-pdf
path: doc/build/latex/*.pdf
retention-days: 7
make -C doc html SPHINXOPTS="-W"

# - name: Build PDF Documentation
# run: |
# sudo apt update
# sudo apt-get install -y texlive-latex-extra latexmk
# make -C doc latexpdf

# - name: Upload HTML Documentation
# uses: actions/upload-artifact@v2
# with:
# name: Documentation-html
# path: doc/build/html
# retention-days: 7

# - name: Upload PDF Documentation
# uses: actions/upload-artifact@v2
# with:
# name: Documentation-pdf
# path: doc/build/latex/*.pdf
# retention-days: 7

Release:
if: contains(github.ref, 'refs/tags')
Expand Down
32 changes: 27 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.1.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
hooks:
- id: reorder-python-imports
args: ["--py37-plus"]
- id: blacken-docs
additional_dependencies: [black==23.1.0]

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
Expand All @@ -16,6 +18,26 @@ repos:
rev: v2.2.2
hooks:
- id: codespell
args: ["--toml", "pyproject.toml"]
additional_dependencies: ["tomli"]

- 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: debug-statements

# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
hooks:
- id: check-github-workflows

# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.1.1
# hooks:
Expand Down
27 changes: 25 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ classifiers = [
]
dependencies = [
"importlib-metadata >=4.0",
"appdirs>=1.4.0",
]


[project.optional-dependencies]
test = [
"pytest==7.2.1",
"pytest-cov==4.0.0",
]

doc = [
"Sphinx==5.0.2",
"numpydoc==1.4.0",
"ansys-sphinx-theme==0.4.2",
"sphinx-copybutton==0.5",
]

build = [
"build==0.8.0",
"twine==4.0.1",
]

[tool.flit.module]
Expand All @@ -37,15 +57,18 @@ Homepage = "https://github.com/pyansys/ansys-tools-path"


[tool.black]
line-length = 100
line-length = 120

[tool.isort]
profile = "black"
force_sort_within_sections = true
line_length = 100
line_length = 120
default_section = "THIRDPARTY"
src_paths = ["doc", "src", "tests"]

[tools.flake8]
max-line-length = 100

[tool.coverage.run]
source = ["ansys.tools"]

Expand Down
2 changes: 0 additions & 2 deletions requirements/requirements_build.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements/requirements_doc.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/requirements_tests.txt

This file was deleted.

10 changes: 10 additions & 0 deletions src/ansys/tools/path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@
import importlib_metadata

__version__ = importlib_metadata.version(__name__.replace(".", "-"))


from ansys.tools.path.path import (
SUPPORTED_ANSYS_VERSIONS,
change_default_ansys_path,
find_ansys,
get_ansys_path,
get_available_ansys_installations,
save_ansys_path,
)
7 changes: 7 additions & 0 deletions src/ansys/tools/path/misc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def is_float(input_string):
"""Returns true when a string can be converted to a float"""
try:
float(input_string)
return True
except ValueError:
return False
Loading