Skip to content

Commit

Permalink
Set pyproject.toml (#3821)
Browse files Browse the repository at this point in the history
* Set pyproject.toml

* Set pyproject.toml based on requirements

* Modify the installation to use Poetry

* Remove the requirements files

* fix install bash

* add gitignore poetry.lock .venv .python-version

* update pyproject.toml for package_dir include

* move doc/source/* -> doc/source/fiftyone/*

* apply pyproject.toml from to python-poetry/poetry#8770

* move doc/source/fiftyone/* -> doc/source/*

* restore requirements

* install bash with setup py

* update docs/source/conf.py to latest

* restore settings docs/source/fiftyone -> docs/source

* create install_by_poetry.bash

* restore setup.py docs/source/fiftyone -> docs/source
  • Loading branch information
bigstones authored Jan 10, 2024
1 parent 376d20a commit d8eb906
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ dist/
coverage.xml
.coverage.*
pyvenv.cfg

.venv
poetry.lock
.python-version
162 changes: 162 additions & 0 deletions install_by_poetry.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#!/bin/bash
# Installs the `fiftyone` package and its dependencies.
#
# Usage:
# bash install.bash
#
# Copyright 2017-2023, Voxel51, Inc.
# voxel51.com
#

# Show usage information
usage() {
echo "Usage: bash $0 [-h] [-d] [-e] [-m] [-p] [-v]
Getting help:
-h Display this help message.
Custom installations:
-d Install developer dependencies.
-e Source install of voxel51-eta.
-m Install MongoDB from scratch, rather than installing fiftyone-db.
-p Install only the core python package, not the App.
-v Voxel51 developer install (don't install fiftyone-brain).
"
}

# Parse flags
SHOW_HELP=false
DEV_INSTALL=false
SOURCE_ETA_INSTALL=false
SCRATCH_MONGODB_INSTALL=false
BUILD_APP=true
VOXEL51_INSTALL=false
GITHUB_INSTALL=false
E2E_INSTALL=false
while getopts "hdempv" FLAG; do
case "${FLAG}" in
h) SHOW_HELP=true ;;
d) DEV_INSTALL=true ;;
e) SOURCE_ETA_INSTALL=true ;;
m) SCRATCH_MONGODB_INSTALL=true ;;
v) VOXEL51_INSTALL=true ;;
p) BUILD_APP=false ;;
*) usage ;;
esac
done
[ ${SHOW_HELP} = true ] && usage && exit 0

set -e
NODE_VERSION=17.9.0
OS=$(uname -s)
ARCH=$(uname -m)

if [ ${SCRATCH_MONGODB_INSTALL} = true ]; then
echo "***** INSTALLING MONGODB FROM SCRATCH *****"
MONGODB_VERSION=6.0.5
INSTALL_MONGODB=true

mkdir -p ~/.fiftyone/bin
cd ~/.fiftyone
mkdir -p var/lib/mongo
if [ -x bin/mongod ]; then
VERSION_FULL=$(bin/mongod --version | grep 'db version')
CURRENT_VERSION="${VERSION_FULL:12}"
if [ ${CURRENT_VERSION} != ${MONGODB_VERSION} ]; then
echo "Upgrading MongoDB v${CURRENT_VERSION} to v${MONGODB_VERSION}"
else
echo "MongoDB v${MONGODB_VERSION} already installed"
INSTALL_MONGODB=false
fi
fi

if [ ${INSTALL_MONGODB} = true ]; then
echo "Installing MongoDB v${MONGODB_VERSION}"
if [ "${OS}" == "Darwin" ]; then
MONGODB_BUILD=mongodb-macos-x86_64-${MONGODB_VERSION}
curl https://fastdl.mongodb.org/osx/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
elif [ "${OS}" == "Linux" ]; then
MONGODB_BUILD=mongodb-linux-x86_64-ubuntu2204-${MONGODB_VERSION}
curl https://fastdl.mongodb.org/linux/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
else
echo "WARNING: unsupported OS, skipping MongoDB installation"
fi
fi
cd -
else
echo "***** INSTALLING FIFTYONE-DB *****"
pip install fiftyone-db
fi

if [ ${VOXEL51_INSTALL} = false ]; then
echo "***** INSTALLING FIFTYONE-BRAIN *****"
pip install --upgrade fiftyone-brain
fi

pip install poetry

echo "***** INSTALLING FIFTYONE *****"
if [ ${DEV_INSTALL} = true ] || [ ${VOXEL51_INSTALL} = true ]; then
poetry install --with docs,extras,test,dev
elif [ ${GITHUB_INSTALL} = true ]; then
echo "Performing github install"
poetry install --with test,github
elif [ ${E2E_INSTALL} = true ]; then
echo "Performing e2e install"
poetry install --with test,github,e2e
else
poetry build
pip install dist/fiftyone-*.whl
fi

if [ ${SOURCE_ETA_INSTALL} = true ]; then
echo "***** INSTALLING ETA *****"
if [[ ! -d "eta" ]]; then
echo "Cloning ETA repository"
git clone https://github.com/voxel51/eta
fi
cd eta
if [ ${DEV_INSTALL} = true ] || [ ${VOXEL51_INSTALL} = true ]; then
pip install -e .
else
pip install .
fi
if [[ ! -f eta/config.json ]]; then
echo "Installing default ETA config"
cp config-example.json eta/config.json
fi
cd ..
fi

# Do this last since `source` can exit Python virtual environments
if [ ${BUILD_APP} = true ]; then
echo "***** INSTALLING FIFTYONE-APP *****"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install ${NODE_VERSION}
nvm use ${NODE_VERSION}
npm -g install yarn
if [ -f ~/.bashrc ]; then
source ~/.bashrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
else
echo "WARNING: unable to locate a bash profile to 'source'; you may need to start a new shell"
fi
cd app
echo "Building the App. This will take a minute or two..."
yarn install > /dev/null 2>&1
yarn build
cd ..
fi

echo "***** INSTALLATION COMPLETE *****"
125 changes: 116 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,117 @@
[tool.poetry]
name = "fiftyone"
version = "0.23.0"
description = ""
authors = ["None"]
license = "Apache License Version 2.0"
readme = "README.md"

packages = [
{include = "fiftyone"},
{include = "recipes", from = "docs/source", to = "fiftyone"},
{include = "tutorials", from = "docs/source", to = "fiftyone"},
]

[tool.poetry.dependencies]
python = "^3.8,<3.11"
aiofiles = "0.7.0"
argcomplete = "1.11.0"
beautifulsoup4 = "^4.12.2"
boto3 = "1.17.36"
cachetools = "5.2.0"
mongoengine = "0.24.2"
dacite = "1.6.0"
deprecated = "1.2.11"
ftfy = "6.1.1"
humanize = "^4.8.0"
hypercorn = "0.13.2"
importlib-metadata = {version = "1.4.0", markers = "python_version < \"3.8\""}
jinja2 = "3.0.3"
kaleido = "0.2.1"
matplotlib = "3.5.2"
motor = ">=2.5"
numpy = "<=1.26.2"
packaging = "23.2"
pandas = ">=1.3"
pillow = ">=6.2"
plotly = "5.17.0"
pprintpp = "0.4.0"
psutil = ">=5.7.0"
pymongo = ">=3.12"
pytz = "2022.1"
pyyaml = "6.0.1"
regex = "2022.8.17"
retrying = ">=1.3.3"
scikit-learn = ">=0.23.2"
scikit-image = ">=0.16.2"
setuptools = ">=45.2.0"
sseclient-py = ">=1.7.2"
sse-starlette = ">=0.10.3"
starlette = "0.27.0"
strawberry-graphql = "0.138.1"
tabulate = "0.8.10"
xmltodict = "0.12.0"
universal-analytics-python3 = ">=1.0.1,<2"
fiftyone-brain = ">=0.13.2,<0.14.0"
fiftyone-db = ">=0.4,<1.0"
voxel51-eta = ">=0.12,<1.0"
httpx = "0.23.0"


[tool.poetry.group.dev.dependencies]
ipython = "8.12.3"
pre-commit = "2.18.1"
pylint = "2.13.9"


[tool.poetry.group.test.dependencies]
open3d = ">=0.16.0"
itsdangerous = "2.0.1"
werkzeug = "3.0.1"
pytest = "7.3.1"
pytest-cov = "4.0.0"
pytest-mock = "3.10.0"
pytest-asyncio = "^0.21.1"
twine = ">=3"


[tool.poetry.group.docs.dependencies]
autodocsumm = "0.2.7"
docutils = "0.16"
ipykernel = "5.3.0"
ipython-genutils = "0.2.0"
jsx-lexer = "2.0.0"
jupyter-client = "6.1.3"
myst-parser = "0.13.7"
nbsphinx = "0.8.8"
sphinx-tabs = "1.2.1"
sphinx = "3.5.4"
sphinxcontrib-napoleon = "0.7"
sphinx-copybutton = "0.4.0"


[tool.poetry.group.extras.dependencies]
google-api-python-client = ">=1.6.5"
google-cloud-storage = ">=1.36"
httplib2 = "<=0.15"
ipywidgets = ">=7.5,<8"
notebook = ">=5.3"
pydicom = ">=2.2.0"
shapely = ">=1.7.1"


[tool.poetry.group.github.dependencies]
pydicom = ">=2.2.0"
shapely = ">=1.7.1"
tensorflow = "2.13.1"
tensorflow-datasets = "4.8.3"
torch = "^2.1.1"
torchvision = "^0.16.1"


[tool.poetry.group.e2e.dependencies]
umap-learn = ">=0.5.3"

[build-system]
requires = ["importlib-metadata; python_version<'3.8'", "setuptools", "wheel"]
[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
| \.git
)/
'''
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit d8eb906

Please sign in to comment.