Repository navigation
1 of 3: Build a graphframes Python package during the build process
#512
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
Changes from 40 commits
f4e9cdb
c256244
6c3df0b
b2838d2
caf5091
7cfa2d1
2ca9a15
a8bf0be
54a942d
8b0e346
46c2b93
18b5da0
8eca097
277c06f
b55ee48
f8a8fd9
bc2cb36
728be33
3cea1a8
87cc975
6f84a5a
9a8eef0
75ecd99
80231d0
2a9170b
3de2263
4662717
1b7b9f8
58da493
9f4aa24
11b2782
9772344
d55dbfe
2fc4d08
8297a13
2035d98
f9f4bd7
9ddd6b2
7065647
a6c7e91
51e3e6d
272be06
4587999
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,12 +31,14 @@ jobs: | |
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install python dependencies | ||
| - name: Build Python package and its dependencies | ||
| working-directory: ./python | ||
| run: | | ||
| python -m pip install --upgrade pip wheel | ||
| pip install -r ./python/requirements.txt | ||
| pip install pyspark==${{ matrix.spark-version }} | ||
| python -m pip install --upgrade poetry | ||
| poetry build | ||
| poetry install | ||
| - name: Test | ||
| working-directory: ./python | ||
| run: | | ||
| export SPARK_HOME=$(python -c "import os; from importlib.util import find_spec; print(os.path.join(os.path.dirname(find_spec('pyspark').origin)))") | ||
| ./python/run-tests.sh | ||
| export SPARK_HOME=$(poetry run python -c "import os; from importlib.util import find_spec; spec = find_spec('pyspark'); print(os.path.join(os.path.dirname(spec.origin)))") | ||
|
Collaborator
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. Why do we need it? Tests will work even without SPARK_HOME |
||
| ./run-tests.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # GraphFrames `graphframes-py` Python Package | ||
|
|
||
| The is the officila [graphframes-py PyPI package](https://pypi.org/project/graphframes-py/), which is a Python wrapper for the Scala GraphFrames library. This package is maintained by the GraphFrames project and is available on PyPI. | ||
|
|
||
| For instructions on GraphFrames, check the project [../README.md](../README.md). See [Installation and Quick-Start](#installation-and-quick-start) for the best way to install and use GraphFrames. | ||
|
|
||
| ## Running `graphframes-py` | ||
|
|
||
| You should use GraphFrames via the `--packages` argument to `pyspark` or `spark-submit`, but this package is helpful in development environments. | ||
|
|
||
| ```bash | ||
| # Interactive Python | ||
| $ pyspark --packages graphframes:graphframes:0.8.4-spark3.5-s_2.12 | ||
|
|
||
| # Submit a script in Scala/Java/Python | ||
| $ spark-submit --packages graphframes:graphframes:0.8.4-spark3.5-s_2.12 script.py | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0.8.4 |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| [tool.poetry] | ||
| name = "graphframes-py" | ||
| version = "0.8.4" | ||
|
Collaborator
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. Let's use something like this: https://pypi.org/project/poetry-dynamic-versioning/? |
||
| description = "GraphFrames: Graph Processing Framework for Apache Spark" | ||
| authors = ["GraphFrames Contributors <graphframes@googlegroups.com>"] | ||
| license = "Apache 2.0" | ||
| readme = "README.md" | ||
| packages = [{include = "graphframes"}] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "License :: OSI Approved :: Apache Software License", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12" | ||
| ] | ||
|
|
||
| [tool.poetry.urls] | ||
| "Project Homepage" = "https://graphframes.github.io/graphframes" | ||
| "PyPi Homepage" = "https://pypi.org/project/graphframes-py" | ||
| "Code Repository" = "https://github.com/graphframes/graphframes" | ||
| "Bug Tracker" = "https://github.com/graphframes/graphframes/issues" | ||
|
|
||
| [tool.poetry.dependencies] | ||
| python = ">=3.9 <3.13" | ||
| nose = "1.3.7" | ||
| pyspark = "^3.4" | ||
| numpy = ">= 1.7" | ||
|
|
||
| [tool.poetry.group.dev.dependencies] | ||
| black = "^25.1.0" | ||
| flake8 = "^7.1.1" | ||
| isort = "^6.0.0" | ||
|
Collaborator
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. It looks like |
||
|
|
||
| [build-system] | ||
| requires = ["poetry-core"] | ||
| build-backend = "poetry.core.masonry.api" | ||
|
|
||
| [tool.black] | ||
| line-length = 100 | ||
| target-version = ["py39"] | ||
| include = ["graphframes"] | ||
|
|
||
| [tool.isort] | ||
| profile = "black" | ||
| src_paths = ["graphframes"] | ||
This file was deleted.
|
Collaborator
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. Why not to use pyproject.toml instead? It seems to me that
Collaborator
Author
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. @SemyonSinchenko Because setup.py is already there and I needed to wrap this quickly so I could see the
Collaborator
Author
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. @SemyonSinchenko okay, if I need extras I am going to poetrize it.
Collaborator
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. @rjurney I did not mean moving to poetry! To be honest I was expecting that you leave setup.py as is and just move the package metadata to the pyproject file with backend "setuptools"... Are you 100% sure that we should use poetry here?
Collaborator
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.
Contributor
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. apache spark does not use poetry, but there are some mails about the project python build at @dev
Collaborator
Author
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. Ah, thank you. I did not think about it. I do think we should try to use poetry, and deal with the merge when we merge... I don't want to rewrite this again. Poetry is 100% cleaner than the setup.py/cfg method I was just using. It was very easy, just got to fix CI. Is is also easy to publish to PyPi.
Collaborator
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. My opinion is that if we are moving to a new tool we should move to
Contributor
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. +1 for uv
Collaborator
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. Ok, let's continue with poetry. |
This file was deleted.
This file was deleted.
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 recommend to use action instead.