From a8709ee715c8564e0f5e5c9d29377847d5a58665 Mon Sep 17 00:00:00 2001 From: arkohut <39525455+arkohut@users.noreply.github.com> Date: Tue, 20 Aug 2024 07:46:45 +0800 Subject: [PATCH] chore: use pyproject.toml --- .github/workflows/release.yml | 9 ++++---- pyproject.toml | 43 +++++++++++++++++++++++++++++++++++ setup.py | 38 +------------------------------ 3 files changed, 48 insertions(+), 42 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fa341b..104f6bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: node-version: '20' - name: Install dependencies run: | - pip install setuptools wheel twine + pip install build - name: Build web assets run: | cd web @@ -31,14 +31,14 @@ jobs: npm run build - name: Build Python package run: | - python setup.py sdist bdist_wheel + python -m build - uses: actions/upload-artifact@v4 with: name: dist path: dist release: - needs: build + needs: build name: Upload release to PyPI runs-on: ubuntu-latest environment: @@ -52,5 +52,4 @@ jobs: name: dist path: dist - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..09dc35a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["setuptools>=45", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "memos" +version = "0.2.0" +description = "A package for memos" +readme = "README.md" +authors = [{ name = "arkohut" }] +license = { file = "LICENSE" } +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] +requires-python = ">=3.10" +dependencies = [ + "fastapi", + "uvicorn", + "httpx", + "pydantic", + "sqlalchemy", + "typer", + "magika", + "pydantic-settings", + "typesense", + "opencv-python", + "pillow", + "piexif", +] + +[project.urls] +Homepage = "https://github.com/arkohut/memos" + +[project.scripts] +memos = "memos.commands:app" + +[tool.setuptools] +packages = ["memos"] + +[tool.setuptools.package-data] +"*" = ["static/**/*"] \ No newline at end of file diff --git a/setup.py b/setup.py index 9fa395c..7ca22db 100644 --- a/setup.py +++ b/setup.py @@ -1,37 +1 @@ -from setuptools import setup, find_packages -import pathlib - -here = pathlib.Path(__file__).parent.resolve() -long_description = (here / 'README.md').read_text(encoding='utf-8') - -setup( - name='memos', - version='0.2.0', - packages=find_packages(), - package_data={ - '': ['static/**/*'], - }, - long_description=long_description, - long_description_content_type='text/markdown', - author="arkohut", - url="https://github.com/arkohut/memos", - install_requires=[ - 'fastapi', - 'uvicorn', - 'httpx', - 'pydantic', - 'sqlalchemy', - 'typer', - 'magika', - 'pydantic-settings', - 'typesense', - 'opencv-python', - 'pillow', - ], - entry_points={ - 'console_scripts': [ - 'memos=memos.commands:app', - ], - }, - python_requires='>=3.10', -) \ No newline at end of file +from setuptools import setup \ No newline at end of file