Skip to content
Snippets Groups Projects
Commit 7a5f5a34 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.8.2.2+dfsg

parent 6a63847f
No related branches found
No related tags found
No related merge requests found
version: 2
references:
ci_steps: &ci_steps
working_directory: /work
steps:
- checkout
- run:
name: Run CI
command: |
#
# Set UPLOAD_SDIST environment variable
#
export UPLOAD_SDIST=$(echo ${CIRCLE_JOB} | cut -d"_" -f3)
echo "UPLOAD_SDIST [${UPLOAD_SDIST}]"
#
# Run CI
#
export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2)
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci
/opt/python/${MANYLINUX_PYTHON}/bin/ci
- persist_to_workspace:
root: ./
paths:
- dist
x64_build_job: &x64_build_job
docker:
- image: dockcross/manylinux1-x64
<<: *ci_steps
x86_build_job: &x86_build_job
docker:
- image: dockcross/manylinux1-x86
<<: *ci_steps
deploy_website_command: &deploy_website_command
name: Deploy website
command: |
source_sha=$(cat doc/_build/html/.buildinfo | grep sha | cut -d: -f2)
repo_slug=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
doc/deploy-website.sh $repo_slug $source_sha --html-dir doc/_build/html
no_filters: &no_filters
filters:
tags:
only: /.*/
jobs:
# x64
manylinux-x64_cp27-cp27m:
<<: *x64_build_job
manylinux-x64_cp27-cp27mu:
<<: *x64_build_job
manylinux-x64_cp36-cp36m_upload-sdist:
<<: *x64_build_job
manylinux-x64_cp37-cp37m:
<<: *x64_build_job
manylinux-x64_cp38-cp38:
<<: *x64_build_job
manylinux-x64_cp39-cp39:
<<: *x64_build_job
# x86
#manylinux-x86_cp27-cp27m:
# <<: *x86_build_job
#manylinux-x86_cp27-cp27mu:
# <<: *x86_build_job
#manylinux-x86_cp36-cp36m:
# <<: *x86_build_job
#manylinux-x86_cp37-cp37m:
# <<: *x86_build_job
#manylinux-x86_cp38-cp38:
# <<: *x86_build_job
build-website_cp37-cp37m:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Build website
command: |
export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2)
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
python -m venv ../venv
. ../venv/bin/activate
pip install ./dist/*${MANYLINUX_PYTHON}*x86_64.whl
doc/build-website.sh
- persist_to_workspace:
root: ./
paths:
- doc/_build/html
deploy-master:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Deploy master
command: |
echo "Deploy master (not implemented)"
- run:
<<: *deploy_website_command
deploy-release:
docker:
- image: circleci/python:3.7.0-stretch
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Deploy release
command: |
echo "Deploy release"
python -m venv ../venv
. ../venv/bin/activate
pip install twine
ls dist
twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
- run:
<<: *deploy_website_command
workflows:
version: 2
build-test-deploy:
jobs:
# x64
- manylinux-x64_cp27-cp27m:
<<: *no_filters
- manylinux-x64_cp27-cp27mu:
<<: *no_filters
- manylinux-x64_cp36-cp36m_upload-sdist:
<<: *no_filters
- manylinux-x64_cp37-cp37m:
<<: *no_filters
- manylinux-x64_cp38-cp38:
<<: *no_filters
- manylinux-x64_cp39-cp39:
<<: *no_filters
# x86
#- manylinux-x86_cp27-cp27m:
# <<: *no_filters
#- manylinux-x86_cp27-cp27mu:
# <<: *no_filters
#- manylinux-x86_cp36-cp36m:
# <<: *no_filters
#- manylinux-x86_cp37-cp37m:
# <<: *no_filters
#- manylinux-x86_cp38-cp38:
# <<: *no_filters
- build-website_cp37-cp37m:
requires:
- manylinux-x64_cp37-cp37m
<<: *no_filters
- deploy-master:
requires:
# x64
- manylinux-x64_cp27-cp27m
- manylinux-x64_cp27-cp27mu
- manylinux-x64_cp36-cp36m_upload-sdist
- manylinux-x64_cp37-cp37m
- manylinux-x64_cp38-cp38
- manylinux-x64_cp39-cp39
# x86
#- manylinux-x86_cp27-cp27m
#- manylinux-x86_cp27-cp27mu
#- manylinux-x86_cp36-cp36m
#- manylinux-x86_cp37-cp37m
#- manylinux-x86_cp38-cp38
# misc
- build-website_cp37-cp37m
filters:
branches:
only: master
- deploy-release:
requires:
# x64
- manylinux-x64_cp27-cp27m
- manylinux-x64_cp27-cp27mu
- manylinux-x64_cp36-cp36m_upload-sdist
- manylinux-x64_cp37-cp37m
- manylinux-x64_cp38-cp38
- manylinux-x64_cp39-cp39
# x86
#- manylinux-x86_cp27-cp27m
#- manylinux-x86_cp27-cp27mu
#- manylinux-x86_cp36-cp36m
#- manylinux-x86_cp37-cp37m
#- manylinux-x86_cp38-cp38
# misc
- build-website_cp37-cp37m
filters:
tags:
only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
branches:
ignore: /.*/
branches:
only:
- master
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
language: python
matrix:
include:
- os: osx
language: generic
env:
- PYTHON_VERSION=3.9.0
- os: osx
language: generic
env:
- PYTHON_VERSION=3.8.0
- os: osx
language: generic
env:
- PYTHON_VERSION=3.7.0
- os: osx
language: generic
env:
- PYTHON_VERSION=3.6.5
- os: osx
language: generic
env:
- PYTHON_VERSION=2.7.15
cache:
directories:
- $HOME/.pyenv/versions/3.9.0
- $HOME/.pyenv/versions/3.8.0
- $HOME/.pyenv/versions/3.7.0
- $HOME/.pyenv/versions/3.6.5
- $HOME/.pyenv/versions/2.7.15
- $HOME/downloads
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
- python -m pip install --disable-pip-version-check --upgrade pip
- pip install -U scikit-ci scikit-ci-addons
- ci_addons --install ../addons
install:
- ci install
script:
- ci test
after_success:
- ci after_test
deploy:
# deploy-release
- provider: script
script: pwd && ls dist;echo "deploy-release" && ~/.pyenv/versions/${PYTHON_VERSION}/bin/twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
skip_cleanup: true
on:
repo: ${TRAVIS_REPO_SLUG}
tags: true
# deploy-master
- provider: script
script: pwd && ls dist;echo "deploy-master" && echo "not implemented"
skip_cleanup: true
on:
repo: ${TRAVIS_REPO_SLUG}
branch: master
[![licence](http://img.shields.io/badge/licence-MIT-blue.svg?style=flat)](https://github.com/amueller/word_cloud/blob/master/LICENSE)
[![DOI](https://zenodo.org/badge/21369/amueller/word_cloud.svg)](https://zenodo.org/badge/latestdoi/21369/amueller/word_cloud)
| | Linux | macOS | Windows |
|------|----------------------------------------------|----------------------------------------------|----------------------------------------------|
| PyPI | [![CircleCI][circleci_image]][circleci_link] | [![TravisCI][travisci_image]][travisci_link] | [![AppVeyor][appveyor_image]][appveyor_link] |
[circleci_link]: https://circleci.com/gh/amueller/word_cloud/tree/master
[circleci_image]: https://circleci.com/gh/amueller/word_cloud/tree/master.svg?style=svg
[travisci_link]: https://travis-ci.org/amueller/word_cloud
[travisci_image]: https://travis-ci.org/amueller/word_cloud.svg?branch=master
[appveyor_link]: https://ci.appveyor.com/project/amueller/word-cloud/branch/master
[appveyor_image]: https://img.shields.io/appveyor/ci/amueller/word-cloud/master.svg
word_cloud
==========
......
branches:
only:
- master
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
version: "0.0.1.{build}"
environment:
matrix:
- PYTHON_DIR: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python37"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "32"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python38"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "64"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python38"
PYTHON_VERSION: "3.9.x"
PYTHON_ARCH: "32"
BLOCK: "0"
- PYTHON_DIR: "C:\\Python38-x64"
PYTHON_VERSION: "3.9.x"
PYTHON_ARCH: "64"
BLOCK: "0"
PYPI_USER:
secure: deKM8MvS0hJbOBqZmBym0Q==
PYPI_PASSWORD:
secure: FE4sZ/hIsAVxu408qFzrVw==
init:
- python -m pip install -U scikit-ci scikit-ci-addons
- python -m ci_addons --install ../addons
install:
- python -m ci install
build_script:
- python -m ci build
test_script:
- python -m ci test
after_test:
- python -m ci after_test
on_finish:
- ps: ../addons/appveyor/enable-worker-remote-access.ps1 -check_for_block
deploy_script:
- ps: |
if ($env:appveyor_repo_tag -eq $true -and $env:appveyor_repo_tag_name –match "^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$") {
Write-Host "deploy release"
$env:PATH="$env:PYTHON_DIR/Scripts/;$env:PATH"
twine upload -u $env:PYPI_USER -p $env:PYPI_PASSWORD --skip-existing dist/*
} elseif ($env:appveyor_repo_branch -eq "master") {
Write-Host "deploy master (not implemented)"
} else {
Write-Host "nothing to deploy"
}
matrix:
fast_finish: false
schema_version: "0.5.0"
#
# $<RUN_ENV> wrapper
#
# Steps expecting to compile some code must be wrapped using $<RUN_ENV>, doing so
# ensures the environment is properly set (e.g path to visual studio, ...)
#
before_install:
appveyor:
environment:
PATH: $<PYTHON_DIR>;$<PYTHON_DIR>\\Scripts;$<PATH>
RUN_ENV: .\\..\\addons\\appveyor\\run-with-visual-studio.cmd
commands:
- python ../addons/appveyor/patch_vs2008.py
circle:
environment:
PATH: /opt/python/$<MANYLINUX_PYTHON>/bin:$<PATH>
travis:
osx:
environment:
PATH: $<HOME>/.pyenv/versions/$<PYTHON_VERSION>/bin:$<PATH>
SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-10.6-x86_64
commands:
- python ../addons/travis/install_pyenv.py
install:
commands:
- python --version
- python -m pip install --disable-pip-version-check --upgrade pip
- $<RUN_ENV> pip install -U -r requirements.txt -r requirements-dev.txt
before_build:
commands:
- flake8
build:
commands:
- python --version
- python -c "import numpy; print('numpy %s' % numpy.__version__)"
# Source distribution
- python setup.py sdist
# Built distribution (wheel)
- $<RUN_ENV> python setup.py bdist_wheel $<SETUP_BDIST_WHEEL_ARGS>
# Install locally to support tests
- $<RUN_ENV> pip install -e .
# Cleanup
- python: |
import glob, os
if os.environ.get("UPLOAD_SDIST", "") == "":
sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0]
print("Deleting [%s]" % sdist)
os.remove(sdist)
circle:
commands:
- |
# Since there are no external shared libraries to bundle into the wheels
# this step will fixup the wheel switching from 'linux' to 'manylinux1' tag
for whl in dist/*$(python -c "import wheel.pep425tags as w; print(w.get_platform())").whl; do
auditwheel repair $whl -w ./dist/
rm $whl
done
test:
commands:
- pytest
# TODO: Update setup.py to use "entry_points" and test execution of wordcloud_cli on all platforms
#after_test:
# commands:
# - codecov -X gcov --required --file ./test/coverage.xml
......@@ -185,8 +185,6 @@ def test_writing_to_file(tmpdir):
def test_check_errors():
wc = WordCloud()
with pytest.raises(NotImplementedError):
wc.to_html()
try:
np.array(wc)
......@@ -479,3 +477,28 @@ def test_plural_stopwords():
w = WordCloud(collocations=False).generate(x)
assert w.words_['wa'] < 1
def test_max_font_size_as_mask_height():
# test if max font size will respect the mask height
x = '''hello hello hello
bye'''
# Get default wordcloud size
wcd = WordCloud()
default_size = (wcd.height, wcd.width)
# Make sure the size we are using is larger than the default size
size = (default_size[0] * 2, default_size[1] * 2)
# using mask, all drawable
mask = np.zeros(size, dtype=np.int)
mask[:, :] = 0
wc = WordCloud(mask=mask, random_state=42)
wc.generate(x)
# no mask
wc2 = WordCloud(width=size[1], height=size[0], random_state=42)
wc2.generate(x)
# Check if the biggest element has the same font size
assert wc.layout_[0][1] == wc2.layout_[0][1]
......@@ -3,6 +3,7 @@ import os
import subprocess
import sys
from collections import namedtuple
import contextlib
import wordcloud as wc
from wordcloud import wordcloud_cli as cli
......@@ -161,13 +162,9 @@ def test_cli_writes_to_stdout(tmpdir, tmp_text_file):
tmp_text_file.write(b'some text')
originalBuffer = sys.stdout.buffer
sys.stdout.buffer = tmp_image_file.open('wb+')
args, text, image_file = cli.parse_args(['--text', str(tmp_text_file)])
cli.main(args, text, image_file)
sys.stdout.buffer = originalBuffer
with contextlib.redirect_stdout(tmp_image_file.open('w+')):
args, text, image_file = cli.parse_args(['--text', str(tmp_text_file)])
cli.main(args, text, image_file)
# expecting image to be written to stdout
assert tmp_image_file.size() > 0
......@@ -187,8 +184,8 @@ def test_cli_regexp_invalid(tmp_text_file, capsys):
@pytest.mark.parametrize("command,expected_output, expected_exit_code", [
("wordcloud_cli --help", "usage: wordcloud_cli", 0),
("python -m wordcloud --help", "usage: __main__", 0),
("python %s/../wordcloud/wordcloud_cli.py --help" % os.path.dirname(__file__), "To execute the CLI", 1),
("%s -m wordcloud --help" % sys.executable, "usage: __main__", 0),
("%s %s/../wordcloud/wordcloud_cli.py --help" % (sys.executable, os.path.dirname(__file__)), "To execute the CLI", 1),
])
def test_cli_as_executable(command, expected_output, expected_exit_code, tmpdir, capfd, no_cover_compat):
......
......@@ -23,9 +23,9 @@ def get_keywords():
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
git_refnames = " (HEAD -> master, tag: 1.8.1)"
git_full = "b6f48e108224f84b0b1659cea8558c86ccfc9898"
git_date = "2020-11-11 13:35:51 -0800"
git_refnames = " (tag: 1.8.2.2, refs/pull/683/head, different_workflow)"
git_full = "d8c6624e9547587d6c57d27c97fb7fea717455e7"
git_date = "2022-06-23 17:03:26 -0700"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
......
......@@ -290,13 +290,15 @@ class WordCloud(object):
.. versionchanged: 2.0
``words_`` is now a dictionary
``layout_`` : list of tuples (string, int, (int, int), int, color))
Encodes the fitted word cloud. Encodes for each word the string, font
size, position, orientation and color.
``layout_`` : list of tuples ((string, float), int, (int, int), int, color))
Encodes the fitted word cloud. For each word, it encodes the string,
normalized frequency, font size, position, orientation, and color.
The frequencies are normalized by the most commonly occurring word.
The color is in the format of 'rgb(R, G, B).'
Notes
-----
Larger canvases with make the code significantly slower. If you need a
Larger canvases make the code significantly slower. If you need a
large word cloud, try a lower canvas size, and set the scale parameter.
The algorithm might give more weight to the ranking of the words
......@@ -365,6 +367,11 @@ class WordCloud(object):
self.min_word_length = min_word_length
self.collocation_threshold = collocation_threshold
# Override the width and height if there is a mask
if mask is not None:
self.width = mask.shape[1]
self.height = mask.shape[0]
def fit_words(self, frequencies):
"""Create a word_cloud from words and frequencies.
......@@ -739,9 +746,6 @@ class WordCloud(object):
"""
return self.to_array()
def to_html(self):
raise NotImplementedError("FIXME!!!")
def to_svg(self, embed_font=False, optimize_embedded_font=True, embed_image=False):
"""Export to SVG.
......
......@@ -223,6 +223,8 @@ def parse_args(arguments):
# prog = 'python wordcloud_cli.py'
parser = make_parser()
args = parser.parse_args(arguments)
if args.background_color == 'None':
args.background_color = None
if args.colormask and args.color:
raise ValueError('specify either a color mask or a color function')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment