Skip to content
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

pip install: discussion #1008

Open
wants to merge 204 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
382c775
fix keywords and metadata
bt2901 Dec 20, 2019
58207e2
fix lib name
bt2901 Dec 20, 2019
33e0807
test fix
bt2901 Dec 20, 2019
9499aba
fix typo
bt2901 Dec 21, 2019
f00249d
rename 'async' to 'asynchronous' in order to support python 3.7
bt2901 Dec 21, 2019
a8947fb
Bump version number to v0.9.2
bt2901 Dec 23, 2019
eac0df8
cherry-pick #928
AVBelyy Oct 17, 2018
b22d5de
Prefer packaged libartm over system
Nyoroon Aug 1, 2018
db4b907
Change base class for ArtmException
bt2901 Apr 27, 2019
17e3726
Remove outdated :param descriptions in filter().
AnyaP May 5, 2019
5ad51df
merge
bt2901 Sep 13, 2019
865fb58
update travis and drop py2 from appveyor
bt2901 Dec 24, 2019
f91fbca
small QoL fix
bt2901 Mar 24, 2020
3c0df67
test minimal travis configuration
bt2901 Mar 25, 2020
16fc093
test commit
bt2901 Mar 25, 2020
37d069d
some dark confluent magic with unknown result
bt2901 Mar 26, 2020
ee8eff5
even more dark confluent magic with unknown result
bt2901 Mar 26, 2020
a5b8d4d
conflux
bt2901 Mar 26, 2020
c55435c
whoops
bt2901 Mar 26, 2020
e0ee21e
wtf
bt2901 Mar 26, 2020
19f407f
Ceald, Conflux
bt2901 Mar 26, 2020
fe703a1
Electrising, Conflux
bt2901 Mar 26, 2020
302f36b
Elementon, Conflux
bt2901 Mar 26, 2020
81c6122
Elementon2, Conflux
bt2901 Mar 27, 2020
de7e788
Elementon3, Conflux
bt2901 Mar 27, 2020
ceb53f9
Elementon4, Conflux
bt2901 Mar 27, 2020
1f4dd74
add debug
bt2901 Mar 27, 2020
ab47922
add debug correctly
bt2901 Mar 27, 2020
2aa8f75
quietus?
bt2901 Mar 27, 2020
bb88a72
reparo?
bt2901 Mar 27, 2020
6fbd73d
plz
bt2901 Mar 27, 2020
f7b4a84
plz again
bt2901 Mar 27, 2020
d4b78fb
plz with cherry on top
bt2901 Mar 27, 2020
d7c9763
lost commit
bt2901 Mar 27, 2020
de7a532
maybe this?
bt2901 Mar 27, 2020
3600c2e
maybe that?
bt2901 Mar 27, 2020
39e9efd
Fenderen, Conflux
bt2901 Mar 27, 2020
74f3310
New Fenderen, Conflux
bt2901 Mar 27, 2020
30fe7aa
Newer Fenderen, Conflux
bt2901 Mar 27, 2020
7a65d88
Quietus again
bt2901 Mar 27, 2020
2707174
Quietus Maxima
bt2901 Mar 27, 2020
01eb46b
isn't it funny that all I do is change verbosity in some places?
bt2901 Mar 27, 2020
3936d14
I decrease verbosity of boost build because of Travis but increasing …
bt2901 Mar 27, 2020
614b1db
do not tell anyone I forgot this line
bt2901 Mar 27, 2020
f1fe3dc
so it goes
bt2901 Mar 27, 2020
e2ac68e
is 30th time the charm?
bt2901 Mar 27, 2020
0d38e97
is travis an imperative form of 'travitsya'?
bt2901 Mar 27, 2020
3223dc7
travis otravilsya :(
bt2901 Mar 27, 2020
2371aa9
aws?
bt2901 Mar 27, 2020
70a0ce2
aws west 1?
bt2901 Mar 27, 2020
df0d025
all eggs in a single bucket
bt2901 Mar 27, 2020
0256826
Fleogan Mills, Conflux
bt2901 Mar 27, 2020
5348c02
very weird change
bt2901 Mar 27, 2020
4e21f0b
whoops
bt2901 Mar 27, 2020
d23d0b3
maybe this?
bt2901 Mar 28, 2020
2d82284
only py36 shall survive
bt2901 Mar 28, 2020
dbd1f42
absolute pathes maybe fix
bt2901 Mar 28, 2020
f03ada9
no, it was not working
bt2901 Mar 28, 2020
29782ea
absolute pathes in venvs fix
bt2901 Mar 28, 2020
5f6606a
another way to detect venv probably
bt2901 Mar 28, 2020
bade8ad
dealing with macos
bt2901 Mar 28, 2020
39cfb8a
I'm starting to think I'm not very good at this
bt2901 Mar 28, 2020
8b8e763
forgot about my ingenious hack yaaay!
bt2901 Mar 28, 2020
8faa7c1
my potions are too strong for you traveler
bt2901 Mar 28, 2020
e46f444
deep in my code access denied
bt2901 Mar 28, 2020
d39d957
I feel it in my code
bt2901 Mar 28, 2020
7ec51a9
Enough to make my core explode!
bt2901 Mar 28, 2020
13fa159
All systems go! My chip hasn't fried!
bt2901 Mar 28, 2020
add2576
I need a body! Give me a body!
bt2901 Mar 28, 2020
ccc68c1
I'm a bad turret... I suppose.
bt2901 Mar 28, 2020
05905f5
It's painted white, I'll fit right in!
bt2901 Mar 28, 2020
ecd4c84
It didn't work, I'm about to be...
bt2901 Mar 28, 2020
db492e1
INCINERATED!
bt2901 Mar 28, 2020
a5e84ba
NOOO! NOOO! I'm not defective!
bt2901 Mar 28, 2020
7a8047b
start merging #597
bt2901 Apr 1, 2020
a802074
create two separate setup.py
bt2901 Apr 2, 2020
4ddc4c1
invoke gen_proto inside CMakeLists.txt
bt2901 Apr 12, 2020
0aae7c1
fix KeyError
bt2901 Apr 12, 2020
36104fa
fix KeyError correctly
bt2901 Apr 12, 2020
fbc7783
hopefully fix static linking issue
bt2901 Apr 12, 2020
02456e7
maybe fix
bt2901 Apr 12, 2020
7738315
add some black magic
bt2901 Apr 12, 2020
41c3d76
remove doubled macosx cmake code
bt2901 Apr 12, 2020
7291688
hopefully this will fix something
bt2901 Apr 12, 2020
f33929d
fix pathes
bt2901 Apr 12, 2020
7cf3d6c
here we go
bt2901 Apr 12, 2020
1712dbe
here we go again
bt2901 Apr 12, 2020
b524a8f
nobody saw anything
bt2901 Apr 12, 2020
6319ebe
why did name changed?
bt2901 Apr 12, 2020
9739cc7
this is not needed for osx
bt2901 Apr 12, 2020
e32876d
try this
bt2901 Apr 13, 2020
3d33528
try this
bt2901 Apr 13, 2020
97675ef
debug with warnings \o/
bt2901 Apr 13, 2020
5813b89
debug with warnings \o/ \o/
bt2901 Apr 13, 2020
fae1717
debug with warnings \o/ \o/ \o/
bt2901 Apr 13, 2020
512df76
debug with crashes /o\ /o\ /o\
bt2901 Apr 13, 2020
45f1244
path to enlightenment 💡
bt2901 Apr 13, 2020
7737123
⚙️
bt2901 Apr 13, 2020
a7022a1
🔧 ⚙️
bt2901 Apr 13, 2020
f8f58b2
🔧 ⚙️ 🔨
bt2901 Apr 13, 2020
14fd2d6
⚙️ 🔨 >_<
bt2901 Apr 13, 2020
0bc80d3
>_< ⚙️ >_<
bt2901 Apr 13, 2020
acf96e7
>_< ⚙️ >_< >_<
bt2901 Apr 13, 2020
b2e7c0b
will it magically fix everything?
bt2901 Apr 13, 2020
960bcaf
will it magically break everything?
bt2901 Apr 13, 2020
34e33ba
will it magically have no effect on anything?
bt2901 Apr 13, 2020
e9d19b4
How many roads must a man walk down?
bt2901 Apr 13, 2020
9fb4686
debugging macosx
bt2901 Apr 13, 2020
9245b08
be more assertive
bt2901 Apr 13, 2020
20c439d
be even more assertive
bt2901 Apr 13, 2020
9fe45e4
be even differently assertive
bt2901 Apr 13, 2020
9f506c5
move stuff to setup.cfg
bt2901 Apr 14, 2020
b70b186
remove ]
bt2901 Apr 14, 2020
c61d63d
cleaning up the battlefield
bt2901 Apr 14, 2020
0d78d80
I missed one chdir
bt2901 Apr 14, 2020
85f0b8e
where do I put my libraries?
bt2901 Apr 14, 2020
c405df6
debugging with exceptions
bt2901 Apr 14, 2020
41f05f2
debugging with exceptions again
bt2901 Apr 15, 2020
b2d861c
...what if..?
bt2901 Apr 15, 2020
baa53d1
ok, sorry..?
bt2901 Apr 15, 2020
b21930c
step back and rethink
bt2901 Apr 15, 2020
cc46248
import
bt2901 Apr 15, 2020
467d136
fix
bt2901 Apr 15, 2020
6fb9764
debug
bt2901 Apr 15, 2020
b8dfad4
maybe like this
bt2901 Apr 15, 2020
b78bae9
maybe like that
bt2901 Apr 15, 2020
9cb0991
maybe like that
bt2901 Apr 15, 2020
e5d4dc4
ok, so this
bt2901 Apr 15, 2020
87803d4
implement some of Czaki suggestions
bt2901 Apr 15, 2020
bbaeef2
clean up prepare scripts
bt2901 Apr 15, 2020
31822f7
debug search for packages
bt2901 Apr 16, 2020
bda6101
fix debug search for packages
bt2901 Apr 16, 2020
6153685
trying to expand to 37 and 38
bt2901 Apr 16, 2020
aeb6048
fix paths in gen_proto
bt2901 Apr 16, 2020
5befd01
:( debug
bt2901 Apr 16, 2020
36afc7d
try to generate proto files
bt2901 Apr 16, 2020
ac47fe2
try to generate proto files again
bt2901 Apr 16, 2020
6688585
try to generate proto files once more
bt2901 Apr 16, 2020
6841158
try to debug proto files generation
bt2901 Apr 16, 2020
f78e22b
sudo is bad mkay?
bt2901 Apr 16, 2020
138b4d6
sudo is very bad mkay?
bt2901 Apr 16, 2020
a1a512a
sudo is very bad mkay?
bt2901 Apr 16, 2020
c2b381f
dbg
bt2901 Apr 16, 2020
dbeae77
ok, what if without make?
bt2901 Apr 16, 2020
8d7ed59
ok, fixed
bt2901 Apr 16, 2020
9874387
check for stupid stuff
bt2901 Apr 17, 2020
71d6b78
fix chmod, revert make
bt2901 Apr 17, 2020
984d8c1
fix python invokation
bt2901 Apr 17, 2020
b466abf
fix path maybe
bt2901 Apr 18, 2020
b035941
mo' debug
bt2901 Apr 18, 2020
3143aa9
mo' debug
bt2901 Apr 18, 2020
e4780c2
mo' debug
bt2901 Apr 18, 2020
d13b8e0
mo' debug 2
bt2901 Apr 18, 2020
eaf6443
mo' debug 2a
bt2901 Apr 18, 2020
10eb8d5
mo' debug 2ab
bt2901 Apr 18, 2020
5ff35b2
mo' debug 3
bt2901 Apr 18, 2020
3080455
mo' debug 3a
bt2901 Apr 18, 2020
89cfa09
mo' debug 4
bt2901 Apr 18, 2020
f59c57f
mo' debug 5
bt2901 Apr 18, 2020
13d1a76
mo' python versiona
bt2901 Apr 18, 2020
bfc1792
debug dst_path
bt2901 Apr 20, 2020
5f2372b
debug dst_path again
bt2901 Apr 20, 2020
6c88629
debug dst_path again 2
bt2901 Apr 20, 2020
34e6629
debug dst_path again 3
bt2901 Apr 20, 2020
510ffd0
debug dst_path again 4
bt2901 Apr 20, 2020
656b01b
debug dst_path again 4
bt2901 Apr 20, 2020
5e8cfb6
fix proto paths
bt2901 Apr 20, 2020
4de6606
more pythons
bt2901 Apr 21, 2020
7a2cec2
add: debug, cleanup, moving of libartm
bt2901 Apr 27, 2020
782b2d4
add more debug
bt2901 Apr 27, 2020
326e886
more cleanup
bt2901 Apr 27, 2020
5a62ea5
more cleanup
bt2901 Apr 28, 2020
541dfad
fix error reporting, lets install boost on macos too
bt2901 Apr 28, 2020
bd6b8d6
revert building boost
bt2901 Apr 28, 2020
c461b49
squashed commit
bt2901 May 2, 2020
7ea1fcf
add 5th place
bt2901 May 9, 2020
4c04616
clean up and fix long_description for PyPi
bt2901 May 25, 2020
9c532e4
fix once again
bt2901 May 25, 2020
146a3d8
fix once more
bt2901 May 25, 2020
a0cc544
maybe this is hopeless
bt2901 May 25, 2020
b7469be
giving up gracefully
bt2901 May 25, 2020
cf0714b
what is happening
bt2901 May 25, 2020
2c6f723
ok, that was stupid
bt2901 May 25, 2020
150d70e
[TEST] trying a new thing
bt2901 Nov 8, 2020
460ba91
[TEST] even more suboptimal work
bt2901 Nov 8, 2020
6eea3bf
[TEST] run tests only on Linux
bt2901 Nov 8, 2020
9094084
[TEST] merge
bt2901 Nov 8, 2020
47bd14c
[TEST] change version of pandas
bt2901 Nov 8, 2020
e690270
[TEST] sorryan
bt2901 Nov 8, 2020
c9f44c4
[TEST] now merge everything correctly
bt2901 Nov 8, 2020
0dba0d2
[TEST] mess with code style on purpose
bt2901 Nov 8, 2020
f95a46a
[TEST] fail faster?
bt2901 Nov 8, 2020
d3d641e
[TEST] fail louder?
bt2901 Nov 8, 2020
ce228e1
Revert "[TEST] mess with code style on purpose"
bt2901 Nov 8, 2020
36ef28e
[TEST] disabling codestyle check for now (see #1035)
bt2901 Nov 8, 2020
5e5e435
better error handling
bt2901 Nov 9, 2020
e5bb722
[TEST] building wheels only when explicitly requested
bt2901 Nov 9, 2020
9c2015b
merge
bt2901 Nov 9, 2020
851c7ef
Merge branch 'regs_warnings' into setup_test
bt2901 Nov 9, 2020
d9492c1
[TEST] will it pass now?
bt2901 Nov 9, 2020
02ea32a
allow developers to install BigARTM locally [TEST][WHL]
bt2901 Nov 9, 2020
0282ab9
add some dependencies
bt2901 Nov 9, 2020
541a5bd
[WHL] fix artifacts uploading
bt2901 Nov 9, 2020
708698a
ok, i wont be fancy with artifacts
bt2901 Nov 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
116 changes: 54 additions & 62 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,64 @@
sudo: false
language: python

language:
- python
# Currently Travis doesn't support multiple values for language variable
# - cpp

#compiler:
# - gcc
addons:
artifacts:
# warning: works only with some regions
# see https://github.com/travis-ci/artifacts/issues/57
# see https://github.com/travis-ci/travis-ci/issues/5318
s3_region: us-west-1
working_dir: wheelhouse
# Below 3 values are configured as environmental variables in Travis web console
access_key_id: $ARTIFACTS_KEY
secret_access_key: $ARTIFACTS_SECRET
bucket: $ARTIFACTS_BUCKET

# not sure whether the following configuration will be available
# with non-C/C++ language (e.g python)
#cache: ccache

cache:
directories:
- $HOME/.ccache
jobs:
include:
# perform a linux build
- os: linux
dist: trusty
env:
- CIBW_MANYLINUX_X86_64_IMAGE="manylinux1"
- CIBW_BEFORE_BUILD="tools/prepare-cibuildwheel-linux.sh"
- CIBW_BUILD=cp3*
- CIBW_SKIP="cp35-* *-manylinux_i686"
services: docker

python:
- "2.7"
- "3.4"
- "3.5"
# and a mac build
- os: osx
language: shell
env:
- CIBW_REPAIR_WHEEL_COMMAND="delocate-listdeps {wheel} && delocate-wheel -v --require-archs x86_64 -w {dest_dir} {wheel} && ls {dest_dir}"
- CIBW_BEFORE_BUILD="tools/prepare-cibuildwheel-macosx.sh"
- CIBW_BUILD=cp3*
- CIBW_SKIP="cp35-*"
# and a windows build
# - os: windows
# language: shell
# before_install:
# - choco install python --version 3.8.0
# - export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
# # make sure it's on PATH as 'python3'
# - ln -s /c/Python38/python.exe /c/Python38/python3.exe
#- CIBW_SKIP="*-win32 *-manylinux_i686"

addons:
apt:
sources:
- boost-latest # for boost 1.55
- ubuntu-toolchain-r-test # for g++-4.9
- george-edison55-precise-backports # for cmake 3
packages:
- cmake
- cmake-data
- libboost1.55-all-dev
- g++-4.9
- gcc-4.9
install:
- python3 -m pip install cibuildwheel==1.3.0

env:
global:
# variables for caching
- CCACHE_DIR=$HOME/.ccache
- CCACHE_COMPILERCHECK=content
- CCACHE_COMPRESS=true
- CCACHE_NODISABLE=true
- CCACHE_MAXSIZE=500M
matrix:
- GCC_VER=4.9
script:
# build the wheels, put them into './wheelhouse'

before_install:
# we need latest pip to work with only-binary option
- pip install -U pip
- pip install -U pytest pep8 wheel
- pip install -U numpy scipy pandas tqdm --only-binary numpy scipy pandas
- pip install protobuf==3.0.0
# configure ccache
# code from https://github.com/urho3d/Urho3D/blob/master/.travis.yml
- export PATH=$(whereis -b ccache |grep -o '\S*lib\S*'):$PATH
- export CXX=g++-$GCC_VER CC=gcc-$GCC_VER
- for compiler in gcc g++; do ln -s $(which ccache) $HOME/$compiler-$GCC_VER; done && export PATH=$HOME:$PATH
# quick fix for
# "Invalid binary wheel, found the following shared library/libraries in purelib folder:"
# see github.com/pypa/auditwheel/pull/28#issuecomment-212082647
# TODO: maybe this is no longer needed because BigARTM is compiled as extension now
- |
if [[ $TRAVIS_OS_NAME == linux ]]; then
echo $CIBW_MANYLINUX_X86_64_IMAGE
echo -e "[install]\ninstall_lib=" >> setup.cfg
fi

install:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then ./codestyle_checks.sh; fi
- mkdir build
- pushd build && cmake -DBUILD_BIGARTM_CLI_STATIC=OFF .. && make -j2 && file ./bin/bigartm && popd
- pushd python && python setup.py install && popd
- python3 -m cibuildwheel --output-dir wheelhouse

before_script:
- pushd test_data && ./download_datasets.sh && popd

script:
- export ARTM_SHARED_LIBRARY=`pwd`/build/lib/libartm.so
- export BIGARTM_UNITTEST_DATA=`pwd`/test_data
- pushd build && make test ARGS="-V" && popd
61 changes: 61 additions & 0 deletions .travis_old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
language:
- python
# Currently Travis doesn't support multiple values for language variable
# - cpp

#compiler:
# - gcc

# not sure whether the following configuration will be available
# with non-C/C++ language (e.g python)
#cache: ccache

cache:
directories:
- $HOME/.ccache

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

env:
global:
# variables for caching
- CCACHE_DIR=$HOME/.ccache
- CCACHE_COMPILERCHECK=content
- CCACHE_COMPRESS=true
- CCACHE_NODISABLE=true
- CCACHE_MAXSIZE=500M
matrix:
- GCC_VER=4.9

before_install:
# we need latest pip to work with only-binary option
- pip install -U pip
- pip install -U pytest pep8 wheel pytest-forked
- pip install -U numpy scipy pandas tqdm --only-binary numpy scipy pandas
- pip install protobuf
# install boost
- sudo add-apt-repository universe
- sudo apt-get update
- sudo apt-get install libboost-all-dev
# configure ccache
# code from https://github.com/urho3d/Urho3D/blob/master/.travis.yml
- export PATH=$(whereis -b ccache |grep -o '\S*lib\S*'):$PATH
- export CXX=g++ CC=gcc PATH=$HOME:$PATH

install:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then ./codestyle_checks.sh; fi
- mkdir build
- pushd build && cmake -DBUILD_BIGARTM_CLI_STATIC=OFF .. && make -j2 && file ./bin/bigartm && popd
- pushd python && python setup.py install && popd

before_script:
- pushd test_data && ./download_datasets.sh && popd

script:
- export ARTM_SHARED_LIBRARY=`pwd`/build/lib/libartm.so
- export BIGARTM_UNITTEST_DATA=`pwd`/test_data
- pushd build && make test ARGS="-V" && popd
2 changes: 1 addition & 1 deletion 3rdparty/glog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ else()
endif()
endif()

mz_add_flag(GCC -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare)
mz_add_flag(GCC -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare)
add_library(google-glog STATIC ${SRCS} ${HDRS})
target_link_libraries(google-glog ${GFLAGS_LIBRARY} ${GLOG_3LIBS})
set_property(TARGET google-glog PROPERTY VERSION 0.3.3)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/glog/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ endif()

# compiler flags
mz_add_definition(${CMAKE_SYSTEM_PROCESSOR}=1)
mz_add_flag(GCC -Wall -Werror -Wno-unused-function)
mz_add_flag(GCC -Werror -Wno-unused-function)
if(WINDOWS)
mz_add_definition(WIN32=1 WINDOWS=1)
elseif(IOS)
Expand Down
1 change: 0 additions & 1 deletion 3rdparty/protobuf-3.0.0/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ licenses(["notice"])

COPTS = [
"-DHAVE_PTHREAD",
"-Wall",
"-Wwrite-strings",
"-Woverloaded-virtual",
"-Wno-sign-compare",
Expand Down
26 changes: 19 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.12)

project(BigARTM)

Expand All @@ -7,7 +7,9 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
enable_testing()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

set(3RD_PARTY_DIR ${CMAKE_SOURCE_DIR}/3rdparty)
Expand All @@ -31,12 +33,22 @@ else (MSVC)
message("-- Build type: ${CMAKE_BUILD_TYPE}")
endif (MSVC)

option(BUILD_TESTS "Indicates whether to build artm_tests" ON)
option(BUILD_BIGARTM_CLI "Indicates whether to build bigartm-CLI executable" ON)
option(BUILD_INTERNAL_PYTHON_API "Indicates whether to build Python API" ON)

set(PYTHON python CACHE INTERNAL "Python command")

if (BUILD_PIP_DIST)
message("BUILD_PIP_DIST")
add_custom_target(python_generate_proto ALL
${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/python/gen_proto.py --protoc_executable=$<TARGET_FILE:protoc>
COMMENT "Generating python protobuf files"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(python_generate_proto protoc)
else (BUILD_PIP_DIST)
option(BUILD_TESTS "Indicates whether to build artm_tests" ON)
option(BUILD_BIGARTM_CLI "Indicates whether to build bigartm-CLI executable" ON)
option(BUILD_INTERNAL_PYTHON_API "Indicates whether to build Python API" ON)
endif (BUILD_PIP_DIST)


if (BUILD_BIGARTM_CLI AND UNIX AND NOT APPLE)
option(BUILD_BIGARTM_CLI_STATIC "Request build of static executable bigartm (for Linux only)" ON)
endif (BUILD_BIGARTM_CLI AND UNIX AND NOT APPLE)
Expand All @@ -59,7 +71,7 @@ check_include_files(unistd.h HAVE_UNISTD_H)
# set compiler flags
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pthread -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Wall")
set(GFLAGS_INTTYPES_FORMAT "C99")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
Expand Down
3 changes: 0 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ environment:
- PYTHON_VERSION: 3.6
MINICONDA: C:\Miniconda36-x64

- PYTHON_VERSION: 2.7
MINICONDA: C:\Miniconda-x64

# scripts that are called at very beginning, before repo cloning
init:
- cmd: cmake --version
Expand Down
11 changes: 9 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ if (BUILD_INTERNAL_PYTHON_API)
if (BUILD_TESTS)
add_subdirectory(tests)
endif (BUILD_TESTS)
add_custom_target(python_generate_proto ALL
${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/gen_proto.py --protoc_executable=$<TARGET_FILE:protoc>
COMMENT "Generating python protobuf files"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_dependencies(python_generate_proto protoc)



# perform "python setup.py build" during executing make
add_custom_target(python_bigartm_build ALL
${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/setup.py build --protoc_executable=$<TARGET_FILE:protoc>
${PYTHON} ${CMAKE_CURRENT_LIST_DIR}/setup.py build
COMMENT "Building python package bigartm"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_dependencies(python_bigartm_build protoc)
add_dependencies(python_bigartm_build python_generate_proto)
add_custom_target(python_bigartm_wheel ALL
${CMAKE_COMMAND} -E env ARTM_SHARED_LIBRARY=$<TARGET_FILE:artm> ${PYTHON} setup.py bdist_wheel -d ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building wheel bigartm"
Expand Down
Empty file added python/__init__.py
Empty file.
31 changes: 17 additions & 14 deletions python/artm/artm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
PARAMETERS_FILENAME_BIN = 'parameters.bin'


def _run_from_ipython():
def _run_from_notebook():
try:
get_ipython().config
return True
except:
shell = get_ipython().__class__.__name__
return shell == 'ZMQInteractiveShell'
except: # noqa
return False


Expand Down Expand Up @@ -92,8 +92,8 @@ def _topic_selection_regularizer_func(self, regularizers):


class ArtmThreadPool(object):
def __init__(self, async=True):
self._pool = ThreadPool(processes=1) if async else None
def __init__(self, asynchronous=True):
self._pool = ThreadPool(processes=1) if asynchronous else None

def apply_async(self, func, args):
return self._pool.apply_async(func, args) if self._pool else func(*args)
Expand Down Expand Up @@ -188,7 +188,7 @@ def __init__(self, num_topics=None, topic_names=None, num_processors=None, class
self._theta_columns_naming = 'id'
self._seed = -1
self._show_progress_bars = show_progress_bars
self._pool = ArtmThreadPool(async=show_progress_bars)
self._pool = ArtmThreadPool(asynchronous=show_progress_bars)

if topic_names is not None:
self._topic_names = topic_names
Expand Down Expand Up @@ -511,7 +511,7 @@ def _wait_for_batches_processed(self, async_result, num_batches):
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
progress = tqdm.tqdm_notebook if _run_from_ipython() else tqdm.tqdm
progress = tqdm.tqdm_notebook if _run_from_notebook() else tqdm.tqdm
with progress(total=num_batches, desc='Batch', leave=False,
disable=not self._show_progress_bars) as batch_tqdm:
previous_num_batches = 0
Expand Down Expand Up @@ -544,7 +544,7 @@ def fit_offline(self, batch_vectorizer=None, num_collection_passes=1, reset_nwt=
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
progress = tqdm.tnrange if _run_from_ipython() else tqdm.trange
progress = tqdm.tnrange if _run_from_notebook() else tqdm.trange
for _ in progress(num_collection_passes, desc='Pass',
disable=not self._show_progress_bars):
# temp code for easy using of TopicSelectionThetaRegularizer from Python
Expand All @@ -565,7 +565,7 @@ def fit_offline(self, batch_vectorizer=None, num_collection_passes=1, reset_nwt=
self._phi_cached = None

def fit_online(self, batch_vectorizer=None, tau0=1024.0, kappa=0.7, update_every=1,
apply_weight=None, decay_weight=None, update_after=None, async=False):
apply_weight=None, decay_weight=None, update_after=None, asynchronous=False):
"""
:Description: proceeds the learning of topic model in online mode

Expand All @@ -579,10 +579,10 @@ def fit_online(self, batch_vectorizer=None, tau0=1024.0, kappa=0.7, update_every
:type apply_weight: list of float
:param decay_weight: weight of applying old counters
:type decay_weight: list of float
:param bool async: use or not the async implementation of the EM-algorithm
:param bool asynchronous: use or not the asynchronous implementation of the EM-algorithm

:Note:
async=True leads to impossibility of score extraction via score_tracker.\
asynchronous=True leads to impossibility of score extraction via score_tracker.\
Use get_score() instead.

:Update formulas:
Expand Down Expand Up @@ -625,7 +625,7 @@ def fit_online(self, batch_vectorizer=None, tau0=1024.0, kappa=0.7, update_every
self._pool.apply_async(func=self.master.fit_online,
args=(batch_vectorizer.batches_ids, batch_vectorizer.weights,
update_after_final, apply_weight_final,
decay_weight_final, async)),
decay_weight_final, asynchronous)),
batch_vectorizer.num_batches)

for name in self.scores.data.keys():
Expand Down Expand Up @@ -1090,7 +1090,10 @@ def reshape(self, topic_names=None, dictionary=None):
return

def __repr__(self):
num_tokens = next((x.num_tokens for x in self.info.model if x.name == self._model_pwt), None)
if self.master is not None:
num_tokens = next((x.num_tokens for x in self.info.model if x.name == self._model_pwt), None)
else:
num_tokens = "<UNKNOWN>"
class_ids = ', class_ids={0}'.format(list(self.class_ids.keys())) if self.class_ids else ''
return 'artm.ARTM(num_topics={0}, num_tokens={1}{2})'.format(
self.num_topics, num_tokens, class_ids)
Expand Down