Skip to content

Commit f2e25e5

Browse files
committed
Switch build-backend from setuptools to hatchling
This follows the same steps taken in [1]. [1] - simonsobs/ocs#403
1 parent b2a80ed commit f2e25e5

File tree

11 files changed

+173
-3113
lines changed

11 files changed

+173
-3113
lines changed

.flake8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ exclude =
1717
socs/mibs/IBOOTPDU-MIB.py,
1818
socs/mibs/UPS-MIB.py,
1919
socs/mibs/MBG-SYNCBOX-N2X-MIB.py,
20-
socs/_version.py,
21-
versioneer.py,
2220
docs/conf.py,
2321
per-file-ignores =
2422
# Windows only dependency

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# dynamic package version
2+
socs/_version.py
3+
14
# iPython Notebooks
25
*.ipynb
36

MANIFEST.in

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

pyproject.toml

Lines changed: 146 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,152 @@
11
[build-system]
22
requires = [
3-
# Upper bound needed until https://github.com/pypa/setuptools/issues/4483/ is fixed
4-
"setuptools>=61.0,<71.0.0",
5-
"wheel",
6-
"versioneer-518",
3+
"hatch-vcs",
4+
"hatchling",
5+
]
6+
build-backend = "hatchling.build"
7+
8+
[project]
9+
name = "socs"
10+
dynamic = ["version"]
11+
description = "Simons Observatory Control System"
12+
readme = "README.rst"
13+
requires-python = ">=3.7"
14+
classifiers = [
15+
"Framework :: Twisted",
16+
"Intended Audience :: Science/Research",
17+
"License :: OSI Approved :: BSD License",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.7",
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Topic :: Scientific/Engineering :: Astronomy",
25+
]
26+
dependencies = [
27+
"autobahn[serialization]",
28+
"numpy",
29+
"ocs",
30+
"pyasn1==0.4.8",
31+
"pyModbusTCP",
32+
"pyserial",
33+
"pysmi",
34+
"pysnmp==4.4.12",
35+
"pyyaml",
36+
"requests",
37+
"sqlalchemy>=1.4",
38+
"twisted",
39+
]
40+
41+
[project.entry-points."ocs.plugins"]
42+
socs = "socs.plugin"
43+
44+
[project.optional-dependencies]
45+
# Development
46+
dev = [
47+
"http-server-mock",
48+
"pytest",
49+
"pytest-cov",
50+
"pytest-docker",
51+
"pytest-dependency",
52+
"pytest-order",
53+
"pytest-twisted",
54+
"setuptools-scm",
55+
"so3g",
56+
"thola-snmpsim",
57+
]
58+
# ACU Agent
59+
acu = [
60+
"pixell",
61+
"so3g",
62+
# "soaculib @ git+https://github.com/simonsobs/soaculib.git@master",
63+
]
64+
# Note: Not including the holography deps, which are Python 3.8 only. Also not
65+
# including any dependencies with only direct references.
66+
all = [
67+
"http-server-mock",
68+
"labjack-ljm",
69+
"numexpr",
70+
"pandas",
71+
"pfeiffer-vacuum-protocol==0.4",
72+
"pixell",
73+
"pyepics",
74+
"pytest",
75+
"pytest-cov",
76+
"pytest-docker",
77+
"pytest-dependency",
78+
"pytest-order",
79+
"pytest-twisted",
80+
"scipy",
81+
"setuptools-scm",
82+
"so3g",
83+
"thola-snmpsim",
84+
]
85+
# Holography FPGA and Synthesizer Agents
86+
# holography = [ # Note: supports python 3.8 only!
87+
# "casperfpga @ git+https://github.com/casper-astro/casperfpga.git@py38",
88+
# "holog_daq @ git+https://github.com/McMahonCosmologyGroup/holog_daq.git@main",
89+
# ]
90+
# Labjack Agent
91+
labjack = [
92+
"labjack-ljm",
93+
"numexpr",
94+
"scipy",
95+
]
96+
# Magpie Agent
97+
magpie = [
98+
"pandas",
99+
"scipy",
100+
"so3g",
101+
]
102+
# Pfeiffer TC 400 Agent
103+
pfeiffer = [
104+
"pfeiffer-vacuum-protocol==0.4",
105+
]
106+
# Pysmurf Controller Agent
107+
pysmurf = [
108+
"pyepics",
109+
# "pysmurf @ git+https://github.com/slaclab/pysmurf.git@main",
110+
# "sodetlib @ git+https://github.com/simonsobs/sodetlib.git@master",
111+
# "sotodlib @ git+https://github.com/simonsobs/sotodlib.git@master",
112+
]
113+
# SMuRF File Emulator, SMuRF Stream Simulator
114+
smurf_sim = [
115+
"so3g",
116+
]
117+
# Timing Master Monitor
118+
timing_master = [
119+
"pyepics",
120+
]
121+
# LATRt XY Stage Agent
122+
# xy_stage = [
123+
# "xy_stage_control @ git+https://github.com/kmharrington/xy_stage_control.git@main",
124+
# ]
125+
126+
[project.scripts]
127+
suprsync = "socs.db.suprsync_cli:main"
128+
129+
[project.urls]
130+
"Bug Tracker" = "https://github.com/simonsobs/ocs/issues"
131+
Documentation = "https://ocs.readthedocs.io/"
132+
Homepage = "https://github.com/simonsobs/socs"
133+
"Source Code" = "https://github.com/simonsobs/ocs"
134+
135+
[tool.hatch.version]
136+
source = "vcs"
137+
138+
# closest scheme to versioneer behavior, avoids auto-incremented version number
139+
# https://setuptools-scm.readthedocs.io/en/latest/usage/#default-versioning-scheme
140+
[tool.hatch.version.raw-options]
141+
version_scheme = "no-guess-dev"
142+
143+
[tool.hatch.build.hooks.vcs]
144+
version-file = "socs/_version.py"
145+
146+
[tool.hatch.build.targets.sdist]
147+
include = [
148+
"/socs",
7149
]
8-
build-backend = "setuptools.build_meta"
9150

10151
[tool.isort]
11152
skip = ["versioneer.py", "socs/_version.py"]

requirements/testing.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
http-server-mock
12
pytest
23
pytest-cov
34
pytest-docker
45
pytest-dependency
56
pytest-order
7+
pytest-twisted
8+
setuptools-scm
69
so3g
710
thola-snmpsim
8-
pytest-twisted
9-
http-server-mock

setup.cfg

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

setup.py

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

socs/__init__.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1-
from . import _version
1+
# Define the variable '__version__':
2+
# This has the closest behavior to versioneer that I could find
3+
# https://github.com/maresb/hatch-vcs-footgun-example
4+
try:
5+
# If setuptools_scm is installed (e.g. in a development environment with
6+
# an editable install), then use it to determine the version dynamically.
7+
from setuptools_scm import get_version
28

3-
__version__ = _version.get_versions()['version']
9+
# This will fail with LookupError if the package is not installed in
10+
# editable mode or if Git is not installed.
11+
__version__ = get_version(root="..", relative_to=__file__, version_scheme="no-guess-dev")
12+
except (ImportError, LookupError):
13+
# As a fallback, use the version that is hard-coded in the file.
14+
try:
15+
from socs._version import __version__ # noqa: F401
16+
except ModuleNotFoundError:
17+
# The user is probably trying to run this without having installed
18+
# the package, so complain.
19+
raise RuntimeError(
20+
"socs is not correctly installed. "
21+
"Please install it with pip."
22+
)

0 commit comments

Comments
 (0)