File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : publish-to-test-pypi
2+
3+ on :
4+ push :
5+ branches : ["test_pypi"]
6+
7+ jobs :
8+ build :
9+ name : Build distribution
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
15+
16+ - name : Set up Python
17+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
18+ with :
19+ python-version : " 3.x"
20+
21+ - name : Install uv
22+ uses : astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
23+
24+ - name : Install hatch
25+ run : uv tool install hatch
26+
27+ - name : Build distributions with uv
28+ run : uv build
29+
30+ - name : DEBUG - list installed packages
31+ run : uv pip list
32+
33+ - name : Upload distributions as artifact
34+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
35+ with :
36+ name : python-package-distributions
37+ path : dist/
38+
39+ publish-to-test-pypi :
40+ name : Publish Python distribution to TestPyPI
41+ needs : [build]
42+ runs-on : ubuntu-latest
43+
44+ environment :
45+ name : testpypi
46+ url : https://test.pypi.org/p/python-em511
47+
48+ permissions :
49+ id-token : write
50+
51+ steps :
52+ - name : Download all build artifacts
53+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
54+ with :
55+ name : python-package-distributions
56+ path : dist/
57+
58+ - name : Publish to TestPyPI
59+ uses : pypa/gh-action-pypi-publish@release/v1
60+ with :
61+ repository-url : https://test.pypi.org/legacy/
Original file line number Diff line number Diff line change 11[project ]
22name = " python-em511"
3- version = " 0.0.1 "
3+ dynamic = [ " version " ]
44description = " Driver for Carlo Gavazzi EM511 Series Single Phase Energy Meters using Modbus RTU"
55readme = " README.md"
66
@@ -36,12 +36,19 @@ classifiers = [
3636]
3737
3838[build-system ]
39- requires = [" hatchling" ]
39+ requires = [" hatchling" , " uv-dynamic-versioning " ]
4040build-backend = " hatchling.build"
4141
4242[tool .hatch .build .targets .wheel ]
4343packages = [" src/em511" ]
4444
45+ [tool .hatch .version ]
46+ source = " uv-dynamic-versioning"
47+
48+ [tool .uv-dynamic-versioning ]
49+ enable = true
50+ vcs = " git"
51+
4552[dependency-groups ]
4653dev = [
4754 " pre-commit>=4.3.0" ,
@@ -57,7 +64,7 @@ line-length = 120
5764select = [" ALL" ]
5865
5966ignore = [
60- " COM812" , # in conflict with formatter
67+ " COM812" , # in conflict with formatter
6168]
6269
6370[tool .ruff .lint .pydocstyle ]
Original file line number Diff line number Diff line change 44using Carlo Gavazzi EM511 energy meters.
55"""
66
7+ from importlib .metadata import PackageNotFoundError , version
8+
79from .em511 import Em511
810
9- __all__ = ["Em511" ]
11+ __all__ = ["Em511" , "__version__" ]
12+
13+ try :
14+ __version__ = version ("python-em511" )
15+ except PackageNotFoundError :
16+ __version__ = "0.0.5"
You can’t perform that action at this time.
0 commit comments