Skip to content

Commit

Permalink
Transition from using setup.py to pyproject.toml to specify project m…
Browse files Browse the repository at this point in the history
…etadata (#338)
  • Loading branch information
R-Palazzo authored Mar 5, 2024
1 parent 1ece455 commit 2e5ba4b
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 189 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install invoke rundoc .
python -m pip install tomli
python -m pip install packaging
- name: Run the README.md
run: invoke readme
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ This will perform the following actions:
2. Bump the current version to the next release candidate, ``X.Y.Z.dev(N+1)``

After this is done, the new pre-release can be installed by including the ``dev`` section in the
dependency specification, either in ``setup.py``::
dependency specification, either in ``pyproject.toml``::

install_requires = [
dependencies = [
...
'ctgan>=X.Y.Z.dev',
...
Expand Down
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,9 @@ install-test: clean-build clean-pyc ## install the package and test dependencies
install-develop: clean-build clean-pyc ## install the package in editable mode and dependencies for development
pip install -e .[dev]

MINIMUM := $(shell sed -n '/install_requires = \[/,/]/p' setup.py | head -n-1 | tail -n+2 | sed 's/ *\(.*\),$?$$/\1/g' | tr '>' '=')

.PHONY: install-minimum
install-minimum: ## install the minimum supported versions of the package dependencies
pip install $(MINIMUM)


# LINT TARGETS


.PHONY: lint
lint: ## check style with flake8 and isort
invoke lint
Expand Down Expand Up @@ -138,8 +131,7 @@ coverage: ## check code coverage quickly with the default Python

.PHONY: dist
dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
python -m build --wheel --sdist
ls -l dist

.PHONY: publish-confirm
Expand Down
126 changes: 126 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[build-system]
requires = ['setuptools', 'wheel']
build-backend = 'setuptools.build_meta'

[project]
name = 'ctgan'
description = 'Create tabular synthetic data using a conditional GAN'
authors = [{ name = 'DataCebo, Inc.', email = '[email protected]' }]
classifiers = [
'Development Status :: 2 - Pre-Alpha',
'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 = ['ctgan', 'CTGAN']
version = '0.9.1.dev0'
license = { text = 'BSL-1.1' }
requires-python = '>=3.8,<3.12'
readme = 'README.md'
dependencies = [
"numpy>=1.20.0;python_version<'3.10'",
"numpy>=1.23.3;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'",
"scikit-learn>=0.24;python_version<'3.10'",
"scikit-learn>=1.1.3;python_version>='3.10'",
"torch>=1.8.0;python_version<'3.10'",
"torch>=1.11.0;python_version>='3.10' and python_version<'3.11'",
"torch>=2.0.0;python_version>='3.11'",
'tqdm>=4.15',
'rdt>=1.6.1',
]

[project.urls]
"Source Code"= "https://github.com/sdv-dev/CTGAN/"
"Issue Tracker" = "https://github.com/sdv-dev/CTGAN/issues"
"Changes" = "https://github.com/sdv-dev/CTGAN/blob/main/HISTORY.md"
"Twitter" = "https://twitter.com/sdv_dev"
"Chat" = "https://bit.ly/sdv-slack-invite"

[project.entry-points]
ctgan = { main = 'ctgan.cli.__main__:main' }

[project.optional-dependencies]
test = [
'pytest>=3.4.2',
'pytest-rerunfailures>=9.1.1,<10',
'pytest-cov>=2.6.0',
'rundoc>=0.4.3,<0.5',
'pytest-runner >= 2.11.1',
'tomli>=2.0.0,<3',
]
dev = [
'ctgan[test]',

# general
'pip>=9.0.1',
'bumpversion>=0.5.3,<0.6',
'watchdog>=0.8.3,<0.11',

# style check
'flake8>=3.7.7,<4',
'isort>=4.3.4,<5',
'dlint>=0.11.0,<0.12', # code security addon for flake8
'flake8-debugger>=4.0.0,<4.1',
'flake8-mock>=0.3,<0.4',
'flake8-mutable>=1.2.0,<1.3',
'flake8-absolute-import>=1.0,<2',
'flake8-multiline-containers>=0.0.18,<0.1',
'flake8-print>=4.0.0,<4.1',
'flake8-quotes>=3.3.0,<4',
'flake8-fixme>=1.1.1,<1.2',
'flake8-expression-complexity>=0.0.9,<0.1',
'flake8-eradicate>=1.1.0,<1.2',
'flake8-builtins>=1.5.3,<1.6',
'flake8-variables-names>=0.0.4,<0.1',
'pandas-vet>=0.2.2,<0.3',
'flake8-comprehensions>=3.6.1,<3.7',
'dlint>=0.11.0,<0.12',
'flake8-docstrings>=1.5.0,<2',
'flake8-sfs>=0.0.3,<0.1',
'flake8-pytest-style>=1.5.0,<2',

# 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',

'invoke',
]

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ['ctgan', 'ctgan.*']
namespaces = false

[tool.isort]
include_trailing_comment = true
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']
13 changes: 1 addition & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ values =

[bumpversion:part:candidate]

[bumpversion:file:setup.py]
[bumpversion:file:pyproject.toml]
search = version='{current_version}'
replace = version='{new_version}'

Expand All @@ -39,17 +39,6 @@ extend-ignore = D107, # Missing docstring in __init__
per-file-ignores =
ctgan/data.py:T001

[isort]
include_trailing_comment = True
line_length = 99
lines_between_types = 0
multi_line_output = 4
not_skip = __init__.py
use_parentheses = True

[aliases]
test = pytest

[tool:pytest]
collect_ignore = ['setup.py']

124 changes: 0 additions & 124 deletions setup.py

This file was deleted.

Loading

0 comments on commit 2e5ba4b

Please sign in to comment.