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

Move to pyproject.toml package file #4019

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7f4daad
Set pyproject.toml
bigstones Nov 19, 2023
0c91404
Set pyproject.toml based on requirements
bigstones Nov 24, 2023
42c7f83
Modify the installation to use Poetry
bigstones Nov 24, 2023
207f8f3
Remove the requirements files
bigstones Nov 24, 2023
6cb00aa
fix install bash
bigstones Nov 24, 2023
bcf0cc9
add gitignore poetry.lock .venv .python-version
bigstones Dec 9, 2023
77693dc
update pyproject.toml for package_dir include
bigstones Dec 9, 2023
df208bc
move doc/source/* -> doc/source/fiftyone/*
bigstones Dec 9, 2023
c9eee3a
apply pyproject.toml from to https://github.com/python-poetry/poetry/…
bigstones Dec 18, 2023
9335d98
move doc/source/fiftyone/* -> doc/source/*
bigstones Dec 18, 2023
0b65952
Merge branch 'voxel51:develop' into develop
bigstones Dec 18, 2023
4739d39
restore requirements
bigstones Dec 18, 2023
2a51479
install bash with setup py
bigstones Dec 18, 2023
00e5a4c
update docs/source/conf.py to latest
bigstones Dec 18, 2023
422214a
restore settings docs/source/fiftyone -> docs/source
bigstones Dec 18, 2023
9a7ae2c
create install_by_poetry.bash
bigstones Dec 18, 2023
5d522c9
restore setup.py docs/source/fiftyone -> docs/source
bigstones Dec 18, 2023
e8ec4a6
pyproject.toml with hatch builds
benjaminpkane Dec 21, 2023
b7e989d
hatchling, keep 3.7
benjaminpkane Dec 21, 2023
e91b935
hatchling
benjaminpkane Dec 21, 2023
b233c5f
merge
benjaminpkane Jan 17, 2024
49acc68
lint ignore
benjaminpkane Jan 17, 2024
3afd738
2024
benjaminpkane Jan 17, 2024
091b96a
update common
benjaminpkane Jan 17, 2024
f288d6e
rm packaging
benjaminpkane Jan 17, 2024
2d4ffae
update docs version check
benjaminpkane Jan 17, 2024
e1e81e9
merge
benjaminpkane Feb 20, 2024
dd0629b
hardcode author
benjaminpkane Feb 21, 2024
f56f124
Merge branch 'develop' into hatch
benjaminpkane Feb 21, 2024
cc56ced
update deps
benjaminpkane Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- 'app/**'
- '.github/**'
- 'fiftyone/**'
- 'setup.py'
- 'pyproject.toml'
- 'dependencies.py'
- 'version.py'

build:
runs-on: ubuntu-20.04
Expand All @@ -32,7 +34,7 @@ jobs:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install --upgrade pip hatchling wheel
- name: Cache Node Modules
id: node-cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ dist/
/lib
coverage.xml
.coverage.*
pyvenv.cfg
pyvenv.cfg
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
@cd app && yarn && yarn build && cd ..

python: app
@python setup.py sdist bdist_wheel
@hatchling build

docker: python
@docker build -t voxel51/fiftyone .
Expand Down
53 changes: 53 additions & 0 deletions dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
FiftyOne dependencies build hook

| Copyright 2017-2024, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from importlib import metadata
import re

from hatchling.builders.hooks.plugin.interface import BuildHookInterface

CHOOSE_DEPENDENCIES = [
(
(
"opencv-python",
"opencv-contrib-python",
"opencv-contrib-python-headless",
),
"opencv-python-headless",
)
]


def choose_dependency(mains, secondary):
chosen = secondary
for main in mains:
try:
name = re.split(r"[!<>=]", main)[0]
metadata.version(name)
chosen = main
break
except metadata.PackageNotFoundError:
pass

return str(chosen)


def get_environment_dependencies(install_requires, choose_install_requires):
for mains, secondary in choose_install_requires:
install_requires.append(choose_dependency(mains, secondary))

return install_requires


class CustomHook(BuildHookInterface):
"""A build hook for dynamic fiftyone dependencies."""

def initialize(self, _, build_data):
"""Choose environment specific dynamic dependencies"""
build_data["dependencies"] = get_environment_dependencies(
[], CHOOSE_DEPENDENCIES
)
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import fiftyone.constants as foc


with open("../../setup.py") as f:
with open("../../version.py") as f:
setup_version = re.search(r'VERSION = "(.+?)"', f.read()).group(1)

if setup_version != foc.VERSION:
raise RuntimeError(
"FiftyOne version in setup.py (%r) does not match installed version "
"FiftyOne version in version.py (%r) does not match installed version "
"(%r). If this is a dev install, reinstall with `pip install -e .` "
"and try again." % (setup_version, foc.VERSION)
)
Expand Down
3 changes: 2 additions & 1 deletion fiftyone/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
| `voxel51.com <https://voxel51.com/>`_
|
"""

from datetime import datetime
import os

Expand Down Expand Up @@ -51,7 +52,7 @@
NAME = _META["name"]
VERSION = _META["version"]
DESCRIPTION = _META["summary"]
AUTHOR = _META["author"]
AUTHOR = "Voxel51, Inc."
AUTHOR_EMAIL = _META["author-email"]
URL = _META["home-page"]
LICENSE = _META["license"]
Expand Down
4 changes: 0 additions & 4 deletions fiftyone/server/README.md

This file was deleted.

13 changes: 13 additions & 0 deletions hatch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[version]
path = "version.py"

[build.hooks.custom]
path = "dependencies.py"

[build]
artifacts = ["fiftyone/server/static/*"]
packages = ["fiftyone"]

[build.force-include]
"docs/source/recipes" = "fiftyone/recipes"
"docs/source/tutorials" = "fiftyone/tutorials"
90 changes: 89 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,93 @@
[build-system]
requires = ["importlib-metadata; python_version<'3.8'", "setuptools", "wheel"]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "fiftyone"
dynamic = ["version"]
description = "FiftyOne: the open-source tool for building high-quality datasets and computer vision models"
authors = [{ name = "Voxel51, Inc.", email = "info@voxel51.com" }]
license = "Apache-2.0"
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Scientific/Engineering :: Image Recognition",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Visualization",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
# third-party packages
"aiofiles",
"argcomplete",
"beautifulsoup4",
"boto3",
"cachetools",
"dacite>=1.6.0,<1.8.0",
"Deprecated",
"ftfy",
"humanize",
"hypercorn>=0.13.2",
"Jinja2>=3",
# kaleido indirectly required by plotly for image export
# https://plotly.com/python/static-image-export/
"kaleido!=0.2.1.post1",
"matplotlib",
"mongoengine==0.24.2",
"motor>=2.5",
"numpy",
"packaging",
"pandas",
"Pillow>=6.2",
"plotly>=4.14",
"pprintpp",
"psutil",
"pymongo>=3.12",
"pytz",
"PyYAML",
"regex",
"retrying",
"scikit-learn",
"scikit-image",
"setuptools",
"sseclient-py>=1.7.2,<2",
"sse-starlette>=0.10.3,<1",
"starlette>=0.24.0",
"strawberry-graphql==0.138.1",
"tabulate",
"xmltodict",
"universal-analytics-python3>=1.0.1,<2",
# internal packages
"fiftyone-brain>=0.16.0,<0.17",
"fiftyone-db>=0.4,<2.0",
"voxel51-eta>=0.12.4,<0.13",
]

[project.optional-dependencies]
desktop = ["fiftyone-desktop~=0.33.2"]

[project.scripts]
fiftyone = "fiftyone.core.cli:main"

[project.urls]
documentation = "https://fiftyone.ai"
homepage = "https://github.com/voxel51/fiftyone"

# Development settings

[tool.black]
line-length = 79
include = '\.pyi?$'
Expand Down
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

7 changes: 3 additions & 4 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ Deprecated==1.2.11
ftfy==6.1.1
httpx==0.23.0
hypercorn==0.13.2
importlib-metadata==1.4.0; python_version<"3.8"
Jinja2==3.0.3
Jinja2==3.1.3
kaleido==0.2.1
matplotlib==3.5.2
matplotlib
mongoengine==0.24.2
motor>=2.5
packaging==20.3
packaging
pandas>=1.3
plotly==5.17.0
pprintpp==0.4.0
Expand Down
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
-r extras.txt
-r test.txt

hatchling
ipython==8.12.3
pre-commit==2.18.1
pylint==2.13.9
Loading
Loading