pyven 98__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ 'Run project unit tests and more, also suitable for CI.'
2
+ from ..checks import main
3
+
4
+ if '__main__' == __name__:
5
+ main()
pyven/tryinstall.py ADDED
@@ -0,0 +1,39 @@
1
+ 'Check last release can be installed from PyPI and its tests still pass, for use by CI.'
2
+ from .checks import EveryVersion
3
+ from .projectinfo import ProjectInfo
4
+ from .util import bgcontainer, initapt, pyversiontags
5
+ from lagoon import git
6
+ from lagoon.program import partial
7
+ from urllib.request import urlopen
8
+ from venvpool import initlogging
9
+ import logging, xml.etree.ElementTree as ET
10
+
11
+ log = logging.getLogger(__name__)
12
+
13
+ def main():
14
+ from lagoon import docker
15
+ initlogging()
16
+ headinfo = ProjectInfo.seek('.')
17
+ if not headinfo.config.pypi.participant: # XXX: Or look for tags?
18
+ log.info('Not user-installable.')
19
+ return
20
+ project = headinfo.config.name
21
+ # XXX: When building a tag use that same version?
22
+ with urlopen("https://pypi.org/rss/project/%s/releases.xml" % project) as f:
23
+ version = ET.parse(f).find('./channel/item/title').text
24
+ req = "%s==%s" % (project, version)
25
+ upstream_devel_packages = list(headinfo.config.upstream.devel.packages)
26
+ for pyversion in reversed(pyversiontags[3]): # XXX: Why only 3?
27
+ log.info("Python version: %s", pyversion)
28
+ with bgcontainer("python:%s" % pyversion) as container:
29
+ containerexec = docker[partial]('exec', container, stdout = None)
30
+ if upstream_devel_packages:
31
+ initapt(containerexec)
32
+ containerexec('apt-get', 'update')
33
+ containerexec('apt-get', 'install', '-y', *upstream_devel_packages)
34
+ containerexec('pip', 'install', req)
35
+ git.checkout("v%s" % version, stdout = None)
36
+ EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
37
+
38
+ if '__main__' == __name__:
39
+ main()
pyven/util.py ADDED
@@ -0,0 +1,83 @@
1
+ from contextlib import contextmanager
2
+ import os, re, sys
3
+
4
+ pyversiontags = {2: ['2'], 3: ['3.9', '3.10', '3.11', '3.12', '3.13']}
5
+
6
+ def stderr(obj):
7
+ sys.stderr.write(str(obj))
8
+ sys.stderr.write(os.linesep)
9
+
10
+ def stripeol(line):
11
+ line, = line.splitlines()
12
+ return line
13
+
14
+ class Excludes:
15
+
16
+ def __init__(self, globs):
17
+ def disjunction():
18
+ sep = re.escape(os.sep)
19
+ star = "[^%s]*" % sep
20
+ def components():
21
+ for word in glob.split('/'):
22
+ if '**' == word:
23
+ yield "(?:%s%s)*" % (star, sep)
24
+ else:
25
+ yield star.join(re.escape(part) for part in word.split('*'))
26
+ yield sep
27
+ for glob in globs:
28
+ concat = ''.join(components())
29
+ assert concat.endswith(sep)
30
+ yield concat[:-len(sep)]
31
+ self.pattern = re.compile("^%s$" % '|'.join(disjunction()))
32
+
33
+ def __contains__(self, relpath):
34
+ return self.pattern.search(relpath) is not None
35
+
36
+ class Path(str):
37
+
38
+ @classmethod
39
+ def seek(cls, dirpath, name):
40
+ while True:
41
+ path = cls(os.path.join(dirpath, name))
42
+ if os.path.exists(path):
43
+ path.parent = dirpath
44
+ return path
45
+ parent = os.path.join(dirpath, '..')
46
+ if os.path.abspath(parent) == os.path.abspath(dirpath):
47
+ break
48
+ dirpath = parent
49
+
50
+ class ThreadPoolExecutor:
51
+
52
+ def __enter__(self):
53
+ return self
54
+
55
+ def submit(self, f, *args, **kwargs):
56
+ class Task:
57
+ def result(self):
58
+ return f(*args, **kwargs)
59
+ return Task()
60
+
61
+ def __exit__(self, *exc_info):
62
+ pass
63
+
64
+ assert ThreadPoolExecutor
65
+ try:
66
+ from concurrent.futures import ThreadPoolExecutor
67
+ except ImportError:
68
+ pass
69
+
70
+ @contextmanager
71
+ def bgcontainer(*dockerrunargs):
72
+ from lagoon import docker
73
+ from lagoon.program import NOEOL
74
+ container = docker.run._d[NOEOL](*dockerrunargs + ('sleep', 'inf'))
75
+ try:
76
+ yield container
77
+ finally:
78
+ docker.rm._f(container, stdout = None)
79
+
80
+ def initapt(dockerexec):
81
+ dockerexec('mkdir', '-pv', '/etc/apt/keyrings')
82
+ dockerexec('curl', '-fsSL', 'https://download.docker.com/linux/debian/gpg', '-o', '/etc/apt/keyrings/docker.asc')
83
+ dockerexec('sh', '-c', 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list')
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyven
3
+ Version: 98
4
+ Summary: Manage development of multiple Python projects
5
+ Home-page: https://pypi.org/project/pyven/
6
+ Author: Homsar
7
+ Author-email: homsar@foyono.com
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: aridity>=77
10
+ Requires-Dist: diapyr>=31
11
+ Requires-Dist: lagoon>=24
12
+ Requires-Dist: pydoc-markdown>=3.3
13
+ Requires-Dist: setuptools>=44.1.1
14
+ Requires-Dist: twine>=1.15.0
15
+ Requires-Dist: venvpool>=14
16
+
17
+ # pyven
18
+ Manage development of multiple Python projects
19
+
20
+ ## Commands
21
+
22
+ ### drmake
23
+ Build a Docker image with automatic tag.
24
+
25
+ ### launch
26
+ Run project using a suitable venv from the pool.
27
+
28
+ ### minreqs
29
+ Print project.arid snippet pinning requires to their minimum allowed versions.
30
+
31
+ ### pipify
32
+ Generate setuptools files for a project.arid project.
33
+
34
+ ### release
35
+ Release project to PyPI, with manylinux wheels as needed.
36
+
37
+ ### tasks
38
+ Show all XXX/TODO/FIXME comments in project.
39
+
40
+ ### tests
41
+ Run project unit tests and more, also suitable for CI.
42
+
43
+ ### tryinstall
44
+ Check last release can be installed from PyPI and its tests still pass, for use by CI.
@@ -0,0 +1,34 @@
1
+ pyven/README.md.aridt,sha256=O8r8d9rIIjOSQvRyQLc3iKxykDTjKgykB6idQWywZhQ,643
2
+ pyven/__init__.py,sha256=fwnRDSIENH-E-fX2ynp1cd1pTAM03w691ZUdmWOQE34,19
3
+ pyven/bdist.py,sha256=6b3RvEHRc4I1RJtosQn4AaEuZEIrocls5h709V0j3XI,1493
4
+ pyven/checks.py,sha256=s-cPKxgGCuOJYqnoFe14fRQGnUHmX-ROqMF3nZPWGSk,13016
5
+ pyven/divcheck.py,sha256=VvpatkNMLZbYgorUQ7QuY_qKO_1l30eAIGimvwAMwn4,548
6
+ pyven/drmake.py,sha256=ATJmhYCnCswDj3yfd26ggdFGl8nPrN3SWvOIW8zPCz8,289
7
+ pyven/execcheck.py,sha256=k21EjBnEsdMzEKykQfLcmJB8XIMbfe4hB331Kdy2LQM,782
8
+ pyven/files.py,sha256=VtzharC9N1yc3I-oFQsDnikR8u3XF--5LBiwhfbxms8,3501
9
+ pyven/functions.py,sha256=q3StsOaoxZ2avWf-bd3WuWHyJM_B4yjjg2E1-PqZM8I,232
10
+ pyven/launch.py,sha256=Yx_hIFRd7yn8_unmg7bX6L_nvv8vFub3fK-3ydPlDMg,1100
11
+ pyven/licheck.py,sha256=UDuzDry7nmaaN3fAr7D_gNkNlL0BUpjf_er9l4X2OLw,3015
12
+ pyven/mainmodules.py,sha256=kC8XLTNnYo0OvaQaveqhcTOhldPHBtLtU99QXQHRTp4,1741
13
+ pyven/minreqs.py,sha256=xboXFAROtGU0-0pN0FJACgB3yBFlkKdFSkUHQt7iLo0,326
14
+ pyven/nlcheck.py,sha256=1v2ncenmrIj5GA6jaArqvqLCNphjscSmN7CYgTNPQ8w,312
15
+ pyven/patchpolicy.py,sha256=hZ8c_Omy1af4bEA0doKymQamZr7W0pW8B63SszqSxyQ,693
16
+ pyven/pipify.py,sha256=Xf-llfoGSQbp2NxOZTjhk7a_MdT5InQWwFwcfcUFq3A,6538
17
+ pyven/projectinfo.arid,sha256=AWkwimPi0PfXyvMrCyWCMuGya8zI9qsGv81GZcCPr28,856
18
+ pyven/projectinfo.py,sha256=GjELA6m0GPjXEmmU6-pafuPqYQbABogQUKPya0KC76A,7689
19
+ pyven/pyproject.toml.aridt,sha256=y6-VgQ773OpQosT7N6HE6mkgvi86sCeALe1iM14oneY,77
20
+ pyven/release.arid,sha256=yBVMxvdOQ84rexOMGUDoEVoRhzjZ1WAuPGgPV_vz69M,140
21
+ pyven/release.py,sha256=bvr68oYArLVlo41-C-D4x2EmiEy6bpRMEGHzY2ojseM,8044
22
+ pyven/setup.cfg.aridt,sha256=YbyTGH4IE_lKN2pEku9ck2P8C8ad-b7vKY989blaYi8,37
23
+ pyven/setup.py.aridt,sha256=zdRRWDGXNz_d_n14acy9SnOmQiFffYXNIVWkZ9C7Zws,770
24
+ pyven/setuptools.arid,sha256=hsXviQeT9cHYXatH7XkwCZCmZsE8ELhtYZceZ_Ddjsg,40
25
+ pyven/sourceinfo.py,sha256=q-Lx_TnaB56-K574Bv9tXmyjC3AkQ2gkgbwhN2TYQqA,1360
26
+ pyven/tasks.py,sha256=-mCtwnaQ8S6rLWkvGGeV2PAcDs_P8xy3uL1AzYxbjOA,920
27
+ pyven/tryinstall.py,sha256=6WrMcT1gB1ToRfZRpfiWDL0FOf29gu7WGBJY8s0bsUo,1681
28
+ pyven/util.py,sha256=TDxqhwFyJ2nacIQaNCfoWmFLmRiut6InrgIl_tu7Dk4,2602
29
+ pyven/tests/__init__.py,sha256=_3hq4uhPFMuCq7DvXYYp_NLBNoc4YCmRijaaleYuWZ0,122
30
+ pyven-98.dist-info/METADATA,sha256=QosYU46cP3FPGdH3H4DFhqhAiS-D9LiS1MzKtnQrYmI,1074
31
+ pyven-98.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
32
+ pyven-98.dist-info/entry_points.txt,sha256=gQgwjQxI0u8tx7WA2_Xq-oF4XJW1kxF_RSWmquvV6bg,251
33
+ pyven-98.dist-info/top_level.txt,sha256=LaOndZbwF-drOPi7GVRXFVYzBEtq60p4ZQnS_gnYmSE,6
34
+ pyven-98.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,9 @@
1
+ [console_scripts]
2
+ drmake = pyven.drmake:main
3
+ launch = pyven.launch:main
4
+ minreqs = pyven.minreqs:main
5
+ pipify = pyven.pipify:main
6
+ release = pyven.release:main
7
+ tasks = pyven.tasks:main
8
+ tests = pyven.tests.__init__:main
9
+ tryinstall = pyven.tryinstall:main
@@ -0,0 +1 @@
1
+ pyven