Skip to content
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: GitHub CI

# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
push:
tags:
- "*"
branches:
- main

env:
MAIN_PYTHON_VERSION: "3.10"
PACKAGE_NAME: "ansys.api.additive"
DEFINITION_VERSION: "v0"

jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

# Uncomment once the proto files are stable enough on their side

# - name: Run protolint
# uses: plexsystems/[email protected]
# with:
# configDirectory: .

- name: Install build requirements
run: |
pip install -U pip
pip install build

- name: Build
run: python -m build

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

- name: Test import
run: |
mkdir tmp
cd tmp
python -c "import ${{ env.PACKAGE_NAME }}.${{ env.DEFINITION_VERSION }}; print('Sucessfully imported ${{ env.PACKAGE_NAME}}.${{ env.DEFINITION_VERSION }}')"
python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)"

- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: ansys-api-additive-packages
path: dist/
retention-days: 7

Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- uses: actions/download-artifact@v3

- name: Display structure of downloaded files
run: ls -R

# uncomment the following section to permit upload to public PyPI

# - name: Upload to Public PyPi
# run: |
# pip install twine
# twine upload --skip-existing ./**/*.whl
# twine upload --skip-existing ./**/*.tar.gz
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Upload to Private PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: PAT
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload

- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.tar.gz
./**/*.pdf
52 changes: 0 additions & 52 deletions .github/workflows/pages.yml

This file was deleted.

41 changes: 38 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
_site/
.jekyll-cache/
.jekyll-metadata
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Virtual environment
venv

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# emacs temp files
*~

# VSCode settings
.vscode

# autogenerated Python code
*pb2*.py
*pb2*.pyi
36 changes: 36 additions & 0 deletions .protolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Lint directives. Documentation:
# https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml
lint:
# Linter directories to walk.
directories:
exclude:
- codegen
- doc
- tests

rules:
# Use default rules
all_default: true

# - Proto files are not fully documented.
# - Many repeated messages are not properly pluralized
# - Enum fields are not properly prefixed with the enum name
# - Enum fields with 0 value are not suffixed UNSPECIFIED
# - Prepositions should be exluded from message and field names
remove:
- MESSAGES_HAVE_COMMENT
- SERVICES_HAVE_COMMENT
- RPCS_HAVE_COMMENT
- FIELDS_HAVE_COMMENT
- ENUMS_HAVE_COMMENT
- ENUM_FIELDS_HAVE_COMMENT
- REPEATED_FIELD_NAMES_PLURALIZED
- ENUM_FIELD_NAMES_PREFIX
- ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
- MESSAGE_NAMES_EXCLUDE_PREPOSITIONS
- FIELD_NAMES_EXCLUDE_PREPOSITIONS

# Linter rules option.
rules_option:
max_line_length:
max_chars: 120
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
# ansys-gh-pages-template
### ansys-api-additive gRPC Interface Package

This repo is a simple template using
[jekyll-theme-corp](https://github.com/ansys/jekyll-theme-corp) to demonstrate how to generate a GitHub hosted website using the new [Publishing with a custom GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow). This approach does not require you to create and deploy from a `gh-pages` branch and simplifies building a GitHub Page.
This Python package contains the auto-generated gRPC Python interface files for
Additive.

### Usage
#### Installation

You can use this template by:
Provided that these wheels have been published to public PyPI, they can be
installed with:

1. Creating a [New](https://github.com/organizations/ansys/repositories/new) repository within the [github.com/ansys](https://github.com/ansys) organization.
2. Add more content by modifying the existing markdown files and expanding it by following the following documentation:
```
pip install ansys-api-additive
```

- [Jekyll - Markdown Guide](https://www.markdownguide.org/tools/jekyll/)
- [Jekyll-Markdown-Cheat-Sheet](https://itopaloglu83.github.io/Jekyll-Markdown-Cheat-Sheet/)
- [About GitHub Pages and Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll)
#### Build

To build the gRPC packages, run:

```
pip install build
python -m build
```

This will create both the source distribution containing just the protofiles
along with the wheel containing the protofiles and build Python interface
files.

#### Manual Deployment

After building the packages, manually deploy them with:

```
pip install twine
twine upload dist/*
```

Note that this is automatically done through CI/CD.

#### Automatic Deployment

This repository contains GitHub CI/CD that enables the automatic building of
source and wheel packages for these gRPC Python interface files. By default,
these are built on PRs, the main branch, and on tags when pushing. Artifacts
are uploaded for each PR.

To publicly release wheels to PyPI, ensure your branch is up-to-date and then
push tags. For example, for the version ``v0.5.0``.

```bash
git tag v0.5.0
git push --tags
```
8 changes: 0 additions & 8 deletions _config.yml

This file was deleted.

34 changes: 0 additions & 34 deletions another-page.md

This file was deleted.

1 change: 1 addition & 0 deletions ansys/api/additive/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
8 changes: 8 additions & 0 deletions ansys/api/additive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Autogenerated Python gRPC interface package for ansys-api-additive."""

import pathlib

__all__ = ["__version__"]

with open(pathlib.Path(__file__).parent / "VERSION", encoding="utf-8") as f:
__version__ = f.read().strip()
Empty file added ansys/api/additive/py.typed
Empty file.
Loading