Β
We can use either declarative config file (
pyproject.toml
or olderΒ setup.cfg
) or setup.py
to configure the package. But itβs recommended to use declarative method to avoid executing arbitrary scripts and boilerplate code.Β
It is also recommended to maintain the project folder in src-layout, i.e., keep everything in a independent
src
folder, to avoid some unexpected errors.project_root_directory βββ LICENSE βββ README.md βββ pyproject.toml βββ setup.py βββ src/ βββ your_package_name/ βββ __init__.py βββ ... βββ module.py βββ subpkg1/ β βββ __init__.py β βββ ... βββ subpkg2/ βββ __init__.py βββ ... βββ module2.py
instead of flat-layout
project_root_directory βββ pyproject.toml # AND/OR setup.cfg, setup.py βββ ... βββ your_package_name/ βββ __init__.py βββ ... βββ module.py βββ subpkg1/ β βββ __init__.py β βββ ... β βββ module1.py βββ subpkg2/ βββ __init__.py βββ ... βββ module2.py
Β
[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "StreamDiffusionIO" version = "0.0.1" authors = [ {name = "Yihao (Ethan) Wang", email = "yihao.w@nyu.edu"}, ] description = "A light weight pipeline using StreamDiffusion, aimming to support streaming IO operations." readme = "README.md" keywords = ["diffusion", "stream"] license = {file = "LICENSE"} classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", ] requires-python = ">=3.10" dependencies = [ "torch >= 2.2.0", "diffusers >= 0.26.3", "transformers >= 4.38.1", ] [project.optional-dependencies] xformers = ["xformers >= 0.0.24"] [project.urls] Repository = "https://github.com/AgainstEntropy/StreamDiffusionIO.git" [tool.setuptools] package-dir = {"" = "src"} [tool.setuptools.packages.find] where = ["src"] include = ["StreamDiffusionIO*"] namespaces = false
Β
pip install -U build twine cd /path/to/your/project python -m build python -m twine upload --repository testpypi dist/* python -m twine upload [-r pypi] dist/*