Skip to content

Commit 337ad5f

Browse files
committed
make release-tag: Merge branch 'main' into stable
2 parents 8cef6e9 + c93e464 commit 337ad5f

File tree

16 files changed

+285
-118
lines changed

16 files changed

+285
-118
lines changed

CONTRIBUTING.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ Release Workflow
166166
The process of releasing a new version involves several steps combining both ``git`` and
167167
``bumpversion`` which, briefly:
168168

169-
1. Merge what is in ``master`` branch into ``stable`` branch.
169+
1. Merge what is in ``main`` branch into ``stable`` branch.
170170
2. Update the version in ``setup.cfg``, ``copulas/__init__.py`` and ``HISTORY.md`` files.
171171
3. Create a new TAG pointing at the correspoding commit in ``stable`` branch.
172-
4. Merge the new commit from ``stable`` into ``master``.
172+
4. Merge the new commit from ``stable`` into ``main``.
173173
5. Update the version in ``setup.cfg`` and ``copulas/__init__.py`` to open the next
174174
development interation.
175175

176176
**Note:** Before starting the process, make sure that ``HISTORY.md`` has a section titled
177177
**Unreleased** with the list of changes that will be included in the new version, and that
178-
these changes are committed and available in ``master`` branch.
178+
these changes are committed and available in ``main`` branch.
179179
Normally this is just a list of the Pull Requests that have been merged since the latest version.
180180

181181
Once this is done, run of the following commands:

HISTORY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# History
22

3+
## v0.9.2 - 2023-10-12
4+
5+
This release removes a warning that was being raised when univariate distributions failed to fit and logs the message instead.
6+
7+
### New Features
8+
9+
* When Copulas univariate fit fails, produce a log instead of a warning - Issue [#359](https://github.com/sdv-dev/Copulas/issues/359) by @R-Palazzo
10+
11+
### Maintenance
12+
13+
* Switch default branch from master to main - Issue [#360](https://github.com/sdv-dev/Copulas/issues/360) by @amontanez24
14+
* Update add-on detection for Copulas - Issue [#362](https://github.com/sdv-dev/Copulas/issues/362) by @pvk-developer
15+
316
## v0.9.1 - 2023-08-10
417

518
This release fixes problems with the documentation site and drops support for Python 3.7.

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ make install
4747

4848
If you intend to modify the source code or contribute to the project you will need to
4949
install it from the source using the `make install-develop` command. In this case, we
50-
recommend you to branch from `master` first:
50+
recommend you to branch from `main` first:
5151

5252
```bash
5353
git clone [email protected]:sdv-dev/Copulas
5454
cd Copulas
55-
git checkout master
55+
git checkout main
5656
git checkout -b <your-branch-name>
5757
make install-develp
5858
```

Makefile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ publish-test: dist publish-confirm ## package and upload a release on TestPyPI
177177
publish: dist publish-confirm ## package and upload a release
178178
twine upload dist/*
179179

180-
.PHONY: git-merge-master-stable
181-
git-merge-master-stable: ## Merge master into stable
180+
.PHONY: git-merge-main-stable
181+
git-merge-main-stable: ## Merge main into stable
182182
git checkout stable || git checkout -b stable
183-
git merge --no-ff master -m"make release-tag: Merge branch 'master' into stable"
183+
git merge --no-ff main -m"make release-tag: Merge branch 'main' into stable"
184184

185-
.PHONY: git-merge-stable-master
186-
git-merge-stable-master: ## Merge stable into master
187-
git checkout master
185+
.PHONY: git-merge-stable-main
186+
git-merge-stable-main: ## Merge stable into main
187+
git checkout main
188188
git merge stable
189189

190190
.PHONY: git-push
@@ -218,7 +218,7 @@ bumpversion-major: ## Bump the version the next major skipping the release
218218
.PHONY: bumpversion-revert
219219
bumpversion-revert: ## Undo a previous bumpversion-release
220220
git tag --delete $(shell git tag --points-at HEAD)
221-
git checkout master
221+
git checkout main
222222
git branch -D stable
223223

224224
CLEAN_DIR := $(shell git status --short | grep -v ??)
@@ -232,10 +232,10 @@ ifneq ($(CLEAN_DIR),)
232232
$(error There are uncommitted changes)
233233
endif
234234

235-
.PHONY: check-master
236-
check-master: ## Check if we are in master branch
237-
ifneq ($(CURRENT_BRANCH),master)
238-
$(error Please make the release from master branch\n)
235+
.PHONY: check-main
236+
check-main: ## Check if we are in main branch
237+
ifneq ($(CURRENT_BRANCH),main)
238+
$(error Please make the release from main branch\n)
239239
endif
240240

241241
.PHONY: check-candidate
@@ -251,18 +251,18 @@ ifeq ($(CHANGELOG_LINES),0)
251251
endif
252252

253253
.PHONY: check-release
254-
check-release: check-clean check-candidate check-master check-history ## Check if the release can be made
254+
check-release: check-clean check-candidate check-main check-history ## Check if the release can be made
255255
@echo "A new release can be made"
256256

257257
.PHONY: release
258-
release: check-release git-merge-master-stable bumpversion-release git-push-tags-stable \
259-
publish git-merge-stable-master bumpversion-patch git-push
258+
release: check-release git-merge-main-stable bumpversion-release git-push-tags-stable \
259+
publish git-merge-stable-main bumpversion-patch git-push
260260

261261
.PHONY: release-test
262-
release-test: check-release git-merge-master-stable bumpversion-release bumpversion-revert
262+
release-test: check-release git-merge-main-stable bumpversion-release bumpversion-revert
263263

264264
.PHONY: release-candidate
265-
release-candidate: check-master publish bumpversion-candidate git-push
265+
release-candidate: check-main publish bumpversion-candidate git-push
266266

267267
.PHONY: release-candidate-test
268-
release-candidate-test: check-clean check-master publish-test
268+
release-candidate-test: check-clean check-main publish-test

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
[![PyPi Shield](https://img.shields.io/pypi/v/copulas.svg)](https://pypi.python.org/pypi/copulas)
77
[![Downloads](https://pepy.tech/badge/copulas)](https://pepy.tech/project/copulas)
88
[![Unit Tests](https://github.com/sdv-dev/Copulas/actions/workflows/unit.yml/badge.svg)](https://github.com/sdv-dev/Copulas/actions/workflows/unit.yml)
9-
[![Coverage Status](https://codecov.io/gh/sdv-dev/Copulas/branch/master/graph/badge.svg)](https://codecov.io/gh/sdv-dev/Copulas)
9+
[![Coverage Status](https://codecov.io/gh/sdv-dev/Copulas/branch/main/graph/badge.svg)](https://codecov.io/gh/sdv-dev/Copulas)
1010
[![Slack](https://img.shields.io/badge/Community-Slack-blue?style=plastic&logo=slack)](https://bit.ly/sdv-slack-invite)
1111

1212
<br/>
1313
<p align="center" style="text-align:center">
1414
<a href="https://github.com/sdv-dev/Copulas">
15-
<img width=40% src="https://github.com/sdv-dev/SDV/blob/master/docs/images/Copulas-DataCebo.png?raw=true"></img>
15+
<img width=40% src="https://github.com/sdv-dev/SDV/blob/stable/docs/images/Copulas-DataCebo.png?raw=true"></img>
1616
</a>
1717
</p>
1818

@@ -110,7 +110,7 @@ Thank you to our team of contributors who have built and maintained the library
110110

111111

112112
<div align="center">
113-
<a href="https://datacebo.com"><img align="center" width=40% src="https://github.com/sdv-dev/SDV/blob/master/docs/images/DataCebo.png"></img></a>
113+
<a href="https://datacebo.com"><img align="center" width=40% src="https://github.com/sdv-dev/SDV/blob/stable/docs/images/DataCebo.png"></img></a>
114114
</div>
115115
<br/>
116116
<br/>

RELEASE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Clone the project and install the development requirements before start the rele
3636
```bash
3737
git clone https://github.com/sdv-dev/Copulas.git
3838
cd Copulas
39-
git checkout master
39+
git checkout main
4040
make install-develop
4141
```
4242

@@ -183,7 +183,7 @@ Clone the project and install the development requirements. Alternatively, with
183183
```bash
184184
git clone https://github.com/sdv-dev/SDV
185185
cd SDV
186-
git checkout master
186+
git checkout main
187187
make install-develop
188188
```
189189

copulas/__init__.py

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
__author__ = 'DataCebo, Inc.'
66
__email__ = '[email protected]'
7-
__version__ = '0.9.1'
7+
__version__ = '0.9.2.dev1'
88

99
import contextlib
1010
import importlib
11+
import sys
12+
import warnings
1113
from copy import deepcopy
14+
from operator import attrgetter
1215

1316
import numpy as np
1417
import pandas as pd
15-
16-
from copulas._addons import _find_addons
17-
18-
_find_addons(group='copulas_modules', parent_globals=globals())
18+
from pkg_resources import iter_entry_points
1919

2020
EPSILON = np.finfo(np.float32).eps
2121

@@ -262,3 +262,71 @@ def decorated(self, X, *args, **kwargs):
262262
return function(self, X, *args, **kwargs)
263263

264264
return decorated
265+
266+
267+
def _get_addon_target(addon_path_name):
268+
"""Find the target object for the add-on.
269+
270+
Args:
271+
addon_path_name (str):
272+
The add-on's name. The add-on's name should be the full path of valid Python
273+
identifiers (i.e. importable.module:object.attr).
274+
275+
Returns:
276+
tuple:
277+
* object:
278+
The base module or object the add-on should be added to.
279+
* str:
280+
The name the add-on should be added to under the module or object.
281+
"""
282+
module_path, _, object_path = addon_path_name.partition(':')
283+
module_path = module_path.split('.')
284+
285+
if module_path[0] != __name__:
286+
msg = f"expected base module to be '{__name__}', found '{module_path[0]}'"
287+
raise AttributeError(msg)
288+
289+
target_base = sys.modules[__name__]
290+
for submodule in module_path[1:-1]:
291+
target_base = getattr(target_base, submodule)
292+
293+
addon_name = module_path[-1]
294+
if object_path:
295+
if len(module_path) > 1 and not hasattr(target_base, module_path[-1]):
296+
msg = f"cannot add '{object_path}' to unknown submodule '{'.'.join(module_path)}'"
297+
raise AttributeError(msg)
298+
299+
if len(module_path) > 1:
300+
target_base = getattr(target_base, module_path[-1])
301+
302+
split_object = object_path.split('.')
303+
addon_name = split_object[-1]
304+
305+
if len(split_object) > 1:
306+
target_base = attrgetter('.'.join(split_object[:-1]))(target_base)
307+
308+
return target_base, addon_name
309+
310+
311+
def _find_addons():
312+
"""Find and load all copulas add-ons."""
313+
group = 'copulas_modules'
314+
for entry_point in iter_entry_points(group=group):
315+
try:
316+
addon = entry_point.load()
317+
except Exception: # pylint: disable=broad-exception-caught
318+
msg = f'Failed to load "{entry_point.name}" from "{entry_point.module_name}".'
319+
warnings.warn(msg)
320+
continue
321+
322+
try:
323+
addon_target, addon_name = _get_addon_target(entry_point.name)
324+
except AttributeError as error:
325+
msg = f"Failed to set '{entry_point.name}': {error}."
326+
warnings.warn(msg)
327+
continue
328+
329+
setattr(addon_target, addon_name, addon)
330+
331+
332+
_find_addons()

copulas/_addons.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

copulas/multivariate/gaussian.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
import sys
5-
import warnings
65

76
import numpy as np
87
import pandas as pd
@@ -112,11 +111,11 @@ def fit(self, X):
112111
try:
113112
univariate.fit(column)
114113
except BaseException:
115-
warning_message = (
114+
log_message = (
116115
f'Unable to fit to a {distribution} distribution for column {column_name}. '
117116
'Using a Gaussian distribution instead.'
118117
)
119-
warnings.warn(warning_message)
118+
LOGGER.info(log_message)
120119
univariate = GaussianUnivariate()
121120
univariate.fit(column)
122121

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
'display_github': True,
105105
'github_user': user,
106106
'github_repo': project,
107-
'github_version': 'master',
107+
'github_version': 'main',
108108
'conf_py_path': '/docs/',
109109
}
110110

0 commit comments

Comments
 (0)