Skip to content

Commit c1fea00

Browse files
committed
build: add script to generate setup.py
1 parent 26e7aaa commit c1fea00

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

Justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ release version:
126126
echo ================ Release Note ================
127127
poetry run python scripts/release-note.py {{hash}}
128128
echo ================ Release Note ================
129+
130+
setuppy:
131+
python scripts/gen-setup.py

scripts/gen-setup.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
5+
# @Date: 2019-12-18
6+
# @Filename: create_setup.py
7+
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
8+
9+
# This is a temporary solution for the fact that pip install . fails with
10+
# poetry when there is no setup.py and an extension needs to be compiled.
11+
# See https://github.com/python-poetry/poetry/issues/1516. Running this
12+
# script creates a setup.py filled out with information generated by
13+
# poetry when parsing the pyproject.toml.
14+
15+
import os
16+
import sys
17+
from distutils.version import StrictVersion
18+
19+
20+
# If there is a global installation of poetry, prefer that.
21+
lib = os.path.expanduser("~/.poetry/lib")
22+
vendors = os.path.join(lib, "poetry", "_vendor")
23+
current_vendors = os.path.join(
24+
vendors, "py{}".format(".".join(str(v) for v in sys.version_info[:2]))
25+
)
26+
27+
sys.path.insert(0, lib)
28+
sys.path.insert(0, current_vendors)
29+
30+
try:
31+
try:
32+
from poetry.core.factory import Factory
33+
from poetry.core.masonry.builders.sdist import SdistBuilder
34+
except (ImportError, ModuleNotFoundError):
35+
from poetry.masonry.builders.sdist import SdistBuilder
36+
from poetry.factory import Factory
37+
from poetry.__version__ import __version__
38+
except (ImportError, ModuleNotFoundError) as ee:
39+
raise ImportError(
40+
"install poetry by doing pip install poetry to use " f"this script: {ee}"
41+
)
42+
43+
44+
# Generate a Poetry object that knows about the metadata in pyproject.toml
45+
factory = Factory()
46+
poetry = factory.create_poetry(os.path.dirname(__file__))
47+
48+
# Use the SdistBuilder to genrate a blob for setup.py
49+
if StrictVersion(__version__) >= StrictVersion("1.1.0b1"):
50+
sdist_builder = SdistBuilder(poetry, None)
51+
else:
52+
sdist_builder = SdistBuilder(poetry, None, None)
53+
54+
setuppy_blob = sdist_builder.build_setup()
55+
56+
with open("setup.py", "wb") as unit:
57+
unit.write(setuppy_blob)
58+
unit.write(b"\n# This setup.py was autogenerated using poetry.\n")
59+

setup.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# -*- coding: utf-8 -*-
2+
from setuptools import setup
3+
4+
packages = \
5+
['dataprep',
6+
'dataprep.assets',
7+
'dataprep.connector',
8+
'dataprep.eda',
9+
'dataprep.eda.basic',
10+
'dataprep.eda.correlation',
11+
'dataprep.eda.create_report',
12+
'dataprep.eda.distribution',
13+
'dataprep.eda.distribution.compute',
14+
'dataprep.eda.missing',
15+
'dataprep.eda.outlier',
16+
'dataprep.tests',
17+
'dataprep.tests.connector',
18+
'dataprep.tests.eda']
19+
20+
package_data = \
21+
{'': ['*'],
22+
'dataprep.eda.create_report': ['templates/*'],
23+
'dataprep.eda.distribution': ['templates/*']}
24+
25+
install_requires = \
26+
['aiohttp>=3.6.2,<4.0.0',
27+
'bokeh>=2.0,<2.1',
28+
'dask[complete]>=2.22,<2.23',
29+
'jinja2>=2.11,<2.12',
30+
'jsonpath-ng>=1.5.1,<2.0.0',
31+
'jsonschema>=3.2,<3.3',
32+
'lxml>=4.5,<4.6',
33+
'nltk>=3.5,<4.0',
34+
'numpy>=1.18,<1.19',
35+
'pandas>=1.0,<1.1',
36+
'pillow>=7.1.2,<8.0.0',
37+
'requests>=2.23,<2.24',
38+
'scipy>=1.4,<1.5',
39+
'tornado==5.0.2',
40+
'tqdm>=4.47.0,<5.0.0',
41+
'wordcloud>=1.7.0,<2.0.0']
42+
43+
setup_kwargs = {
44+
'name': 'dataprep',
45+
'version': '0.2.12',
46+
'description': 'Dataprep: Data Preparation in Python',
47+
'long_description': '<div align="center"><img width="100%" src="https://github.com/sfu-db/dataprep/raw/develop/assets/logo.png"/></div>\n\n-----------------\n<p align="center">\n <a href="LICENSE"><img src="https://img.shields.io/pypi/l/dataprep?style=flat-square"/></a>\n <a href="https://sfu-db.github.io/dataprep/"><img src="https://img.shields.io/badge/dynamic/json?color=blue&label=docs&prefix=v&query=%24.info.version&url=https%3A%2F%2Fpypi.org%2Fpypi%2Fdataprep%2Fjson&style=flat-square"/></a>\n <a href="https://pypi.org/project/dataprep/"><img src="https://img.shields.io/pypi/pyversions/dataprep?style=flat-square"/></a>\n <a href="https://www.codacy.com/gh/sfu-db/dataprep?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=sfu-db/dataprep&amp;utm_campaign=Badge_Coverage"><img src="https://app.codacy.com/project/badge/Coverage/ed658f08dcce4f088c850253475540ba"/></a>\n<!-- <a href="https://codecov.io/gh/sfu-db/dataprep"><img src="https://img.shields.io/codecov/c/github/sfu-db/dataprep?style=flat-square"/></a> -->\n <a href="https://www.codacy.com/gh/sfu-db/dataprep?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=sfu-db/dataprep&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/ed658f08dcce4f088c850253475540ba"/></a>\n <a href="https://discord.gg/xwbkFNk"><img src="https://img.shields.io/discord/702765817154109472?style=flat-square"/></a>\n</p>\n\n\n<p align="center">\n <a href="https://sfu-db.github.io/dataprep/">Documentation</a>\n |\n <a href="https://discord.gg/xwbkFNk">Forum</a>\n | \n <a href="https://groups.google.com/forum/#!forum/dataprep">Mail List</a>\n</p>\n\nDataprep lets you prepare your data using a single library with a few lines of code.\n\nCurrently, you can use `dataprep` to:\n* Collect data from common data sources (through `dataprep.connector`)\n* Do your exploratory data analysis (through `dataprep.eda`)\n* ...more modules are coming\n\n## Releases\n\n<div align="center">\n <table>\n <tr>\n <th>Repo</th>\n <th>Version</th>\n <th>Downloads</th>\n </tr>\n <tr>\n <td>PyPI</td>\n <td><a href="https://pypi.org/project/dataprep/"><img src="https://img.shields.io/pypi/v/dataprep?style=flat-square"/></a></td>\n <td><a href="https://pepy.tech/project/dataprep"><img src="https://pepy.tech/badge/dataprep"/></a></td>\n </tr>\n <tr> \n <td>conda-forge</td>\n <td><a href="https://anaconda.org/conda-forge/dataprep"><img src="https://img.shields.io/conda/vn/conda-forge/dataprep.svg"/></a></td>\n <td><a href="https://anaconda.org/conda-forge/dataprep"><img src="https://img.shields.io/conda/dn/conda-forge/dataprep.svg"/></a></td>\n </tr>\n </table>\n</div>\n\n\n## Installation\n\n```bash\npip install -U dataprep\n```\n\n## Examples & Usages\n\nThe following examples can give you an impression of what dataprep can do:\n\n* [Documentation: Connector](https://sfu-db.github.io/dataprep/user_guide/connector/connector.html)\n* [Documentation: EDA](https://sfu-db.github.io/dataprep/user_guide/eda/introduction.html)\n* [EDA Case Study: Titanic](https://sfu-db.github.io/dataprep/user_guide/eda/titanic.html)\n* [EDA Case Study: House Price](https://sfu-db.github.io/dataprep/user_guide/eda/house_price.html)\n\n### EDA\n\nThere are common tasks during the exploratory data analysis stage, \nlike a quick look at the columnar distribution, or understanding the correlations\nbetween columns. \n\nThe EDA module categorizes these EDA tasks into functions helping you finish EDA\ntasks with a single function call.\n\n* Want to understand the distributions for each DataFrame column? Use `plot`.\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot.html#Get-an-overview-of-the-dataset-with-plot(df)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot(df).gif"/></a>\n\n* Want to understand the correlation between columns? Use `plot_correlation`.\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot_correlation.html#Get-an-overview-of-the-correlations-with-plot_correlation(df)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot_correlation(df).gif"/></a>\n\n* Or, if you want to understand the impact of the missing values for each column, use `plot_missing`.\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot_missing.html#Get-an-overview-of-the-missing-values-with-plot_missing(df)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot_missing(df).gif"/></a>\n\nYou can drill down to get more information by given `plot`, `plot_correlation` and `plot_missing` a column name.: E.g. for `plot_missing`\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot_missing.html#Understand-the-impact-of-the-missing-values-in-column-x-with-plot_missing(df,-x)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot_missing(df, x).gif"/></a>\n\n&nbsp;&nbsp;&nbsp;&nbsp;for numerical column using`plot`:\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot.html#Understand-a-column-with-plot(df,-x)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot(df,x)_num.gif"/></a>\n\n&nbsp;&nbsp;&nbsp;&nbsp;for categorical column using`plot`:\n\n<a href="https://sfu-db.github.io/dataprep/user_guide/eda/plot.html#Understand-a-column-with-plot(df,-x)"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/plot(df,x)_cat.gif"/></a>\n\nDon\'t forget to checkout the [examples] folder for detailed demonstration!\n\n### Connector\n\nConnector provides a simple way to collect data from different websites, offering several benefits:\n* A unified API: you can fetch data using one or two lines of code to get data from many websites.\n* Auto Pagination: it automatically does the pagination for you so that you can specify the desired count of the returned results without even considering the count-per-request restriction from the API.\n* Smart API request strategy: it can issue API requests in parallel while respecting the rate limit policy.\n\nIn the following examples, you can download the Yelp business search result into a pandas DataFrame, \nusing only two lines of code, without taking deep looking into the Yelp documentation!\nMore examples can be found here:\n[Examples](https://github.com/sfu-db/dataprep/tree/develop/examples)\n\n<center><a href="https://sfu-db.github.io/dataprep/connector.html#getting-web-data-with-connector-query"><img src="https://github.com/sfu-db/dataprep/raw/develop/assets/connector.png"/></a></center>\n\n\n## Contribute\n\nThere are many ways to contribute to Dataprep.\n\n* Submit bugs and help us verify fixes as they are checked in.\n* Review the source code changes.\n* Engage with other Dataprep users and developers on StackOverflow.\n* Help each other in the [Dataprep Community Discord](https://discord.gg/xwbkFNk) and [Mail list & Forum].\n* [![Twitter]](https://twitter.com/sfu_db)\n* Contribute bug fixes.\n* Providing use cases and writing down your user experience.\n\nPlease take a look at our [wiki] for development documentations!\n\n\n[Build Status]: https://img.shields.io/circleci/build/github/sfu-db/dataprep/master?style=flat-square&token=f68e38757f5c98771f46d1c7e700f285a0b9784d\n[Mail list & Forum]: https://groups.google.com/forum/#!forum/dataprep\n[wiki]: https://github.com/sfu-db/dataprep/wiki\n[examples]: https://github.com/sfu-db/dataprep/tree/master/examples\n[Twitter]: https://img.shields.io/twitter/follow/sfu_db?style=social\n',
48+
'author': 'SFU Database System Lab',
49+
'author_email': 'dsl.cs.sfu@gmail.com',
50+
'maintainer': 'Weiyuan Wu',
51+
'maintainer_email': 'youngw@sfu.com',
52+
'url': 'https://github.com/sfu-db/dataprep',
53+
'packages': packages,
54+
'package_data': package_data,
55+
'install_requires': install_requires,
56+
'python_requires': '>=3.6.1,<4.0.0',
57+
}
58+
59+
60+
setup(**setup_kwargs)
61+
62+
# This setup.py was autogenerated using poetry.

0 commit comments

Comments
 (0)