Skip to content

Commit 00c02a3

Browse files
committed
Merge branch 'main' into v0.4
2 parents d9ae49d + ae2334f commit 00c02a3

18 files changed

+221
-199
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ concurrency:
55
group: ${{ github.head_ref || github.run_id }}
66
cancel-in-progress: true
77

8-
env:
9-
CONDA_EXE: mamba
10-
118
on:
129
push:
1310
branches:
@@ -18,6 +15,21 @@ on:
1815

1916
jobs:
2017

18+
run-type-checking:
19+
20+
name: Run tests for type-checking
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version-file: .python-version
28+
allow-prereleases: true
29+
cache: pip
30+
- run: pip install tox-uv
31+
- run: tox -e typing
32+
2133
run-tests:
2234

2335
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
@@ -31,33 +43,29 @@ jobs:
3143

3244
steps:
3345
- uses: actions/checkout@v4
34-
- uses: conda-incubator/setup-miniconda@v2
46+
- uses: actions/setup-python@v5
3547
with:
36-
auto-update-conda: false
3748
python-version: ${{ matrix.python-version }}
38-
channels: conda-forge,nodefaults
39-
miniforge-variant: Mambaforge
40-
41-
- name: Install core dependencies.
42-
shell: bash -l {0}
43-
run: mamba install -c conda-forge tox-conda coverage
49+
cache: pip
50+
allow-prereleases: true
51+
- run: pip install tox-uv
4452

4553
# Unit, integration, and end-to-end tests.
4654

4755
- name: Run unit tests and doctests.
4856
shell: bash -l {0}
49-
run: tox -e pytest -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
57+
run: tox -e test -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
5058

51-
- name: Upload coverage report for unit tests and doctests.
52-
if: runner.os == 'Linux' && matrix.python-version == '3.8'
53-
shell: bash -l {0}
54-
run: bash <(curl -s https://codecov.io/bash) -F unit -c
59+
- name: Upload unit test coverage reports to Codecov with GitHub Action
60+
uses: codecov/codecov-action@v4
61+
with:
62+
flags: unit
5563

5664
- name: Run end-to-end tests.
5765
shell: bash -l {0}
58-
run: tox -e pytest -- -m end_to_end --cov=./ --cov-report=xml -n auto
66+
run: tox -e test -- -m end_to_end --cov=./ --cov-report=xml -n auto
5967

60-
- name: Upload coverage reports of end-to-end tests.
61-
if: runner.os == 'Linux' && matrix.python-version == '3.8'
62-
shell: bash -l {0}
63-
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
68+
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
69+
uses: codecov/codecov-action@v4
70+
with:
71+
flags: end_to_end

.github/workflows/publish-to-pypi.yml

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,91 @@
1-
name: PyPI
1+
name: Publish Python 🐍 distribution 📦 to PyPI
22

33
on: push
44

55
jobs:
6-
build-n-publish:
7-
name: Build and publish Python 🐍 distributions 📦 to PyPI
6+
build:
7+
name: Build distribution 📦
88
runs-on: ubuntu-latest
9+
910
steps:
1011
- uses: actions/checkout@v4
11-
12-
- name: Set up Python 3.8
13-
uses: actions/setup-python@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
1414
with:
15-
python-version: 3.8
16-
15+
python-version: "3.x"
1716
- name: Install pypa/build
1817
run: >-
19-
python -m
18+
python3 -m
2019
pip install
2120
build
2221
--user
23-
2422
- name: Build a binary wheel and a source tarball
25-
run: >-
26-
python -m
27-
build
28-
--sdist
29-
--wheel
30-
--outdir dist/
23+
run: python3 -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: python-package-distributions
28+
path: dist/
3129

30+
publish-to-pypi:
31+
name: Publish Python 🐍 distribution 📦 to PyPI
32+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/pytask-stata
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
3248
- name: Publish distribution 📦 to PyPI
33-
if: startsWith(github.ref, 'refs/tags')
34-
uses: pypa/gh-action-pypi-publish@master
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
51+
github-release:
52+
name: >-
53+
Sign the Python 🐍 distribution 📦 with Sigstore
54+
and upload them to GitHub Release
55+
needs:
56+
- publish-to-pypi
57+
runs-on: ubuntu-latest
58+
59+
permissions:
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
61+
id-token: write # IMPORTANT: mandatory for sigstore
62+
63+
steps:
64+
- name: Download all the dists
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
- name: Sign the dists with Sigstore
70+
uses: sigstore/[email protected]
3571
with:
36-
password: ${{ secrets.PYPI_API_TOKEN }}
72+
inputs: >-
73+
./dist/*.tar.gz
74+
./dist/*.whl
75+
- name: Create GitHub Release
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}
78+
run: >-
79+
gh release create
80+
'${{ github.ref_name }}'
81+
--repo '${{ github.repository }}'
82+
--notes ""
83+
- name: Upload artifact signatures to GitHub Release
84+
env:
85+
GITHUB_TOKEN: ${{ github.token }}
86+
# Upload to GitHub Release using the `gh` CLI. `dist/` contains the built
87+
# packages, and the sigstore-produced signatures and certificates.
88+
run: >-
89+
gh release upload
90+
'${{ github.ref_name }}' dist/**
91+
--repo '${{ github.repository }}'

.pre-commit-config.yaml

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-added-large-files
66
args: [--maxkb=25]
@@ -24,61 +24,29 @@ repos:
2424
- id: python-no-log-warn
2525
- id: python-use-type-annotations
2626
- id: text-unicode-replacement-char
27-
- repo: https://github.com/asottile/reorder-python-imports
28-
rev: v3.12.0
29-
hooks:
30-
- id: reorder-python-imports
31-
args: [--py38-plus, --add-import, from __future__ import annotations]
32-
- repo: https://github.com/asottile/setup-cfg-fmt
33-
rev: v2.5.0
34-
hooks:
35-
- id: setup-cfg-fmt
36-
- repo: https://github.com/psf/black
37-
rev: 23.9.1
38-
hooks:
39-
- id: black
4027
- repo: https://github.com/astral-sh/ruff-pre-commit
41-
rev: v0.0.292
28+
rev: v0.4.4
4229
hooks:
4330
- id: ruff
31+
- id: ruff-format
4432
- repo: https://github.com/dosisod/refurb
45-
rev: v1.21.0
33+
rev: v2.0.0
4634
hooks:
4735
- id: refurb
48-
args: [--ignore, FURB126]
49-
- repo: https://github.com/econchick/interrogate
50-
rev: 1.5.0
51-
hooks:
52-
- id: interrogate
53-
args: [-v, --fail-under=40, src, tests]
5436
- repo: https://github.com/executablebooks/mdformat
5537
rev: 0.7.17
5638
hooks:
5739
- id: mdformat
5840
additional_dependencies:
5941
- mdformat-gfm
6042
- mdformat-black
61-
args: [--wrap, '88']
43+
args: [--wrap, "88"]
6244
- repo: https://github.com/codespell-project/codespell
6345
rev: v2.2.6
6446
hooks:
6547
- id: codespell
66-
- repo: https://github.com/pre-commit/mirrors-mypy
67-
rev: v1.5.1
68-
hooks:
69-
- id: mypy
70-
additional_dependencies:
71-
- attrs
72-
- pytask
73-
- types-setuptools
74-
pass_filenames: false
75-
- repo: https://github.com/mgedmin/check-manifest
76-
rev: '0.49'
77-
hooks:
78-
- id: check-manifest
79-
args: [--no-build-isolation]
80-
additional_dependencies: [setuptools-scm, toml]
8148
- repo: meta
8249
hooks:
8350
- id: check-hooks-apply
8451
- id: check-useless-excludes
52+
# - id: identity # Prints all files passed to pre-commits. Debugging.

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.2

pyproject.toml

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,54 @@
22
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "pytask_stata"
7+
description = "Execute do-files with Stata and pytask."
8+
authors = [{ name = "Tobias Raabe", email = "[email protected]" }]
9+
license = { text = "MIT" }
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"License :: OSI Approved :: MIT License",
13+
"Operating System :: OS Independent",
14+
"Programming Language :: Python :: 3",
15+
"Programming Language :: Python :: 3 :: Only",
16+
]
17+
requires-python = ">=3.8"
18+
dependencies = ["click", "pytask>=0.3,<0.4"]
19+
dynamic = ["version"]
20+
21+
[project.readme]
22+
file = "README.md"
23+
content-type = "text/markdown"
24+
25+
[project.optional-dependencies]
26+
test = ["pytest", "pytest-cov", "pytest-xdist"]
27+
typing = ["mypy"]
28+
29+
[project.urls]
30+
Homepage = "https://github.com/pytask-dev/pytask-stata"
31+
Documentation = "https://github.com/pytask-dev/pytask-stata"
32+
Github = "https://github.com/pytask-dev/pytask-stata"
33+
Tracker = "https://github.com/pytask-dev/pytask-stata/issues"
34+
Changelog = "https://github.com/pytask-dev/pytask-stata/blob/main/CHANGES.md"
35+
36+
[project.entry-points]
37+
pytask = { pytask_stata = "pytask_stata.plugin" }
38+
39+
[tool.setuptools]
40+
include-package-data = true
41+
package-dir = { "" = "src" }
42+
zip-safe = false
43+
platforms = ["any"]
44+
license-files = ["LICENSE"]
45+
46+
[tool.setuptools.packages.find]
47+
where = ["src"]
48+
namespaces = false
549

650
[tool.setuptools_scm]
751
write_to = "src/pytask_stata/_version.py"
852

9-
1053
[tool.mypy]
1154
files = ["src", "tests"]
1255
check_untyped_defs = true
@@ -17,54 +60,36 @@ no_implicit_optional = true
1760
warn_redundant_casts = true
1861
warn_unused_ignores = true
1962

20-
2163
[[tool.mypy.overrides]]
2264
module = "tests.*"
2365
disallow_untyped_defs = false
2466
ignore_errors = true
2567

26-
2768
[tool.ruff]
2869
target-version = "py38"
29-
select = ["ALL"]
3070
fix = true
31-
extend-ignore = [
32-
"I", # ignore isort
33-
"TRY",
34-
# Numpy docstyle
35-
"D107",
36-
"D203",
37-
"D212",
38-
"D213",
39-
"D402",
40-
"D413",
41-
"D415",
42-
"D416",
43-
"D417",
44-
# Others.
45-
"D404", # Do not start module docstring with "This".
46-
"RET504", # unnecessary variable assignment before return.
47-
"S101", # raise errors for asserts.
48-
"B905", # strict parameter for zip that was implemented in py310.
49-
"ANN101", # type annotating self
50-
"ANN102", # type annotating cls
51-
"FBT", # flake8-boolean-trap
52-
"EM", # flake8-errmsg
53-
"ANN401", # flake8-annotate typing.Any
54-
"PD", # pandas-vet
55-
"COM812", # trailing comma missing, but black takes care of that
56-
]
71+
unsafe-fixes = true
5772

73+
[tool.ruff.lint]
74+
select = ["ALL"]
75+
ignore = [
76+
"ANN101",
77+
"ANN102",
78+
"ANN401", # flake8-annotate typing.Any
79+
"COM812", # Comply with ruff-format.
80+
"ISC001", # Comply with ruff-format.
81+
]
5882

59-
[tool.ruff.per-file-ignores]
60-
"tests/*" = ["D", "ANN"]
83+
[tool.ruff.lint.per-file-ignores]
84+
"tests/*" = ["D", "ANN", "S101"]
6185
"__init__.py" = ["D104"]
6286

87+
[tool.ruff.lint.isort]
88+
force-single-line = true
6389

64-
[tool.ruff.pydocstyle]
90+
[tool.ruff.lint.pydocstyle]
6591
convention = "numpy"
6692

67-
6893
[tool.pytest.ini_options]
6994
# Do not add src since it messes with the loading of pytask-parallel as a plugin.
7095
testpaths = ["tests"]

0 commit comments

Comments
 (0)