Skip to content

Commit 2671824

Browse files
committed
Modernize project
Move all configuration to pyproject.toml and remove setup.py. Use setuptools-scm for automatic version number derivation. Move all scripts to gdsii.scripts and remove hashbangs and executable permission. Name main function run() in each script. This allows to use project.scripts section in pyproject.toml. Add link to the documentation site. Declare pyyaml as optional dependency.
1 parent 96d5859 commit 2671824

7 files changed

Lines changed: 53 additions & 49 deletions

File tree

MANIFEST.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ prune doc/_build
33

44
recursive-include test/data *
55

6-
include test/__init__.py
7-
86
include Makefile
9-
include LGPL-3
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /usr/bin/python
2-
# -*- coding: utf-8 -*-
31
# Copyright © 2010 Eugeniy Meshcheryakov <eugen@debian.org>
42
# This file is licensed under GNU Lesser General Public License version 3 or later.
53
"""Demonstration program for basic gdsii reading function."""
@@ -27,10 +25,13 @@ def main(name):
2725
def usage(prog):
2826
print('Usage: %s <file.gds>' % prog)
2927

30-
if __name__ == '__main__':
28+
def run():
3129
if (len(sys.argv) > 1):
3230
main(sys.argv[1])
3331
else:
3432
usage(sys.argv[0])
3533
sys.exit(1)
3634
sys.exit(0)
35+
36+
if __name__ == '__main__':
37+
run()
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#! /usr/bin/python
21
# -*- coding: utf-8 -*-
32
# Copyright © 2010 Eugeniy Meshcheryakov <eugen@debian.org>
43
# This file is licensed under GNU Lesser General Public License version 3 or later.
@@ -213,10 +212,13 @@ def main(name):
213212
def usage(prog):
214213
print('Usage: %s <file.gds>' % prog)
215214

216-
if __name__ == '__main__':
215+
def run():
217216
if (len(sys.argv) > 1):
218217
main(sys.argv[1])
219218
else:
220219
usage(sys.argv[0])
221220
sys.exit(1)
222221
sys.exit(0)
222+
223+
if __name__ == '__main__':
224+
run()
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#! /usr/bin/python
21
# -*- coding: utf-8 -*-
32
# Copyright © 2011 Eugeniy Meshcheryakov <eugen@debian.org>
43
# This file is licensed under GNU Lesser General Public License version 3 or later.
@@ -57,9 +56,12 @@ def main(argv):
5756
def usage(prog):
5857
print('Usage: %s -o <file.gds> [<input.txt>]' % prog)
5958

60-
if __name__ == '__main__':
59+
def run():
6160
if len(sys.argv) > 1:
6261
main(sys.argv)
6362
else:
6463
usage(sys.argv[0])
6564
sys.exit(1)
65+
66+
if __name__ == '__main__':
67+
run()

pyproject.toml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
11
[build-system]
2-
requires = ["setuptools >= 64"]
2+
requires = ["setuptools>=64", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "python-gdsii"
7+
description = "GDSII manipulation library"
8+
dynamic = ["version"]
9+
license = "LGPL-3.0-or-later"
10+
license-files = ["LGPL-3"]
11+
authors = [
12+
{name = "Ievgenii Meshcheriakov", email = "eugen@debian.org"}
13+
]
14+
classifiers = [
15+
"Development Status :: 3 - Alpha",
16+
"Environment :: Console",
17+
"Intended Audience :: Developers",
18+
"Programming Language :: Python",
19+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
20+
"Topic :: Software Development :: Libraries :: Python Modules"
21+
]
22+
readme = "README.rst"
23+
24+
[project.scripts]
25+
gds2txt = "gdsii.scripts.gds2txt:run"
26+
txt2gds = "gdsii.scripts.txt2gds:run"
27+
gds2yaml = "gdsii.scripts.gds2yaml:run"
28+
29+
[project.urls]
30+
Documentation = "https://python-gdsii.readthedocs.io/en/latest/"
31+
Repository = "https://github.com/eugmes/python-gdsii.git"
32+
Issues = "https://github.com/eugmes/python-gdsii/issues"
33+
34+
[project.optional-dependencies]
35+
yaml = ["pyyaml"]
36+
37+
[tool.pytest]
38+
# gds2yaml requires pyyaml, so don't test it by default
39+
addopts = ["--doctest-modules", "--ignore-glob=*gds2yaml.py", "--import-mode=importlib"]
40+
doctest_optionflags = ["IGNORE_EXCEPTION_DETAIL"]
41+
42+
[tool.setuptools_scm]
43+
tag_regex = "^release-(?P<version>[0-9]+\\.[0-9]+(\\.[0-9]+)?)$"

setup.py

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

0 commit comments

Comments
 (0)