diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 5b31608..7369a23 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -11,10 +11,16 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ammaraskar/sphinx-action@master + - name: Set up Python + uses: actions/setup-python@v5 with: - docs-folder: "docs/" - pre-build-command: "python -m pip install --upgrade pip && pip install -r requirements.txt && pip install sphinx_rtd_theme" + python-version: 3.9 + + - name: Install dependencies + run: pip install -e '.[docs]' + + - name: Build docs + run: sphinx-build docs ./docs/_build/html/ - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d454bff..370e1f9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,16 +15,17 @@ jobs: with: python-version: "3.x" cache: "pip" + cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build twine - name: Build and publish env: TWINE_USERNAME: "__token__" # https://github.com/pypa/twine/blob/3.x/tests/test_integration.py#L53-L64 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_CENTRALDOGMA }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d3c552..e1fa590 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,10 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ammaraskar/sphinx-action@master + - name: Set up Python + uses: actions/setup-python@v5 with: - docs-folder: "docs/" - pre-build-command: "python -m pip install --upgrade pip && pip install -r requirements.txt && pip install sphinx_rtd_theme" + python-version: 3.9 + - name: Install dependencies + run: pip install -e '.[docs]' + - name : Build docs + run: sphinx-build docs ./docs/_build/html/ linter: name: black --check @@ -31,7 +35,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 @@ -43,11 +47,13 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "pip" + cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -e . + pip install -e '.[dev]' - name: Test with pytest run: | @@ -65,7 +71,7 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11","3.12", "pypy3.8", "pypy3.9"] + python-version: ["3.9", "3.10", "3.11","3.12", "3.13", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 @@ -74,11 +80,13 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "pip" + cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -e . + pip install -e '.[dev]' - name: Test with pytest run: | diff --git a/centraldogma/__init__.py b/centraldogma/__init__.py index e69de29..6a9beea 100644 --- a/centraldogma/__init__.py +++ b/centraldogma/__init__.py @@ -0,0 +1 @@ +__version__ = "0.4.0" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5a6c359 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,78 @@ +# Copyright 2024 LINE Corporation +# +# LINE Corporation licenses this file to you under the Apache License, +# version 2.0 (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at: +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +[build-system] +requires = ["setuptools >= 61"] +build-backend = "setuptools.build_meta" + +[project] +name = "centraldogma-python" +dynamic = ["version"] +description = "Python client library for Central Dogma" +readme = "README.md" +authors= [{name = "Central Dogma Team", email = "dl_centraldogma@linecorp.com"}] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.9" +dependencies = [ + "dataclasses-json == 0.6.7", + "httpx[http2] == 0.27.2", + "marshmallow == 3.23.0", + "pydantic == 2.9.2", + "python-dateutil == 2.9.0.post0", + "tenacity == 9.0.0", +] + +[project.urls] +Homepage = "https://github.com/line/centraldogma-python" +Documentation = "https://line.github.io/centraldogma-python" +Repository = "https://github.com/line/centraldogma-python.git" +Issues = "https://github.com/line/centraldogma-python/issues" + +[project.optional-dependencies] +dev = [ + "black", + "codecov", + "pytest", + "pytest-cov", + "pytest-mock", + "respx" +] +docs = [ + "sphinx_rtd_theme" +] + +[tool.setuptools] +packages = ["centraldogma", "centraldogma.data"] + +[tool.setuptools.dynamic] +version = {attr = "centraldogma.__version__"} + +[tool.distutils.bdist_wheel] +universal = true + +[tool.pep8] +ignore = "E501" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6168923..0000000 --- a/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -dataclasses-json -httpx[http2] -marshmallow -pydantic -python-dateutil -tenacity - -# Dev dependencies -black -codecov -pytest -pytest-cov -pytest-mock -respx -setuptools diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e36f073..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal = 1 - -[pep8] -ignore = E501 diff --git a/setup.py b/setup.py deleted file mode 100644 index c7ee476..0000000 --- a/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2021 LINE Corporation -# -# LINE Corporation licenses this file to you under the Apache License, -# version 2.0 (the "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at: -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -from setuptools import setup - - -def get_long_description(): - with open("README.md", "r") as f: - return f.read() - - -def get_install_requires(): - install_requires = [] - with open("requirements.txt", "r") as f: - for line in f: - dependency = line.rstrip() - if not dependency: - break - install_requires.append(dependency) - return install_requires - - -setup( - name="centraldogma-python", - version="0.4.0", - description="Python client library for Central Dogma", - long_description=get_long_description(), - long_description_content_type="text/markdown", - url="https://github.com/line/centraldogma-python", - author="Central Dogma Team", - author_email="dl_centraldogma@linecorp.com", - license="Apache License 2.0", - packages=["centraldogma", "centraldogma.data"], - install_requires=get_install_requires(), - python_requires=">=3.8", - keywords="centraldogma", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - ], -)