Skip to content

Commit

Permalink
Migrate to pyproject.toml (#1164)
Browse files Browse the repository at this point in the history
* Migrate to pyproject.toml

* Downgrade pytz
  • Loading branch information
jadchaar committed Sep 30, 2023
1 parent 522a65b commit 431e979
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 65 deletions.
30 changes: 30 additions & 0 deletions .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
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

16 changes: 5 additions & 11 deletions Makefile
Expand Up @@ -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
Expand All @@ -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
66 changes: 66 additions & 0 deletions 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"
2 changes: 0 additions & 2 deletions requirements/requirements-tests.txt
Expand Up @@ -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'
48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

9 changes: 9 additions & 0 deletions tox.ini
Expand Up @@ -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
Expand Down

0 comments on commit 431e979

Please sign in to comment.