Skip to content

Commit 2aafb87

Browse files
Switch to pyproject.toml with Hatchling and Versioneer (#68)
* Switch to pyproject.toml with Hatchling and Versioneer - Replaced setup.py, setup.cfg, and MANIFEST.in with pyproject.toml. - Configured Hatchling as the build backend. - Integrated Versioneer for dynamic versioning using hatch-vcs plugin. - Added .gitignore file. * Delete .gitignore * Create MANIFEST.in * Update __init__.py * Update _version.py * Update environment.yml * Update pyproject.toml * Update deploy.yml * Update deploy.yml --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 484bc80 commit 2aafb87

File tree

9 files changed

+115
-3050
lines changed

9 files changed

+115
-3050
lines changed

.ci_support/environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ channels:
33
dependencies:
44
- python
55
- coverage
6+
- hatchling =1.27.0
7+
- hatch-vcs =0.5.0
68
- qrcode=8.2
79
- pyotp=2.9.0
810
- pyzbar=0.1.9

.github/workflows/deploy.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,31 @@ on:
44
push:
55
pull_request:
66

7-
# based on https://github.com/pypa/gh-action-pypi-publish
87
jobs:
98
build:
9+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
1010
runs-on: ubuntu-latest
11-
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/${{ github.event.repository.name }}
14+
permissions:
15+
id-token: write
1216
steps:
1317
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v5
18+
- name: Conda config
19+
run: echo -e "channels:\n - conda-forge\n" > .condarc
20+
- uses: conda-incubator/setup-miniconda@v3
1521
with:
16-
python-version: '3.12'
17-
18-
- name: Install dependencies
19-
run: >-
20-
python -m pip install --user --upgrade setuptools wheel
22+
python-version: "3.13"
23+
miniforge-version: latest
24+
condarc-file: .condarc
25+
environment-file: .ci_support/environment.yml
2126
- name: Convert dependencies
22-
run: >-
23-
sed -i 's/==/>=/g' setup.py; cat setup.py
27+
run: |
28+
sed -i 's/==/>=/g' pyproject.toml; cat pyproject.toml
29+
git update-index --assume-unchanged pyproject.toml pyauthenticator/_version.py
2430
- name: Build
25-
run: >-
26-
python setup.py sdist bdist_wheel
31+
shell: bash -l {0}
32+
run: hatchling build -t sdist -t wheel
2733
- name: Publish distribution 📦 to PyPI
28-
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
29-
uses: pypa/gh-action-pypi-publish@master
30-
with:
31-
user: __token__
32-
password: ${{ secrets.pypi_password }}
34+
uses: pypa/gh-action-pypi-publish@release/v1

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
include LICENSE
2-
include versioneer.py
3-
include pyauthenticator/_version.py

pyauthenticator/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
Generate two factor authentication codes on the command line
33
"""
44

5+
from . import _version
56
from pyauthenticator.share import generate_qrcode
67
from pyauthenticator.share import get_two_factor_code as get_two_factor_code_internal
78
from pyauthenticator.share import load_config
89

10+
__version__ = _version.__version__
11+
912

1013
def write_qrcode_to_file(service, file_name=None):
1114
"""

0 commit comments

Comments
 (0)