Skip to content

Commit

Permalink
make release-tag: Merge branch 'main' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
amontanez24 committed Apr 11, 2024
2 parents c258d86 + 100a5c1 commit d4a0037
Show file tree
Hide file tree
Showing 17 changed files with 209 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependency_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11','3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11','3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11','3.12']
os: [ubuntu-latest, macos-latest] # skip windows bc rundoc fails
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/static_code_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Static Code Analysis

on:
release:
types: [published]
workflow_dispatch:

jobs:
code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install bandit==1.7.7
- name: Save code analysis
run: bandit -r . -x ./tests -f txt -o static_code_analysis.txt --exit-zero
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
commit-message: Update static code analysis
title: Latest Code Analysis
body: "This is an auto-generated PR with the **latest** code analysis results."
branch: static-code-analysis
branch-suffix: short-commit-hash
base: main
6 changes: 3 additions & 3 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11','3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
18 changes: 18 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# History

## v0.10.0 - 2024-04-11

This release adds support for Python 3.12!

### Maintenance

* Support Python 3.12 - Issue [#324](https://github.com/sdv-dev/CTGAN/issues/324) by @fealho
* Remove scikit-learn dependency - Issue [#346](https://github.com/sdv-dev/CTGAN/issues/346) by @R-Palazzo
* Add bandit workflow - Issue [#353](https://github.com/sdv-dev/CTGAN/issues/353) by @R-Palazzo

### Internal

* Replace integration test that uses the iris demo data - Issue [#352](https://github.com/sdv-dev/CTGAN/issues/352) by @R-Palazzo

### Bugs Fixed

* Fix minimum version workflow when pointing to github branch - Issue [#355](https://github.com/sdv-dev/CTGAN/issues/355) by @R-Palazzo

## v0.9.1 - 2024-03-14

This release changes the `loss_values` attribute of a CTGAN model to contain floats instead of `torch.Tensors`.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,5 @@ release-major: check-release bumpversion-major release

.PHONY: check-deps
check-deps:
$(eval allow_list='numpy=|pandas=|scikit-learn=|tqdm=|torch=|rdt=')
$(eval allow_list='numpy=|pandas=|tqdm=|torch=|rdt=')
pip freeze | grep -v "CTGAN.git" | grep -E $(allow_list) > $(OUTPUT_FILEPATH)
2 changes: 1 addition & 1 deletion ctgan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = 'DataCebo, Inc.'
__email__ = '[email protected]'
__version__ = '0.9.1'
__version__ = '0.10.0.dev1'

from ctgan.demo import load_demo
from ctgan.synthesizers.ctgan import CTGAN
Expand Down
4 changes: 1 addition & 3 deletions latest_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
numpy==1.26.4
pandas==2.2.1
rdt==1.10.0
scikit-learn==1.4.1.post1
torch==2.2.1
torch==2.2.2
tqdm==4.66.2
26 changes: 14 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
]
keywords = ['ctgan', 'CTGAN']
dynamic = ['version']
license = { text = 'BSL-1.1' }
requires-python = '>=3.8,<3.12'
requires-python = '>=3.8,<3.13'
readme = 'README.md'
dependencies = [
"numpy>=1.20.0;python_version<'3.10'",
"numpy>=1.23.3;python_version>='3.10'",
"numpy>=1.23.3,<2;python_version>='3.10' and python_version<'3.12'",
"numpy>=1.26.0,<2;python_version>='3.12'",
"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'",
"pandas>=1.5.0;python_version>='3.11' and python_version<'3.12'",
"pandas>=2.1.1;python_version>='3.12'",
"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',
"torch>=2.0.0;python_version>='3.11' and python_version<'3.12'",
"torch>=2.2.0;python_version>='3.12'",
'tqdm>=4.29,<5',
'rdt>=1.11.0',
]

[project.urls]
Expand All @@ -47,7 +49,7 @@ ctgan = { main = 'ctgan.cli.__main__:main' }
[project.optional-dependencies]
test = [
'pytest>=3.4.2',
'pytest-rerunfailures>=9.1.1,<10',
'pytest-rerunfailures>=10.3,<15',
'pytest-cov>=2.6.0',
'rundoc>=0.4.3,<0.5',
'pytest-runner >= 2.11.1',
Expand All @@ -60,7 +62,7 @@ dev = [
'pip>=9.0.1',
'build>=1.0.0,<2',
'bump-my-version>=0.18.3,<1',
'watchdog>=0.8.3,<0.11',
'watchdog>=1.0.1,<5',

# style check
'flake8>=3.7.7,<4',
Expand Down Expand Up @@ -123,12 +125,12 @@ namespaces = false
'*.png',
'*.gif'
]
'tests' = ['*']

[tool.setuptools.exclude-package-data]
'*' = [
'* __pycache__',
'*.py[co]',
'static_code_analysis.txt',
]

[tool.setuptools.dynamic]
Expand All @@ -150,7 +152,7 @@ add-ignore = ['D107', 'D407', 'D417']
collect_ignore = ['pyproject.toml']

[tool.bumpversion]
current_version = "0.9.1"
current_version = "0.10.0.dev1"
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
serialize = [
'{major}.{minor}.{patch}.{release}{candidate}',
Expand Down
101 changes: 101 additions & 0 deletions static_code_analysis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Run started:2024-04-10 18:50:03.907830

Test results:
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/__main__.py:88:8
87 if args.sample_condition_column is not None:
88 assert args.sample_condition_column_value is not None
89

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/data.py:53:12
52 else:
53 assert item[0] == 'D'
54 discrete.append(idx)

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/data.py:74:16
73 else:
74 assert idx in discrete
75 row.append(column_info[idx].index(col))

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/data.py:91:20
90 else:
91 assert idx in meta['discrete_columns']
92 print(meta['column_info'][idx][int(col)], end=' ', file=f)

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/data_sampler.py:41:8
40 st += sum([span_info.dim for span_info in column_info])
41 assert st == data.shape[1]
42

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/synthesizers/ctgan.py:56:8
55 """Apply the Discriminator to the `input_`."""
56 assert input_.size()[0] % self.pac == 0
57 return self.seq(input_.view(-1, self.pacdim))

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/synthesizers/ctgan.py:148:8
147
148 assert batch_size % 2 == 0
149

--------------------------------------------------
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html
Location: ./ctgan/synthesizers/tvae.py:100:4
99
100 assert st == recon_x.size()[1]
101 KLD = -0.5 * torch.sum(1 + logvar - mu**2 - logvar.exp())

--------------------------------------------------

Code scanned:
Total lines of code: 1341
Total lines skipped (#nosec): 0
Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
Total issues (by severity):
Undefined: 0
Low: 8
Medium: 0
High: 0
Total issues (by confidence):
Undefined: 0
Low: 0
Medium: 0
High: 8
Files skipped (0):
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _get_minimum_versions(dependencies, python_version):
for dependency in dependencies:
if '@' in dependency:
name, url = dependency.split(' @ ')
min_versions[name] = f'{name} @ {url}'
min_versions[name] = f'{url}#egg={name}'
continue

req = Requirement(dependency)
Expand Down
Loading

0 comments on commit d4a0037

Please sign in to comment.