-
Notifications
You must be signed in to change notification settings - Fork 26
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
Transition from using setup.py to pyproject.toml to specify project metadata #766
Merged
+218
−600
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1ecc642
define pyproject
R-Palazzo 3968751
update makefile
R-Palazzo daf4b16
update setup.cfg
R-Palazzo f917d62
update tasks.py
R-Palazzo ebe6595
update readme workflow
R-Palazzo dcc5b1a
delete setup.py
R-Palazzo ff78bd5
remove pytest-runner
R-Palazzo 1125b2c
import sys in tasks.py
R-Palazzo a13b6b5
remove addons structure
R-Palazzo 0827a48
remove _get_addon_target
R-Palazzo 5d8814a
lint
R-Palazzo 88fa832
scikit learn dependency
R-Palazzo f332d2d
fix enterprise add-ons
R-Palazzo 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 |
---|---|---|
@@ -0,0 +1,138 @@ | ||
[build-system] | ||
requires = ['setuptools', 'wheel'] | ||
build-backend = 'setuptools.build_meta' | ||
|
||
[project] | ||
name = 'rdt' | ||
description = 'Reversible Data Transforms' | ||
authors = [{ name = 'DataCebo, Inc.', email = '[email protected]' }] | ||
classifiers = [ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'License :: Free for non-commercial use', | ||
'Natural Language :: English', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Topic :: Scientific/Engineering :: Artificial Intelligence', | ||
] | ||
keywords = ['machine learning', 'synthetic data generation', 'benchmark', 'generative models'] | ||
version = '1.9.3.dev0' | ||
license = { text = 'BSL-1.1' } | ||
requires-python = '>=3.8,<3.12' | ||
readme = 'README.md' | ||
dependencies = [ | ||
"numpy>=1.20.0,<2;python_version<'3.10'", | ||
"numpy>=1.23.3,<2;python_version>='3.10'", | ||
"pandas>=1.1.3;python_version<'3.10'", | ||
"pandas>=1.3.4;python_version>='3.10' and python_version<'3.11'", | ||
"pandas>=1.5.0;python_version>='3.11'", | ||
"scipy>=1.5.4,<2;python_version<'3.10'", | ||
"scipy>=1.9.2,<2;python_version>='3.10'", | ||
"scikit-learn>=0.24,<2;python_version<'3.10'", | ||
"scikit-learn>=1.1.0;python_version>='3.10' and python_version<'3.11'", | ||
"scikit-learn>=1.1.3,<2;python_version>='3.11'", | ||
'Faker>=17,<20', | ||
] | ||
|
||
[project.urls] | ||
"Source Code"= "https://github.com/sdv-dev/RDT/" | ||
"Issue Tracker" = "https://github.com/sdv-dev/RDT/issues" | ||
"Changes" = "https://github.com/sdv-dev/RDT/blob/main/HISTORY.md" | ||
"Twitter" = "https://twitter.com/sdv_dev" | ||
"Chat" = "https://bit.ly/sdv-slack-invite" | ||
|
||
[project.entry-points] | ||
rdt = { main = 'rdt.cli.__main__:main' } | ||
|
||
[project.optional-dependencies] | ||
copulas = ['copulas>=0.10.0,<0.11',] | ||
test = [ | ||
'rdt[copulas]', | ||
|
||
'pytest>=3.4.2', | ||
'pytest-cov>=2.6.0', | ||
'jupyter>=1.0.0,<2', | ||
'rundoc>=0.4.3,<0.5', | ||
'pytest-subtests>=0.5,<1.0', | ||
'pytest-runner >= 2.11.1', | ||
'tomli>=2.0.0,<3', | ||
] | ||
dev = [ | ||
'rdt[test]', | ||
|
||
# general | ||
'bumpversion>=0.5.3,<0.6', | ||
'pip>=9.0.1', | ||
'watchdog>=0.8.3,<0.11', | ||
|
||
# style check | ||
'pycodestyle<2.8.0,>=2.7.0', | ||
'pyflakes<2.4.0,>=2.3.0', | ||
'flake8>=3.7.7,<4', | ||
'flake8-absolute-import>=1.0,<2', | ||
'flake8-builtins>=1.5.3,<1.6', | ||
'flake8-comprehensions>=3.6.1,<3.7', | ||
'flake8-debugger>=4.0.0,<4.1', | ||
'flake8-docstrings>=1.5.0,<2', | ||
'flake8-mock>=0.3,<0.4', | ||
'flake8-variables-names>=0.0.4,<0.1', | ||
'dlint>=0.11.0,<0.12', # code security addon for flake8 | ||
'flake8-fixme>=1.1.1,<1.2', | ||
'flake8-eradicate>=1.1.0,<1.2', | ||
'flake8-mutable>=1.2.0,<1.3', | ||
'flake8-print>=4.0.0,<4.1', | ||
'isort>=4.3.4,<5', | ||
'pylint>=2.5.3,<3', | ||
'pandas-vet>=0.2.3,<0.3', | ||
'flake8-multiline-containers>=0.0.18,<0.1', | ||
'flake8-pytest-style>=1.5.0,<2', | ||
'flake8-quotes>=3.3.0,<4', | ||
'flake8-expression-complexity>=0.0.9,<0.1', | ||
'pep8-naming>=0.12.1,<0.13', | ||
'pydocstyle>=6.1.1,<6.2', | ||
'flake8-sfs>=0.0.3,<0.1', | ||
|
||
# fix style issues | ||
'autoflake>=1.1,<2', | ||
'autopep8>=1.4.3,<1.6', | ||
|
||
# distribute on PyPI | ||
'twine>=1.10.0,<4', | ||
'wheel>=0.30.0', | ||
|
||
# Advanced testing | ||
'coverage>=4.5.1,<6', | ||
'tox>=2.9.1,<4', | ||
'tabulate>=0.8.9,<1', | ||
|
||
# Invoking test commands | ||
'invoke' | ||
] | ||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
|
||
[tool.setuptools.packages.find] | ||
include = ['rdt', 'rdt.*'] | ||
namespaces = false | ||
|
||
[tool.isort] | ||
line_length = 99 | ||
lines_between_types = 0 | ||
multi_line_output = 4 | ||
not_skip = ['__init__.py'] | ||
use_parentheses = true | ||
|
||
[tool.pydocstyle] | ||
convention = 'google' | ||
add-ignore = ['D107', 'D407', 'D417'] | ||
|
||
[tool.pytest.ini_options] | ||
collect_ignore = ['pyproject.toml'] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = ['NotImplementedError()'] | ||
|
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 |
---|---|---|
|
@@ -7,15 +7,8 @@ | |
__email__ = '[email protected]' | ||
__version__ = '1.9.3.dev0' | ||
|
||
|
||
import sys | ||
import warnings | ||
from operator import attrgetter | ||
from types import ModuleType | ||
|
||
import numpy as np | ||
import pandas as pd | ||
from pkg_resources import iter_entry_points | ||
|
||
from rdt import transformers | ||
from rdt.hyper_transformer import HyperTransformer | ||
|
@@ -94,82 +87,3 @@ def get_demo(num_rows=5): | |
'dollars_spent': dollars_spent | ||
}) | ||
], ignore_index=True) | ||
|
||
|
||
def _get_addon_target(addon_path_name): | ||
"""Find the target object for the add-on. | ||
|
||
Args: | ||
addon_path_name (str): | ||
The add-on's name. The add-on's name should be the full path of valid Python | ||
identifiers (i.e. importable.module:object.attr). | ||
|
||
Returns: | ||
tuple: | ||
* object: | ||
The base module or object the add-on should be added to. | ||
* str: | ||
The name the add-on should be added to under the module or object. | ||
""" | ||
module_path, _, object_path = addon_path_name.partition(':') | ||
module_path = module_path.split('.') | ||
|
||
if module_path[0] != __name__: | ||
msg = f"expected base module to be '{__name__}', found '{module_path[0]}'" | ||
raise AttributeError(msg) | ||
|
||
target_base = sys.modules[__name__] | ||
for submodule in module_path[1:-1]: | ||
target_base = getattr(target_base, submodule) | ||
|
||
addon_name = module_path[-1] | ||
if object_path: | ||
if len(module_path) > 1 and not hasattr(target_base, module_path[-1]): | ||
msg = f"cannot add '{object_path}' to unknown submodule '{'.'.join(module_path)}'" | ||
raise AttributeError(msg) | ||
|
||
if len(module_path) > 1: | ||
target_base = getattr(target_base, module_path[-1]) | ||
|
||
split_object = object_path.split('.') | ||
addon_name = split_object[-1] | ||
|
||
if len(split_object) > 1: | ||
target_base = attrgetter('.'.join(split_object[:-1]))(target_base) | ||
|
||
return target_base, addon_name | ||
|
||
|
||
def _find_addons(): | ||
"""Find and load all RDT add-ons. | ||
|
||
If the add-on is a module, we add it both to the target module and to | ||
``system.modules`` so that they can be imported from the top of a file as follows: | ||
|
||
from top_module.addon_module import x | ||
""" | ||
group = 'rdt_modules' | ||
for entry_point in iter_entry_points(group=group): | ||
try: | ||
addon = entry_point.load() | ||
except Exception: # pylint: disable=broad-exception-caught | ||
msg = f'Failed to load "{entry_point.name}" from "{entry_point.module_name}".' | ||
warnings.warn(msg) | ||
continue | ||
|
||
try: | ||
addon_target, addon_name = _get_addon_target(entry_point.name) | ||
except AttributeError as error: | ||
msg = f"Failed to set '{entry_point.name}': {error}." | ||
warnings.warn(msg) | ||
continue | ||
|
||
if isinstance(addon, ModuleType): | ||
addon_module_name = f'{addon_target.__name__}.{addon_name}' | ||
if addon_module_name not in sys.modules: | ||
sys.modules[addon_module_name] = addon | ||
|
||
setattr(addon_target, addon_name, addon) | ||
|
||
|
||
_find_addons() | ||
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
This code has to stay! 😅 Otherwise enterprise addons won't work
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.
Good catch, thanks! Updated in f332d2d