From 8b543df646c26704dfada622dd2ba21fdec4495a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 10:37:12 +0000 Subject: [PATCH] feat: migrate to uv build system with CI/CD pipelines Agent-Logs-Url: https://github.com/AndyTheFactory/RO-Diacritics/sessions/e80c180c-929c-40dc-aa5d-81a28e2add8d Co-authored-by: AndyTheFactory <863810+AndyTheFactory@users.noreply.github.com> --- .github/workflows/ci.yml | 28 +++++++++++++++++ .github/workflows/pr.yml | 28 +++++++++++++++++ .github/workflows/publish.yml | 59 +++++++++++++++++++++++++++++++++++ .gitignore | 5 +++ pyproject.toml | 55 ++++++++++++++++++++++++++++++++ setup.py | 59 ----------------------------------- 6 files changed, 175 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/publish.yml create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5f75533 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: + - main + - master + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: uv sync --all-extras + + - name: Run tests + run: uv run pytest tests/ diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..56bf262 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,28 @@ +name: PR Checks + +on: + pull_request: + branches: + - main + - master + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: uv sync --all-extras + + - name: Run tests + run: uv run pytest tests/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e80e7d2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,59 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + release: + types: + - published + +jobs: + build: + name: Build Distribution + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: uv sync --all-extras + + - name: Run tests + run: uv run pytest tests/ + + - name: Build package + run: uv build + + - name: Upload distribution artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: build + environment: pypi + permissions: + id-token: write + + steps: + - name: Download distribution artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index 30b3816..7b4ef9a 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,8 @@ fabric.properties .vector_cache .model + +# uv +.uv/ +uv.lock +.python-version diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5ce5469 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "ro-diacritics" +version = "0.9.4.2" +description = "Python API for Romanian diacritics restoration" +readme = "README.md" +license = { text = "MIT" } +authors = [ + { name = "Andrei Paraschiv", email = "andrei@thephpfactory.com" }, +] +maintainers = [ + { name = "Andrei Paraschiv", email = "andrei@thephpfactory.com" }, +] +keywords = ["romanian", "diacritics", "language", "restoration", "diacritice", "python"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Human Machine Interfaces", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Text Processing", + "Topic :: Text Processing :: Filters", + "Topic :: Text Processing :: General", + "Topic :: Text Processing :: Indexing", + "Topic :: Text Processing :: Linguistic", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", +] +requires-python = ">=3.8" +dependencies = [ + "torch", + "torchtext", + "numpy", + "tqdm", + "nltk", + "scikit-learn", +] + +[project.urls] +Homepage = "https://github.com/AndyTheFactory/RO-Diacritics" +Repository = "https://github.com/AndyTheFactory/RO-Diacritics" + +[tool.hatch.build.targets.wheel] +packages = ["ro_diacritics"] + +[tool.uv] +dev-dependencies = [ + "pytest", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 39457c1..0000000 --- a/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -from setuptools import setup, find_packages - -# Arguments marked as "Required" below must be included for upload to PyPI. -# Fields marked as "Optional" may be commented out. - -with open("README.md", "r", encoding="utf8") as fh: - long_description = fh.read() - -setup( - # $ pip install sampleproject - name='ro-diacritics', # Required - - version='0.9.4.2', # Required - - description='Python API for Romanian diacritics restoration', # Required - - long_description=long_description, - long_description_content_type="text/markdown", - maintainer="Andrei Paraschiv", - maintainer_email="andrei@thephpfactory.com", - author="Andrei Paraschiv", - author_email="andrei@thephpfactory.com", - - url='https://github.com/AndyTheFactory/RO-Diacritics', # Optional - - classifiers=[ # Optional - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 4 - Beta', - - 'Intended Audience :: Developers', - 'Intended Audience :: Education', - 'Intended Audience :: Information Technology', - 'Intended Audience :: Science/Research', - - 'Topic :: Scientific/Engineering', - 'Topic :: Scientific/Engineering :: Human Machine Interfaces', - 'Topic :: Scientific/Engineering :: Information Analysis', - 'Topic :: Text Processing', - 'Topic :: Text Processing :: Filters', - 'Topic :: Text Processing :: General', - 'Topic :: Text Processing :: Indexing', - 'Topic :: Text Processing :: Linguistic', - - 'License :: OSI Approved :: MIT License', - - 'Programming Language :: Python :: 3' - ], - - keywords='romanian diacritcs language restoration diacritice python', - - # package_dir={"": "."}, - packages=find_packages(), - - install_requires=['torch', 'torchtext', 'numpy', 'tqdm', 'nltk', 'scikit-learn',], - - zip_safe=False, -)