Skip to content

Commit a431842

Browse files
author
Eduardo Rodrigues
committed
initial commit
0 parents  commit a431842

File tree

8 files changed

+357
-0
lines changed

8 files changed

+357
-0
lines changed

.coveragerc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
fail_under = 100

.gitignore

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
# pyenv
84+
.python-version
85+
86+
# pipenv
87+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
89+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
90+
# install all needed dependencies.
91+
#Pipfile.lock
92+
93+
# celery beat schedule file
94+
celerybeat-schedule
95+
96+
# SageMath parsed files
97+
*.sage.py
98+
99+
# Environments
100+
.env
101+
.venv
102+
env/
103+
venv/
104+
ENV/
105+
env.bak/
106+
venv.bak/
107+
108+
# Spyder project settings
109+
.spyderproject
110+
.spyproject
111+
112+
# Rope project settings
113+
.ropeproject
114+
115+
# mkdocs documentation
116+
/site
117+
118+
# mypy
119+
.mypy_cache/
120+
.dmypy.json
121+
dmypy.json
122+
123+
# Pyre type checker
124+
.pyre/
125+
126+
.DS_Store
127+
.idea/
128+
.vscode/
129+
*.tar.gz
130+
131+
# We want to allow the tests/lib folder
132+
!tests/lib
133+
134+
# Node.js
135+
node_modules/
136+
coverage/

.pylintrc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[MASTER]
2+
3+
ignore=CVS,models.py,handlers.py
4+
jobs=1
5+
persistent=yes
6+
7+
[MESSAGES CONTROL]
8+
9+
disable=
10+
missing-docstring, # not everything needs a docstring
11+
fixme, # work in progress
12+
bad-continuation, # clashes with black
13+
too-few-public-methods, # triggers when inheriting
14+
ungrouped-imports, # clashes with isort
15+
duplicate-code, # broken, setup.py
16+
17+
[BASIC]
18+
19+
good-names=e,ex,f,fp,i,j,k,n,_
20+
21+
[FORMAT]
22+
23+
indent-string=' '
24+
max-line-length=88

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Eduardo Rodrigues
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include README.md
2+
include LICENSE
3+
4+
graft python/rpdk/typescript
5+
6+
# last rule wins, put excludes last
7+
global-exclude __pycache__ *.py[co] .DS_Store

README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# DEVELOPER PREVIEW (COMMUNITY DRIVEN)
2+
3+
We're excited to share our progress with adding new languages to the CloudFormation CLI! This plugin is an early preview prepared by the community, and not ready for production use.
4+
5+
## AWS CloudFormation Resource Provider TypeScript Plugin
6+
7+
The CloudFormation CLI (cfn) allows you to author your own resource providers that can be used by CloudFormation.
8+
9+
This plugin library helps to provide TypeScript runtime bindings for the execution of your providers by CloudFormation.
10+
11+
Usage
12+
-----
13+
14+
If you are using this package to build resource providers for CloudFormation, install the [CloudFormation CLI TypeScript Plugin](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin) - this will automatically install the the [CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli)! A Python virtual environment is recommended.
15+
16+
**Prerequisites**
17+
18+
- Python version 3.6 or above
19+
- Your choice of TypeScript IDE
20+
21+
**Installation**
22+
23+
```shell
24+
pip3 install git+https://github.com/eduardomourar/cloudformation-cli-typescript-plugin.git#egg=cloudformation-cli-typescript-plugin
25+
```
26+
27+
Refer to the [CloudFormation CLI User Guide](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-types.html) for the [CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli) for usage instructions.
28+
29+
30+
Development
31+
-----------
32+
33+
For changes to the plugin, a Python virtual environment is recommended. Check out and install the plugin in editable mode:
34+
35+
```shell
36+
python3 -m venv env
37+
source env/bin/activate
38+
pip3 install -e /path/to/cloudformation-cli-typescript-plugin
39+
```
40+
41+
You may also want to check out the [CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli) if you wish to make edits to that. In this case, installing them in one operation works well:
42+
43+
```shell
44+
pip3 install \
45+
-e /path/to/cloudformation-cli \
46+
-e /path/to/cloudformation-cli-typescript-plugin
47+
```
48+
49+
That ensures neither is accidentally installed from PyPI.
50+
51+
Linting and running unit tests is done via [pre-commit](https://pre-commit.com/), and so is performed automatically on commit after being installed (`pre-commit install`). The continuous integration also runs these checks. Manual options are available so you don't have to commit:
52+
53+
```shell
54+
# run all hooks on all files, mirrors what the CI runs
55+
pre-commit run --all-files
56+
# run unit tests only. can also be used for other hooks, e.g. black, flake8, pylint-local
57+
pre-commit run pytest-local
58+
```
59+
60+
License
61+
-------
62+
63+
This library is licensed under the MIT License.

setup.cfg

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[metadata]
2+
license_file = LICENSE
3+
description-file = README.md
4+
5+
[flake8]
6+
exclude =
7+
.git,
8+
__pycache__,
9+
build,
10+
dist,
11+
*.pyc,
12+
*.egg-info,
13+
.cache,
14+
.eggs,
15+
.tox
16+
max-complexity = 10
17+
max-line-length = 88
18+
select = C,E,F,W,B,B950
19+
# C812, C815, W503 clash with black, F723 false positive
20+
ignore = E501,C812,C815,C816,W503,F723
21+
22+
[isort]
23+
line_length = 88
24+
indent = ' '
25+
multi_line_output = 3
26+
default_section = FIRSTPARTY
27+
skip = env
28+
include_trailing_comma = true
29+
combine_as_imports = True
30+
force_grid_wrap = 0
31+
known_first_party = rpdk
32+
known_third_party = boto3,botocore,jinja2,jsonschema,werkzeug,yaml,requests
33+
34+
[tool:pytest]
35+
# can't do anything about 3rd party modules, so don't spam us
36+
filterwarnings =
37+
ignore::DeprecationWarning:botocore
38+
ignore::DeprecationWarning:werkzeug
39+
ignore::DeprecationWarning:yaml
40+
41+
[mypy-setuptools] # don't want to stub external libraries for now
42+
ignore_missing_imports = True

setup.py

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python
2+
"""Typescript language support for the CloudFormation CLI"""
3+
import os.path
4+
import re
5+
6+
from setuptools import setup
7+
8+
HERE = os.path.abspath(os.path.dirname(__file__))
9+
10+
11+
def read(*parts):
12+
with open(os.path.join(HERE, *parts), "r", encoding="utf-8") as fp:
13+
return fp.read()
14+
15+
16+
# https://packaging.python.org/guides/single-sourcing-package-version/
17+
def find_version(*file_paths):
18+
version_file = read(*file_paths)
19+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
20+
if version_match:
21+
return version_match.group(1)
22+
raise RuntimeError("Unable to find version string.")
23+
24+
25+
setup(
26+
name="cloudformation-cli-typescript-plugin",
27+
version=find_version("python", "rpdk", "typescript", "__init__.py"),
28+
description=__doc__,
29+
long_description=read("README.md"),
30+
author="eduardomourar",
31+
url="https://github.com/eduardomourar/cloudformation-cli-typescript-plugin",
32+
packages=["rpdk.typescript"],
33+
package_dir={"": "python"},
34+
# package_data -> use MANIFEST.in instead
35+
include_package_data=True,
36+
zip_safe=True,
37+
python_requires=">=3.6",
38+
install_requires=["cloudformation-cli>=0.1,<0.2", "docker>=3.7,<3.8"],
39+
entry_points={
40+
"rpdk.v1.languages": [
41+
"typescript = rpdk.typescript.codegen:TypescriptLanguagePlugin",
42+
]
43+
},
44+
license="MIT",
45+
classifiers=[
46+
"Development Status :: 2 - Pre-Alpha",
47+
"Environment :: Console",
48+
"Intended Audience :: Developers",
49+
"License :: OSI Approved :: MIT/X Consortium License",
50+
"Natural Language :: English",
51+
"Topic :: Software Development :: Build Tools",
52+
"Topic :: Software Development :: Code Generators",
53+
"Operating System :: OS Independent",
54+
"Programming Language :: Python :: 3 :: Only",
55+
"Programming Language :: Python :: 3.6",
56+
"Programming Language :: Python :: 3.7",
57+
],
58+
keywords="Amazon Web Services AWS CloudFormation",
59+
)

0 commit comments

Comments
 (0)