Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
internaut committed Jul 30, 2020
2 parents 9e607c0 + 889b50a commit 2a5845c
Show file tree
Hide file tree
Showing 31 changed files with 393 additions and 616 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ lda/_lda.c

# Project-specific
.testrepository

# PyCharm
.idea
AUTHORS
ChangeLog
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
dist: xenial
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
Expand Down
29 changes: 15 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
lda: Topic modeling with latent Dirichlet allocation
====================================================

|pypi| |travis| |zenodo|
|zenodo|

``lda`` implements latent Dirichlet allocation (LDA) using collapsed Gibbs
sampling. ``lda`` is fast and is tested on Linux, OS X, and Windows.
sampling. ``lda`` is fast and is tested on Linux, OS X, and Windows. This is
a maintainance fork of the original code for newer Python versions.

You can read more about lda in `the documentation <https://lda.readthedocs.io>`_.

.. note::
This is a fork of the original `lda package <https://github.com/lda-project/lda>`_ developed by
`Allan Riddell <https://github.com/ariddell>`_ to maintain the package for newer Python versions, OS versions and
dependencies. The only difference to the original implementation are compatibility fixes implemented for this
purpose. This fork specifically provides wheels (installable binary packages) for Python 3.6 to Python 3.8 on
Linux, MacOS and Windows 10.

Installation
------------

``pip install lda``
``pip install ldafork``

Getting started
---------------
Expand Down Expand Up @@ -86,7 +94,8 @@ The document-topic distributions are available in ``model.doc_topic_``.
Requirements
------------
Python 2.7 or Python 3.5+ is required. The following packages are required
Python 3.6+ is required. The following packages are required and will be installed along with with *ldafork* when you
use *pip*:
- numpy_
- pbr_
Expand Down Expand Up @@ -137,14 +146,6 @@ lda is licensed under Version 2.0 of the Mozilla Public License.
.. _Pritchard et al. (2000): http://www.genetics.org/content/155/2/945.full
.. _Griffiths and Steyvers (2004): http://www.pnas.org/content/101/suppl_1/5228.abstract

.. |pypi| image:: https://badge.fury.io/py/lda.png
:target: https://pypi.python.org/pypi/lda
:alt: pypi version

.. |travis| image:: https://travis-ci.org/lda-project/lda.png?branch=master
:target: https://travis-ci.org/lda-project/lda
:alt: travis-ci build status

.. |zenodo| image:: https://zenodo.org/badge/doi/10.5281/zenodo.57927.svg
:target: https://doi.org/10.5281/zenodo.57927
.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.1412135.svg
:target: https://doi.org/10.5281/zenodo.1412135
:alt: Zenodo citation
215 changes: 143 additions & 72 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,138 @@
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\continuous_integration\\appveyor\\run_with_env.cmd"
WHEELHOUSE_UPLOADER_REGION: IAD
WHEELHOUSE_UPLOADER_USERNAME: lda-worker
WHEELHOUSE_UPLOADER_SECRET:
secure: qN7Dwv5Z8GM8yurirfjBaxcrxsJOz7xbwwJSor4YcknMGZFXpRp1U8S0rv//edTn
#
# build configuration for appveyor.com
#

#
# OS versions to build on
#

image:
- Visual Studio 2019
- macOS
- macOS-Mojave
# - Ubuntu
# - Ubuntu2004

#
# Python versions to build on
#

environment:
matrix:

# Pre-installed Python versions, which Appveyor may upgrade to
# a later point release.
# See: http://www.appveyor.com/docs/installed-software#python

- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
- PYTHON_VERSION: "3.6.x"
PYTHON_WIN: "C:\\Python36"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
- PYTHON_VERSION: "3.6.x"
PYTHON_WIN: "C:\\Python36-x64"
PYTHON_UNIX: "venv3.6"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
- PYTHON_VERSION: "3.7.x"
PYTHON_WIN: "C:\\Python37"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
- PYTHON_VERSION: "3.7.x"
PYTHON_WIN: "C:\\Python37-x64"
PYTHON_UNIX: "venv3.7"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
- PYTHON_VERSION: "3.8.x"
PYTHON_WIN: "C:\\Python38"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
- PYTHON_VERSION: "3.8.x"
PYTHON_WIN: "C:\\Python38-x64"
PYTHON_UNIX: "venv3.8"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"
matrix:
exclude:
- image: macOS
PYTHON_ARCH: "32" # 32bit only for Windows
- image: macOS-Mojave
PYTHON_ARCH: "32" # 32bit only for Windows
# - image: Ubuntu
# PYTHON_ARCH: "32" # 32bit only for Windows
# - image: Ubuntu2004
# PYTHON_ARCH: "32" # 32bit only for Windows

#
# Windows-specific build steps
#

for:
-
matrix:
only:
- image: Visual Studio 2019

install:
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON_WIN%;%PYTHON_WIN%\\Scripts;%PATH%"

# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install wheel"
- "%CMD_IN_ENV% pip install -r requirements.txt"
- "%CMD_IN_ENV% pip install -r test-requirements.txt"
- "%CMD_IN_ENV% cython lda/_lda.pyx"
# build the wheel and install it
- "%CMD_IN_ENV% python setup.py bdist_wheel bdist_wininst"
- ps: "ls dist"

# Install the generated wheel package to test it
- "pip install --pre --no-index --find-links dist/ ldafork"


#
# MacOS-specific build steps
#

-
matrix:
only:
- image: macOS
- image: macOS-Mojave
# - image: Ubuntu
# - image: Ubuntu2004

install:
- "echo $HOME"
- "source $HOME/$PYTHON_UNIX/bin/activate"
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "pip install wheel"
- "pip install -r requirements.txt"
- "pip install -r test-requirements.txt"
- "make cython"
- "python setup.py bdist_wheel"
- "ls dist"

# Install the generated wheel package to test it
- "pip install --pre --no-index --find-links dist/ ldafork"

install:
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & continuous_integration\appveyor\install.ps1 }

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "python -m pip install --disable-pip-version-check --user --upgrade pip"

# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r ./continuous_integration/appveyor/requirements.txt"
- "%CMD_IN_ENV% pip install -r requirements.txt"
- "%CMD_IN_ENV% pip install -r test-requirements.txt"
- "%CMD_IN_ENV% cython lda/_lda.pyx"
# build the wheel and install it
- "%CMD_IN_ENV% python setup.py bdist_wheel bdist_wininst"
- ps: "ls dist"

# Install the generated wheel package to test it
- "pip install --pre --no-index --find-links dist/ lda"

build: false # building occurs during install above

#
# testing steps
#

test_script:
# Change to a non-source folder to make sure we run the tests on the
# installed library.
Expand All @@ -94,11 +142,34 @@ test_script:
# Move back to the project folder
- "cd .."

after_test:
# If tests are successful, create binary packages for the project.
# TODO: may need to set PBR_VERSION, submodules often confuse pbr
- "%CMD_IN_ENV% python setup.py bdist_wheel"
- ps: "ls dist"
# APPVEYOR_REPO_TAG will be true if commit is tagged
- "IF /I %APPVEYOR_REPO_TAG%==true (%CMD_IN_ENV% pip install wheelhouse-uploader)"
- "IF /I %APPVEYOR_REPO_TAG%==true (%CMD_IN_ENV% python -m wheelhouse_uploader upload --local-folder=dist --no-ssl-check --no-update-index --region=IAD wheels)"
#
# generated downloadable wheels
#

artifacts:
- path: 'dist\*.whl'

deploy:
- provider: GitHub
description: 'ldafork wheel package for version $(APPVEYOR_REPO_TAG_NAME)'
tag: $(APPVEYOR_REPO_TAG_NAME)
release: ldafork-$(APPVEYOR_REPO_TAG_NAME)
auth_token:
secure: flEOzMzdOLZZKb5B+n4RAWJumMH20t+IDZYV5gXnykT9IWqO/XqQBdZuGQwkQ49M
artifact: /.*\.whl/
draft: false
prerelease: false
on:
APPVEYOR_REPO_TAG: true # deploy on tag push only

# - provider: GitHub
# description: 'ldafork wheel package for current development version'
# tag: current-develop
# release: ldafork-current-develop
# auth_token:
# secure: flEOzMzdOLZZKb5B+n4RAWJumMH20t+IDZYV5gXnykT9IWqO/XqQBdZuGQwkQ49M
# artifact: /.*\.whl/
# draft: false
# prerelease: true
# on:
# branch: develop
34 changes: 0 additions & 34 deletions build_dist.sh

This file was deleted.

17 changes: 17 additions & 0 deletions build_manylinux_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

#
# Start the manylinux wheel building process on docker
# Set the correct user and group for the generated wheels
#

if ! [ `id -u` -eq 0 ]; then
echo "you should run this as root"
exit 1
fi

docker run --rm -e PLAT=manylinux1_x86_64 -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/build_wheels.sh
docker run --rm -e PLAT=manylinux1_i686 -v `pwd`:/io quay.io/pypa/manylinux1_i686 /io/build_wheels.sh

setuser=`stat -c '%U:%G' .`
chown $setuser dist/*.whl
Loading

0 comments on commit 2a5845c

Please sign in to comment.