Skip to content

Commit 1d32d2a

Browse files
feat: transfer current aliases from recipes to this separate repo
1 parent 9e49a74 commit 1d32d2a

File tree

14 files changed

+177
-1
lines changed

14 files changed

+177
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: CI
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
deploy:
8+
name: Deploy to GitHub and PyPI
9+
runs-on: ubuntu-latest
10+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'pollination'
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.7
17+
- name: set up node # we need node for for semantic release
18+
uses: actions/setup-node@v2.1.2
19+
with:
20+
node-version: 14.2.0
21+
- name: install python dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
pip install -r dev-requirements.txt
26+
- name: install semantic-release
27+
run:
28+
npm install @semantic-release/exec
29+
- name: run semantic release
30+
run:
31+
npx semantic-release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
PYPI_USERNAME: ${{ secrets.POLLINATION_PYPI_USERNAME }}
35+
PYPI_PASSWORD: ${{ secrets.POLLINATION_PYPI_PASSWORD }}

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.pyc
2+
test.py
3+
.pytest_cache
4+
*__pycache__
5+
.coverage
6+
*.ipynb
7+
.ipynb_checkpoints
8+
.tox
9+
*.egg-info
10+
tox.ini
11+
/.cache
12+
/.vscode
13+
.eggs
14+
*.code-workspace
15+
16+
venv
17+
test.py
18+
dist/
19+
build/

.releaserc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"plugins": [
3+
"@semantic-release/commit-analyzer",
4+
"@semantic-release/release-notes-generator",
5+
"@semantic-release/github",
6+
["@semantic-release/exec", {
7+
"publishCmd": "bash deploy.sh ${nextRelease.version}"
8+
}]
9+
]
10+
}

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# pollination-alias
2-
A collection of aliases for Pollination recipes.
2+
A collection of input and output aliases for Pollination recipes.
3+
4+
# Installation
5+
`pip install pollination-alias`
6+
7+
# Usage
8+
`import pollination.alias as pa`

deploy.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
echo "Building distribution"
4+
python setup.py sdist bdist_wheel
5+
echo "Pushing new version to PyPi"
6+
twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD

dev-requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
twine==3.3.0
2+
wheel==0.36.2
3+
setuptools==53.0.0

pollination/alias/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Collection of input and output aliases for Pollination recipes."""

pollination/alias/inputs/__init__.py

Whitespace-only changes.

pollination/alias/inputs/model.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from pollination_dsl.alias import InputAlias
2+
from queenbee.io.common import IOAliasHandler
3+
4+
5+
"""Alias input for inputs that expect a HBJSON model file as the inputs."""
6+
hbjson_model_input = [
7+
# grasshopper Alias
8+
InputAlias.any(
9+
name='model',
10+
description='A path to a HBJSON file or a HB model object built with Python or'
11+
'dotnet libraries.',
12+
platform=['grasshopper'],
13+
handler=[
14+
IOAliasHandler(
15+
language='python', module='pollination_handlers.inputs.model',
16+
function='model_to_json'
17+
),
18+
IOAliasHandler(
19+
language='csharp', module='HoneybeeSchema.Handlers',
20+
function='HBModelToJSON'
21+
)
22+
]
23+
),
24+
# Rhino alias
25+
InputAlias.linked(
26+
name='model',
27+
description='This input links the model to Rhino model.',
28+
platform=['rhino'],
29+
handler=[
30+
IOAliasHandler(
31+
language='csharp', module='HoneybeeRhino.Handlers',
32+
function='RhinoHBModelToJSON'
33+
)
34+
]
35+
)
36+
]

pollination/alias/outputs/__init__.py

Whitespace-only changes.

pollination/alias/outputs/daylight.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from pollination_dsl.alias import OutputAlias
2+
from queenbee.io.common import IOAliasHandler
3+
4+
5+
"""Daylight factor recipe output.
6+
7+
The results are separated by line and the numbers cannot be more than 100.
8+
"""
9+
parse_daylight_factor_results = [
10+
OutputAlias.any(
11+
name='daylight_factor',
12+
description='Daylight factor values.',
13+
platform=['grasshopper'],
14+
handler=[
15+
IOAliasHandler(
16+
language='python',
17+
module='pollination_handlers.outputs.read_file',
18+
function='read_DF_from_path'
19+
)
20+
]
21+
)
22+
]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pollination_dsl

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[bdist_wheel]
2+
universal = 1
3+
4+
[metadata]
5+
license_file = LICENSE

setup.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import setuptools
2+
3+
with open('requirements.txt') as f:
4+
requirements = f.read().splitlines()
5+
6+
with open('README.md') as fh:
7+
long_description = fh.read()
8+
9+
setuptools.setup(
10+
name="pollination-alias",
11+
use_scm_version=True,
12+
setup_requires=['setuptools_scm'],
13+
author="Pollination",
14+
author_email="info@pollination.cloud",
15+
packages=setuptools.find_namespace_packages(
16+
include=['pollination.*'], exclude=['tests']
17+
),
18+
install_requires=requirements,
19+
description="Collection of alias inputs and outputs for Pollination recipes.",
20+
long_description=long_description,
21+
long_description_content_type="text/markdown",
22+
url="https://github.com/pollination/pollination-alias",
23+
include_package_data=True,
24+
classifiers=[
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: Implementation :: CPython",
27+
"Operating System :: OS Independent",
28+
"License :: OSI Approved :: Apache Software License"
29+
],
30+
license="Apache-2.0 License",
31+
zip_safe=False
32+
)

0 commit comments

Comments
 (0)