Skip to content

Update project to PyAnsys guidelines. #21

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

Merged
merged 36 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
76d0316
Add dependabot.yml for dependency update.
Revathyvenugopal162 Jun 14, 2022
5fd41c4
Add dependabot.yml
Revathyvenugopal162 Jun 14, 2022
d5af071
resolve dependency conflit
Revathyvenugopal162 Jun 15, 2022
2d2bac1
Merge branch 'main' of https://github.com/pyansys/pyoptics into feat/…
Revathyvenugopal162 Jun 15, 2022
61bff37
Add badge to README
Revathyvenugopal162 Jun 15, 2022
1a77382
Update README with badges
Revathyvenugopal162 Jun 15, 2022
5fbbeae
Modify readme.
Revathyvenugopal162 Jun 15, 2022
cd81843
Add additional badges.
Revathyvenugopal162 Jun 15, 2022
d0ca2fa
Add labeler.yml file.
Revathyvenugopal162 Jun 15, 2022
0be8f0c
configure latex build as pdf build
Revathyvenugopal162 Jun 15, 2022
7757979
Add label for automatic labeling
Revathyvenugopal162 Jun 15, 2022
710e328
Creating general files
Revathyvenugopal162 Jun 16, 2022
b2fd57f
Modifying files as isort
Revathyvenugopal162 Jun 16, 2022
2fcd545
Arrange label files
Revathyvenugopal162 Jun 16, 2022
5090d36
Move to src files
Revathyvenugopal162 Jun 16, 2022
19203d0
Add tox file and update workflow
Revathyvenugopal162 Jun 16, 2022
f7fed17
Modify code blocks for src.
Revathyvenugopal162 Jun 16, 2022
9be2c7b
resolve merge conflits with main
Revathyvenugopal162 Jun 16, 2022
5706407
Modify ci/cd
Revathyvenugopal162 Jun 16, 2022
410cde3
Modify ci/cd
Revathyvenugopal162 Jun 16, 2022
4b2f186
Modify ci/cd
Revathyvenugopal162 Jun 16, 2022
76c1c24
Modify doc for ci/cd workflow
Revathyvenugopal162 Jun 16, 2022
41a3ce7
Modify doc for ci/cd workflow
Revathyvenugopal162 Jun 16, 2022
e503a11
Modify ci/cd build workflow
Revathyvenugopal162 Jun 16, 2022
42cff80
Modify ci/cd build workflow
Revathyvenugopal162 Jun 16, 2022
de26bef
Modify ci/cd build workflow
Revathyvenugopal162 Jun 16, 2022
4f1adbb
Modify workflow test and build together
Revathyvenugopal162 Jun 16, 2022
5959034
Modify gitignore
Revathyvenugopal162 Jun 17, 2022
572bd64
Remove setup.py and add toml file
Revathyvenugopal162 Jun 17, 2022
b462f1a
Rearrage the imports
Revathyvenugopal162 Jun 17, 2022
26a97b6
Change the package name in conf
Revathyvenugopal162 Jun 17, 2022
1c988f8
Change the package name in conf
Revathyvenugopal162 Jun 17, 2022
5519654
Change the package name in conf
Revathyvenugopal162 Jun 17, 2022
d5fff8e
Build with flit
Revathyvenugopal162 Jun 17, 2022
c5f6fea
Build with flit and install library
Revathyvenugopal162 Jun 17, 2022
75208f0
change the package name in test files.
Revathyvenugopal162 Jun 17, 2022
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
@@ -1,5 +1,5 @@
[flake8]
exclude = venv, __init__.py, doc/_build
exclude = venv, __init__.py, doc/_build, .venv
select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403
count = True
max-complexity = 10
Expand Down
27 changes: 27 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- name: bug
description: Something isn't working
color: d42a34

- name: dependencies
description: Related with project dependencies
color: ffc0cb

- name: documentation
description: Improvements or additions to documentation
color: 0677ba

- name: enhancement
description: New features or code improvements
color: FFD827

- name: good first issue
description: Easy to solve for newcomers
color: 62ca50

- name: maintenance
description: Package and maintenance related
color: f78c37

- name: release
description: Anything related to an incoming release
color: ffffff
94 changes: 52 additions & 42 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,58 @@ on:
branches:
- main

env:
MAIN_PYTHON_VERSION: '3.9'

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

jobs:


style:
name: Style Check
name: Code style
runs-on: ubuntu-latest

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

- name: Install pre-commit
run: |
pip install pre-commit --disable-pip-version-check
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Run pre-commit
- name: Install dependencies
run: |
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
python -m pip install --upgrade pip flit tox
- name: Test with tox
run: tox -e style


main:
name: Build and Testing
tests:
name: Build and testing
runs-on: ubuntu-latest

needs: [style,docs]

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Create wheel
- name: Install dependencies
run: |
pip install wheel
python setup.py bdist_wheel
python -m pip install --upgrade pip flit
python -m pip install -r requirements/requirements_build.txt

- name: Validate wheel
- name: Build wheel and sdist
run: |
pip install twine
twine check dist/*
flit build
python -m twine check dist/*

- name: Install library
run: pip install dist/*
run: pip install .

- name: Login to GitHub Packages
uses: docker/login-action@v1
Expand All @@ -69,8 +77,7 @@ jobs:
cd tests # so we're testing the install, not local
pytest -vx
docker kill pyoptics_speos-rpc
docker rm pyoptics_speos-rpc

docker rm pyoptics_speos-rpc

- name: Upload wheel
uses: actions/upload-artifact@v2
Expand All @@ -80,15 +87,20 @@ jobs:
retention-days: 7

docs:
name: Build Documentation
name: Documentation
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install OS packages
run: |
sudo apt update
sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk

- name: Install library
run: pip install .
Expand All @@ -98,16 +110,14 @@ jobs:
pip install -r requirements/requirements_docs.txt
make -C doc html SPHINXOPTS="-W"

- name: Build PDF Documentation
- name: Generate the PDF documentation
run: |
sudo apt update
sudo apt-get install -y texlive-latex-extra latexmk
make -C doc pdf

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

Expand All @@ -120,7 +130,7 @@ jobs:

Release:
if: contains(github.ref, 'refs/tags')
needs: [main, style, docs]
needs: [tests, style, docs]
runs-on: ubuntu-latest
steps:
- name: Set up Python
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Labeler
on:
pull_request:
push:
branches: [ main ]
paths:
- '../labels.yml'


jobs:

label-syncer:
name: Syncer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

labeler:
name: Set labels
needs: [label-syncer]
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:

# Label based on modified files
- name: Label based on changed files
uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: ''

# Label based on branch name
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation

- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance

- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: |
enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug

commenter:
runs-on: ubuntu-latest
steps:
- name: Suggest to add labels
uses: peter-evans/create-or-update-comment@v2
# Execute only when no labels have been applied to the pull request
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Please add one of the following labels to add this contribution to the Release Notes :point_down:
- [bug](https://github.com/pyansys/pyoptics/pulls?q=label%3Abug+)
- [documentation](https://github.com/pyansys/pyoptics/pulls?q=label%3Adocumentation+)
- [enhancement](https://github.com/pyansys/pyoptics/pulls?q=label%3Aenhancement+)
- [good first issue](https://github.com/pyansys/pyoptics/pulls?q=label%3Agood+first+issue)
- [maintenance](https://github.com/pyansys/pyoptics/pulls?q=label%3Amaintenance+)
- [release](https://github.com/pyansys/pyoptics/pulls?q=label%3Arelease+)
33 changes: 29 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This is an example .gitignore and may need to be adapted per
# project.

# Compiled source #
###################
*.pyc
Expand All @@ -10,7 +7,6 @@
*.so
*.o
*.cache
.pytest_cache/

# OS generated files #
######################
Expand All @@ -29,20 +25,49 @@ _old/
*.egg-info/
build/
dist/
wheels/
wheelhouse/
lib64/
parts/
sdist/
var/
*.egg

# autogenerated docs
_autosummary


# Testing
.coverage
.tox/
*,cover
test-output.xml
.pytest_cache/

\#*
.\#*
/.ipynb_checkpoints
.coverage.*
.cache

# VSCode
.vscode/

# Environment
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Pycharm local settings
.idea/

# temp testing
tmp.out

# Sphinx documentation
doc/_build/
doc/**/_autosummary
14 changes: 9 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,33 @@ exclude: |
^doc/source/
)
repos:


- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args:
- --line-length=120
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: reorder-python-imports
args:
- --py37-plus
- id: isort

- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
args:
- --max-line-length=120

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--ignore-words=ignore_words.txt"]

# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.1.1
# hooks:
Expand Down
Loading