diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..35e5fb73 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: release + +on: + workflow_dispatch: # run manually + push: # run on matching tags + tags: + - '*.*.*' + +jobs: + release-to-pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} + restore-keys: ${{ runner.os }}-pip- + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + pip install -U pip setuptools wheel + pip install -U tox + - name: Publish package to PyPI + env: + FLIT_USERNAME: __token__ + FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: tox -e publish diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 9abe9773..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include LICENSE CHANGELOG.rst README.rst Makefile tox.ini -recursive-include requirements *.txt -recursive-include tests *.py -recursive-include docs *.py *.rst *.bat Makefile diff --git a/Makefile b/Makefile index 27d5cbe4..9db6fba0 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ test: lint: . venv/bin/activate; \ - pre-commit run --all-files + pre-commit run --all-files --show-diff-on-failure clean-docs: rm -rf docs/_build @@ -42,15 +42,9 @@ clean: clean-dist rm -f .coverage coverage.xml ./**/*.pyc clean-dist: - rm -rf dist build .egg .eggs arrow.egg-info + rm -rf dist build *.egg *.eggs *.egg-info -build-dist: +build-dist: clean-dist . venv/bin/activate; \ - pip install -U pip setuptools twine wheel; \ - python setup.py sdist bdist_wheel - -upload-dist: - . venv/bin/activate; \ - twine upload dist/* - -publish: test clean-dist build-dist upload-dist clean-dist + pip install -U flit; \ + flit build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..5ccc497a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "arrow" +authors = [{name = "Chris Smith", email = "crsmithdev@gmail.com"}] +readme = "README.rst" +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: Apache Software License", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "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", + "Operating System :: OS Independent", +] +dependencies = [ + "python-dateutil>=2.7.0", + "types-python-dateutil>=2.8.10", +] +requires-python = ">=3.8" +description = "Better dates & times for Python" +keywords = [ + "arrow", + "date", + "time", + "datetime", + "timestamp", + "timezone", + "humanize", +] +dynamic = ["version"] + +[project.optional-dependencies] +test = [ + "dateparser==1.*", + "pre-commit", + "pytest", + "pytest-cov", + "pytest-mock", + "pytz==2021.1", + "simplejson==3.*", +] +doc = [ + "doc8", + "sphinx>=7.0.0", + "sphinx-autobuild", + "sphinx-autodoc-typehints", + "sphinx_rtd_theme>=1.3.0", +] + +[project.urls] +Documentation = "https://arrow.readthedocs.io" +Source = "https://github.com/arrow-py/arrow" +Issues = "https://github.com/arrow-py/arrow/issues" + +[tool.flit.module] +name = "arrow" diff --git a/requirements/requirements-tests.txt b/requirements/requirements-tests.txt index 7e9fbe3f..77005e0b 100644 --- a/requirements/requirements-tests.txt +++ b/requirements/requirements-tests.txt @@ -4,7 +4,5 @@ pre-commit pytest pytest-cov pytest-mock -python-dateutil>=2.7.0 pytz==2021.1 simplejson==3.* -typing_extensions; python_version < '3.8' diff --git a/setup.py b/setup.py deleted file mode 100644 index d58b9f3b..00000000 --- a/setup.py +++ /dev/null @@ -1,48 +0,0 @@ -# mypy: ignore-errors -from pathlib import Path - -from setuptools import setup - -readme = Path("README.rst").read_text(encoding="utf-8") -version = Path("arrow/_version.py").read_text(encoding="utf-8") -about = {} -exec(version, about) - -setup( - name="arrow", - version=about["__version__"], - description="Better dates & times for Python", - long_description=readme, - long_description_content_type="text/x-rst", - url="https://arrow.readthedocs.io", - author="Chris Smith", - author_email="crsmithdev@gmail.com", - license="Apache 2.0", - packages=["arrow"], - package_data={"arrow": ["py.typed"]}, - zip_safe=False, - python_requires=">=3.8", - install_requires=[ - "python-dateutil>=2.7.0", - "types-python-dateutil>=2.8.10", - ], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Topic :: Software Development :: Libraries :: Python Modules", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "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", - ], - keywords="arrow date time datetime timestamp timezone humanize", - project_urls={ - "Repository": "https://github.com/arrow-py/arrow", - "Bug Reports": "https://github.com/arrow-py/arrow/issues", - "Documentation": "https://arrow.readthedocs.io", - }, -) diff --git a/tox.ini b/tox.ini index 03c4d2af..c410a8e5 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,15 @@ commands = doc8 index.rst ../README.rst --extension .rst --ignore D001 make html SPHINXOPTS="-W --keep-going" +[testenv:publish] +passenv = * +skip_install = true +deps = + -r requirements/requirements.txt + flit +allowlist_externals = flit +commands = flit publish --setup-py + [pytest] addopts = -v --cov-branch --cov=arrow --cov-fail-under=99 --cov-report=term-missing --cov-report=xml testpaths = tests