Skip to content

Commit 274c194

Browse files
committed
[Core] Initial Commit
Create a template repository for python manager plugins. This should drastically cut down the work required to startup a new python manager, and avoid re-arbitrating lint/CI/deployment paradigms. Signed-off-by: Elliot Morris <[email protected]>
0 parents  commit 274c194

16 files changed

+1157
-0
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/" # See docs, they say not to use '.github'
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "[CI]"

.github/workflows/build-wheels.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build Wheels
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
pull_request:
9+
10+
concurrency:
11+
# Shared with `deploy-pypi`.
12+
group: wheel-${{ github.ref }}
13+
# Cancel any in-progress build or publish.
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build_wheels:
18+
name: Build wheel
19+
runs-on: ubuntu-20.04
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.9"
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install setuptools wheel
33+
- name: Build wheels
34+
run: pip wheel --no-deps --wheel-dir wheelhouse .
35+
36+
- uses: actions/upload-artifact@v3
37+
with:
38+
name: my_asset_manager_wheels
39+
path: ./wheelhouse/*.whl

.github/workflows/code-quality.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Code quality
2+
on: pull_request
3+
4+
jobs:
5+
pylint:
6+
runs-on: ubuntu-latest
7+
name: Pylint
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- name: Set up Python
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: 3.9
15+
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install .
19+
python -m pip install -r tests/requirements.txt
20+
- name: Lint
21+
uses: TheFoundryVisionmongers/[email protected]
22+
with:
23+
pylint-rcfile: "./pyproject.toml"
24+
pylint-paths: >
25+
plugin
26+
tests
27+
28+
black:
29+
runs-on: ubuntu-latest
30+
name: Python formatting
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: 3.9
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install black
42+
43+
- name: Check Python formatting
44+
run: black --check .

.github/workflows/deploy-pypi.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy PyPI
2+
3+
concurrency:
4+
# Shared with `build-wheels`.
5+
group: wheel-${{ github.ref }}
6+
# Allow `build-wheels` to finish.
7+
cancel-in-progress: false
8+
9+
on:
10+
release:
11+
types: [published]
12+
workflow_dispatch:
13+
14+
jobs:
15+
publish_testpypi:
16+
name: Publish distribution 📦 to TestPyPI
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- name: Download wheels from commit ${{ github.sha }}
20+
uses: dawidd6/action-download-artifact@v2
21+
with:
22+
workflow: build-wheels.yml
23+
workflow_conclusion: success
24+
commit: ${{ github.sha }}
25+
name: my_asset_manager_wheels
26+
path: dist
27+
28+
- name: Upload to TestPyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
user: __token__
32+
password: ${{ secrets.TEST_PYPI_ACCESS_TOKEN }}
33+
repository_url: https://test.pypi.org/legacy/
34+
35+
publish_pypi:
36+
name: Publish distribution 📦 to PyPI
37+
needs: publish_testpypi
38+
runs-on: ubuntu-20.04
39+
steps:
40+
- name: Download wheels from commit ${{ github.sha }}
41+
uses: dawidd6/action-download-artifact@v2
42+
with:
43+
workflow: build-wheels.yml
44+
workflow_conclusion: success
45+
commit: ${{ github.sha }}
46+
name: my_asset_manager_wheels
47+
path: dist
48+
49+
- name: Upload to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
user: __token__
53+
password: ${{ secrets.PYPI_ACCESS_TOKEN }}

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Runs pytest on the matrix of supported platforms any Python versions.
2+
name: Test
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
# You may remove this test, this merely assures that the template
8+
# works when you find-and-replace the MyAssetManager strings.
9+
test_project_rename:
10+
name: Project Rename
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.9"
17+
- run: |
18+
grep -RIl 'MyAssetManager' | xargs sed -i 's/MyAssetManager/RenamedAssetManager/g'
19+
grep -RIl 'my_asset_manager' | xargs sed -i 's/my_asset_manager/renamed_asset_manager/g'
20+
grep -RIl 'My Asset Manager' | xargs sed -i 's/My Asset Manager/Renamed Asset Manager/g'
21+
grep -RIl 'myorg' | xargs sed -i 's/myorg/renamedorg/g'
22+
mv plugin/my_asset_manager/MyAssetManagerInterface.py \
23+
plugin/my_asset_manager/RenamedAssetManagerInterface.py
24+
mv plugin/my_asset_manager plugin/renamed_asset_manager
25+
python -m pip install .
26+
python -m pip install -r tests/requirements.txt
27+
python -m pytest -v ./tests
28+
29+
test:
30+
name: ${{ matrix.os }} ${{ matrix.python }}
31+
runs-on: ${{ matrix.os }}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: ["windows-latest", "ubuntu-latest", "macos-latest"]
36+
python: ["3.7", "3.9", "3.10"]
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: actions/setup-python@v4
40+
with:
41+
python-version: ${{ matrix.python }}
42+
- run: |
43+
python -m pip install .
44+
python -m pip install -r tests/requirements.txt
45+
python -m pytest -v ./tests

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

0 commit comments

Comments
 (0)