-
Notifications
You must be signed in to change notification settings - Fork 9
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
Rebasing Yuvi's setup_py
branch with main
#110
Draft
norlandrhagen
wants to merge
7
commits into
pangeo-forge:main
Choose a base branch
from
norlandrhagen:setup_py
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
46935d8
Create a setup.py file before submitting flink job
yuvipanda 400d9aa
Use configured setup.py
yuvipanda ebe1505
merge w/ main
norlandrhagen 12f3b33
testing
norlandrhagen 5b7c535
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b57a10c
typo & pre-commit
norlandrhagen 5046180
Merge branch 'setup_py' of https://github.com/norlandrhagen/pangeo-fo…
norlandrhagen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import ast | ||
import os | ||
from contextlib import contextmanager | ||
from copy import deepcopy | ||
from pathlib import Path | ||
from textwrap import dedent | ||
from typing import Optional | ||
|
||
from ruamel.yaml import YAML | ||
|
@@ -86,6 +89,44 @@ def parse_recipes(self): | |
|
||
return recipes | ||
|
||
@contextmanager | ||
def generate_setup_py(self): | ||
""" | ||
Auto-generate a setup.py file for use with apache beam. | ||
|
||
Beam sends all the user code we need to workers by creating an | ||
sdist off a python package. However, our feedstocks only have a | ||
few python files (at best) - mostly just one (recipe.py). We do not | ||
want to impose creating a setup.py file manually for all our users, | ||
so instead we autogenerate one here. | ||
""" | ||
file = dedent( | ||
""" | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name='recipe', | ||
version='0.1', | ||
# FIXME: Support all the files we need to here! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixme is basically the important part - it should contain all the files we wanna package and send into the runner. |
||
py_modules=["recipe"] | ||
) | ||
""" | ||
) | ||
|
||
setup_path = self.feedstock_dir / "setup.py" | ||
with open(setup_path, "w") as f: | ||
f.write(file) | ||
|
||
readme_path = self.feedstock_dir / "readme.md" | ||
|
||
with open(readme_path, "w") as f: | ||
f.write("") | ||
|
||
try: | ||
yield str(setup_path) | ||
finally: | ||
os.remove(setup_path) | ||
|
||
def get_expanded_meta(self): | ||
""" | ||
Return full meta.yaml file, expanding recipes if needed. | ||
|
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest moving this template out into its own file.
This generation also needs to be watched closely for code injection based attacks.