Skip to content

Commit 431e979

Browse files
authored
Migrate to pyproject.toml (#1164)
* Migrate to pyproject.toml * Downgrade pytz
1 parent 522a65b commit 431e979

File tree

7 files changed

+110
-65
lines changed

7 files changed

+110
-65
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch: # run manually
5+
push: # run on matching tags
6+
tags:
7+
- '*.*.*'
8+
9+
jobs:
10+
release-to-pypi:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/cache@v3
15+
with:
16+
path: ~/.cache/pip
17+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
18+
restore-keys: ${{ runner.os }}-pip-
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.11"
22+
- name: Install dependencies
23+
run: |
24+
pip install -U pip setuptools wheel
25+
pip install -U tox
26+
- name: Publish package to PyPI
27+
env:
28+
FLIT_USERNAME: __token__
29+
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
30+
run: tox -e publish

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

Makefile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test:
2323

2424
lint:
2525
. venv/bin/activate; \
26-
pre-commit run --all-files
26+
pre-commit run --all-files --show-diff-on-failure
2727

2828
clean-docs:
2929
rm -rf docs/_build
@@ -42,15 +42,9 @@ clean: clean-dist
4242
rm -f .coverage coverage.xml ./**/*.pyc
4343

4444
clean-dist:
45-
rm -rf dist build .egg .eggs arrow.egg-info
45+
rm -rf dist build *.egg *.eggs *.egg-info
4646

47-
build-dist:
47+
build-dist: clean-dist
4848
. venv/bin/activate; \
49-
pip install -U pip setuptools twine wheel; \
50-
python setup.py sdist bdist_wheel
51-
52-
upload-dist:
53-
. venv/bin/activate; \
54-
twine upload dist/*
55-
56-
publish: test clean-dist build-dist upload-dist clean-dist
49+
pip install -U flit; \
50+
flit build

pyproject.toml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[build-system]
2+
requires = ["flit_core >=3.2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
name = "arrow"
7+
authors = [{name = "Chris Smith", email = "crsmithdev@gmail.com"}]
8+
readme = "README.rst"
9+
license = {file = "LICENSE"}
10+
classifiers = [
11+
"Development Status :: 5 - Production/Stable",
12+
"Intended Audience :: Developers",
13+
"Intended Audience :: Information Technology",
14+
"License :: OSI Approved :: Apache Software License",
15+
"Topic :: Software Development :: Libraries :: Python Modules",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3 :: Only",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Operating System :: OS Independent",
24+
]
25+
dependencies = [
26+
"python-dateutil>=2.7.0",
27+
"types-python-dateutil>=2.8.10",
28+
]
29+
requires-python = ">=3.8"
30+
description = "Better dates & times for Python"
31+
keywords = [
32+
"arrow",
33+
"date",
34+
"time",
35+
"datetime",
36+
"timestamp",
37+
"timezone",
38+
"humanize",
39+
]
40+
dynamic = ["version"]
41+
42+
[project.optional-dependencies]
43+
test = [
44+
"dateparser==1.*",
45+
"pre-commit",
46+
"pytest",
47+
"pytest-cov",
48+
"pytest-mock",
49+
"pytz==2021.1",
50+
"simplejson==3.*",
51+
]
52+
doc = [
53+
"doc8",
54+
"sphinx>=7.0.0",
55+
"sphinx-autobuild",
56+
"sphinx-autodoc-typehints",
57+
"sphinx_rtd_theme>=1.3.0",
58+
]
59+
60+
[project.urls]
61+
Documentation = "https://arrow.readthedocs.io"
62+
Source = "https://github.com/arrow-py/arrow"
63+
Issues = "https://github.com/arrow-py/arrow/issues"
64+
65+
[tool.flit.module]
66+
name = "arrow"

requirements/requirements-tests.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ pre-commit
44
pytest
55
pytest-cov
66
pytest-mock
7-
python-dateutil>=2.7.0
87
pytz==2021.1
98
simplejson==3.*
10-
typing_extensions; python_version < '3.8'

setup.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ commands =
3636
doc8 index.rst ../README.rst --extension .rst --ignore D001
3737
make html SPHINXOPTS="-W --keep-going"
3838

39+
[testenv:publish]
40+
passenv = *
41+
skip_install = true
42+
deps =
43+
-r requirements/requirements.txt
44+
flit
45+
allowlist_externals = flit
46+
commands = flit publish --setup-py
47+
3948
[pytest]
4049
addopts = -v --cov-branch --cov=arrow --cov-fail-under=99 --cov-report=term-missing --cov-report=xml
4150
testpaths = tests

0 commit comments

Comments
 (0)