pyven 104__tar.gz → 105__tar.gz

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.
Files changed (39) hide show
  1. {pyven-104 → pyven-105}/PKG-INFO +1 -1
  2. {pyven-104 → pyven-105}/pyven/checks.py +9 -10
  3. pyven-105/pyven/metacheck.py +49 -0
  4. pyven-105/pyven/minreqs.py +22 -0
  5. {pyven-104 → pyven-105}/pyven/pipify.py +13 -16
  6. {pyven-104 → pyven-105}/pyven/projectinfo.py +6 -2
  7. {pyven-104 → pyven-105}/pyven/release.arid +1 -0
  8. {pyven-104 → pyven-105}/pyven/release.py +7 -5
  9. {pyven-104 → pyven-105}/pyven/setup.py.aridt +0 -7
  10. {pyven-104 → pyven-105}/pyven/sourceinfo.py +13 -3
  11. {pyven-104 → pyven-105}/pyven/tryinstall.py +1 -1
  12. {pyven-104 → pyven-105}/pyven.egg-info/PKG-INFO +1 -1
  13. {pyven-104 → pyven-105}/pyven.egg-info/SOURCES.txt +1 -0
  14. {pyven-104 → pyven-105}/setup.py +13 -10
  15. pyven-104/pyven/minreqs.py +0 -14
  16. {pyven-104 → pyven-105}/README.md +0 -0
  17. {pyven-104 → pyven-105}/pyven/README.md.aridt +0 -0
  18. {pyven-104 → pyven-105}/pyven/__init__.py +0 -0
  19. {pyven-104 → pyven-105}/pyven/bdist.py +0 -0
  20. {pyven-104 → pyven-105}/pyven/divcheck.py +0 -0
  21. {pyven-104 → pyven-105}/pyven/execcheck.py +0 -0
  22. {pyven-104 → pyven-105}/pyven/files.py +0 -0
  23. {pyven-104 → pyven-105}/pyven/functions.py +0 -0
  24. {pyven-104 → pyven-105}/pyven/licheck.py +0 -0
  25. {pyven-104 → pyven-105}/pyven/mainmodules.py +0 -0
  26. {pyven-104 → pyven-105}/pyven/nlcheck.py +0 -0
  27. {pyven-104 → pyven-105}/pyven/patchpolicy.py +0 -0
  28. {pyven-104 → pyven-105}/pyven/projectinfo.arid +0 -0
  29. {pyven-104 → pyven-105}/pyven/pyproject.toml.aridt +0 -0
  30. {pyven-104 → pyven-105}/pyven/setup.cfg.aridt +0 -0
  31. {pyven-104 → pyven-105}/pyven/setuptools.arid +0 -0
  32. {pyven-104 → pyven-105}/pyven/tasks.py +0 -0
  33. {pyven-104 → pyven-105}/pyven/tests/__init__.py +0 -0
  34. {pyven-104 → pyven-105}/pyven/util.py +0 -0
  35. {pyven-104 → pyven-105}/pyven.egg-info/dependency_links.txt +0 -0
  36. {pyven-104 → pyven-105}/pyven.egg-info/entry_points.txt +0 -0
  37. {pyven-104 → pyven-105}/pyven.egg-info/requires.txt +0 -0
  38. {pyven-104 → pyven-105}/pyven.egg-info/top_level.txt +0 -0
  39. {pyven-104 → pyven-105}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 104
3
+ Version: 105
4
4
  Summary: Manage development of multiple Python projects
5
5
  Home-page: https://pypi.org/project/pyven/
6
6
  Author: Homsar
@@ -51,9 +51,12 @@ class EveryVersion:
51
51
  self.docker = docker
52
52
  self.transient = transient
53
53
 
54
- def allchecks(self):
55
- for check in self.licheck, self.nlcheck, self.execcheck, self.reqscheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
56
- check()
54
+ def allchecks(self, exclude = ()):
55
+ for check in self.licheck, self.nlcheck, self.execcheck, self.metacheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
56
+ if check.__name__ in exclude:
57
+ log.warning("Exclude: %s", check.__name__)
58
+ else:
59
+ check()
57
60
 
58
61
  def licheck(self):
59
62
  from .licheck import licheck
@@ -72,13 +75,9 @@ class EveryVersion:
72
75
  from .execcheck import execcheck
73
76
  _runcheck('*', execcheck, self.files.pypaths)
74
77
 
75
- def reqscheck(self):
76
- def reqscheck():
77
- expected = ''.join(f"{r}\n" for r in self.info.allrequires)
78
- if not expected:
79
- expected = '# This file blank.\n'
80
- assert expected == (self.info.projectdir / 'requirements.txt').read_text()
81
- _runcheck('*', reqscheck)
78
+ def metacheck(self):
79
+ from .metacheck import metacheck
80
+ _runcheck('*', metacheck, self.info.projectdir, self.info.devversion(), self.docker)
82
81
 
83
82
  def divcheck(self):
84
83
  from . import divcheck
@@ -0,0 +1,49 @@
1
+ from .checks import Container
2
+ from .pipify import pipify, setupcommand
3
+ from .projectinfo import ProjectInfo
4
+ from .util import bgcontainer, pyversiontags
5
+ from contextlib import contextmanager
6
+ from lagoon import diff
7
+ from pathlib import Path
8
+ from shutil import copy2
9
+ from tempfile import TemporaryDirectory
10
+ import sys
11
+
12
+ @contextmanager
13
+ def egginfodir(projectdir, version, dockerenabled):
14
+ with TemporaryDirectory() as tempdir:
15
+ copy2(projectdir / 'project.arid', tempdir)
16
+ try:
17
+ copy2(projectdir / 'README.md', tempdir)
18
+ except FileNotFoundError:
19
+ pass
20
+ copyinfo = ProjectInfo.seek(tempdir)
21
+ pipify(copyinfo, version)
22
+ if dockerenabled and {'setuptools', 'wheel'} != set(copyinfo.allbuildrequires):
23
+ with bgcontainer('-v', f"{tempdir}:{Container.workdir}", f"python:{pyversiontags[3][0]}") as container:
24
+ container = Container(container)
25
+ container.inituser()
26
+ for command in ['apt-get', 'update'], ['apt-get', 'install', '-y', 'sudo']:
27
+ container.call(command, check = True, root = True)
28
+ container.call(['pip', 'install', '--upgrade', 'setuptools'], check = True, root = True)
29
+ container.call(['pip', 'install', *copyinfo.allbuildrequires], check = True, root = True)
30
+ container.call(['python', 'setup.py', 'egg_info'], check = True)
31
+ else:
32
+ setupcommand(copyinfo, 3, False, 'egg_info')
33
+ d, = Path(tempdir).glob('*.egg-info')
34
+ yield tempdir, d
35
+
36
+ def metacheck(projectdir, version, dockerenabled):
37
+ with egginfodir(projectdir, version, dockerenabled) as (tempdir, d):
38
+ p = d / 'requires.txt'
39
+ q = projectdir / p.relative_to(tempdir)
40
+ if p.exists():
41
+ diff[print](p, q)
42
+ else:
43
+ assert not q.exists()
44
+ p = d / 'PKG-INFO'
45
+ q = projectdir / p.relative_to(tempdir)
46
+ assert q.exists()
47
+ text = diff(p, q, check = False).stdout
48
+ sys.stdout.write(text)
49
+ assert all(l[0] not in '<>' or l.startswith(('> Requires-Dist: ', '> License-File: ')) for l in text.splitlines())
@@ -0,0 +1,22 @@
1
+ 'Pin requires to their minimum allowed versions.'
2
+ from .metacheck import egginfodir
3
+ from .projectinfo import ProjectInfo
4
+ from shutil import copy2
5
+ from venvpool import initlogging
6
+
7
+ def main():
8
+ initlogging()
9
+ info = ProjectInfo.seek('.')
10
+ with (info.projectdir / 'project.arid').open('a') as f:
11
+ print(f"requires = $list({' '.join(r.minstr() for r in info.parsedrequires())})", file = f)
12
+ with egginfodir(info.projectdir, info.devversion(), True) as (tempdir, d):
13
+ for name in 'PKG-INFO', 'requires.txt':
14
+ p = d / name
15
+ q = info.projectdir / p.relative_to(tempdir)
16
+ if p.exists():
17
+ copy2(p, q)
18
+ elif q.exists():
19
+ q.unlink()
20
+
21
+ if '__main__' == __name__:
22
+ main()
@@ -14,16 +14,12 @@ import logging, os, sys
14
14
 
15
15
  log = logging.getLogger(__name__)
16
16
 
17
- def pipify(info, version = None):
18
- release = version is not None
17
+ def pipify(info, version):
19
18
  # Allow release of project without origin:
20
- if release:
21
- if info.config.github.participant:
22
- _, url = info.descriptionandurl()
23
- elif info.config.pypi.participant:
24
- url = f"https://pypi.org/project/{info.config.name}/"
25
- else:
26
- raise Exception
19
+ if info.config.github.participant:
20
+ _, url = info.descriptionandurl()
21
+ elif info.config.pypi.participant:
22
+ url = f"https://pypi.org/project/{info.config.name}/"
27
23
  else:
28
24
  url = None
29
25
  cc = ConfigCtrl()
@@ -35,12 +31,14 @@ console_scripts := $list()
35
31
  cc.w.tagline = info.config.tagline
36
32
  for t in info.config.resource.types:
37
33
  cc.w.resource.types += t
38
- cc.w.version = version if release else info.devversion()
34
+ cc.w.version = version
39
35
  cc.w.description = info.config.tagline
40
- cc.w.long_description = 'long_description()' if release else repr(None)
41
36
  cc.w.url = url
42
- cc.w.author = info.config.author if release else None
43
- cc.w.author_email = info.config.author_email if release else None
37
+ if info.config.pypi.participant:
38
+ cc.w.author = info.config.author
39
+ cc.w.author_email = info.config.author_email
40
+ else:
41
+ cc.w.author = cc.w.author_email = None
44
42
  for m in info.py_modules():
45
43
  cc.w.py_modules += m
46
44
  for r in info.allrequires:
@@ -68,11 +66,10 @@ def main():
68
66
  initlogging()
69
67
  parser = ArgumentParser()
70
68
  parser.add_argument('--transient', action = 'store_true')
71
- parser.add_argument('--version')
72
69
  parser.add_argument('projectdir', nargs = '?', type = Path) # FIXME: When projectdir is passed in its console_scripts are not populated!
73
70
  args = parser.parse_args()
74
71
  info = ProjectInfo.seek('.') if args.projectdir is None else ProjectInfo(args.projectdir, args.projectdir / ProjectInfo.projectaridname)
75
- pipify(info, args.version)
72
+ pipify(info, info.devversion())
76
73
  setupcommand(info, sys.version_info.major, args.transient, 'egg_info')
77
74
 
78
75
  def setupcommand(info, pyversion, transient, *command):
@@ -143,7 +140,7 @@ class InstallDeps:
143
140
  def process(self, t):
144
141
  return adddeps(*t)
145
142
  for i in volatileprojects.values(): # Assume editables already pipified.
146
- pipify(i)
143
+ pipify(i, i.devversion())
147
144
  self.localreqs = [str(i.projectdir) for i in editableprojects.values()]
148
145
  self.volatileprojects = volatileprojects.values()
149
146
  self.fetchreqs = list(Req.published(pypireqs))
@@ -199,8 +199,12 @@ class ProjectInfo:
199
199
  return [mm.console_script for mm in self.mainmodules()]
200
200
 
201
201
  def devversion(self):
202
- releases = [int(t[1:]) for t in git.tag(cwd = self.projectdir).splitlines() if 'v' == t[0]]
203
- return f"{(max(releases) if releases else 0) + 1}.dev0"
202
+ def releases():
203
+ for tag in git.tag(cwd = self.projectdir).splitlines():
204
+ m = re.fullmatch('release/(.+)', tag)
205
+ if m is not None:
206
+ yield int(m.group(1))
207
+ return f"{max(releases(), default = 0) + 1}.dev0"
204
208
 
205
209
  class MainModule:
206
210
 
@@ -2,6 +2,7 @@ account = $(void)
2
2
  cli
3
3
  path = $(void)
4
4
  upload = $(void)
5
+ golden_remote = $(void)
5
6
  path = $(cli path)
6
7
  token = $gpg$(token_gpg $(account))
7
8
  upload = $(cli upload)
@@ -124,11 +124,16 @@ def _runsetup(info, commands):
124
124
  venv.run('check_call', ['.'], 'setup', commands, cwd = info.projectdir) # XXX: Should venvpool automatically include current dir?
125
125
 
126
126
  def release(config, srcgit, info):
127
- scrub = git.clean._xdi[partial, print](cwd = info.projectdir, input = 'c')
127
+ copygit = git[partial](cwd = info.projectdir)
128
+ scrub = copygit.clean._xdi[partial, print](input = 'c')
128
129
  scrub()
129
130
  version = info.nextversion()
131
+ releasetag = f"release/{version}"
132
+ if releasetag not in copygit.tag.__points_at().splitlines():
133
+ copygit.tag[print](releasetag)
134
+ copygit.push[print](config.golden_remote, releasetag)
130
135
  pipify(info, version)
131
- EveryVersion(info, False, False, [], False, True).allchecks()
136
+ EveryVersion(info, False, False, [], False, True).allchecks(exclude = ['metacheck'])
132
137
  scrub()
133
138
  for dirpath, dirnames, filenames in os.walk(info.projectdir):
134
139
  for name in chain(filenames, dirnames):
@@ -148,9 +153,6 @@ def release(config, srcgit, info):
148
153
  _runsetup(info, setupcommands + ['sdist'])
149
154
  artifactrelpaths = [os.path.join(distrelpath, name) for name in sorted(os.listdir(info.projectdir / distrelpath))]
150
155
  if config.upload:
151
- srcgit.tag[print](f"v{version}")
152
- # TODO LATER: If tag succeeded but push fails, we're left with a bogus tag.
153
- srcgit.push.__tags[print]() # XXX: Also update other remotes?
154
156
  with config.token as token:
155
157
  Program.text(sys.executable)._m.twine.upload[print]('-u', '__token__', '-p', token, *uploadableartifacts(artifactrelpaths), cwd = info.projectdir, env = Pip.envpatch)
156
158
  else:
@@ -1,17 +1,10 @@
1
1
  from setuptools import setup
2
-
3
- def long_description():
4
- with open('README.md') as f:
5
- return f.read()
6
-
7
2
  $readfile$./(sourceinfo.py)
8
3
  sourceinfo = SourceInfo('.')
9
4
  setup(
10
5
  name = $"$(name),
11
6
  version = $"$(version),
12
7
  description = $"$(tagline),
13
- long_description = $(long_description),
14
- long_description_content_type = 'text/markdown',
15
8
  url = $"$(url),
16
9
  author = $"$(author),
17
10
  author_email = $"$(author_email),
@@ -1,3 +1,11 @@
1
+ try:
2
+ from Cython.Build import cythonize
3
+ except ModuleNotFoundError:
4
+ pass
5
+ from pathlib import Path
6
+ from setuptools import find_packages
7
+ import os
8
+
1
9
  class SourceInfo:
2
10
 
3
11
  class PYXPath:
@@ -19,8 +27,6 @@ class SourceInfo:
19
27
  module = f"{moduleprefix}{name[:-len(suffix)]}"
20
28
  if module not in extpaths:
21
29
  extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
22
- from setuptools import find_packages
23
- import os
24
30
  self.packages = find_packages(rootdir)
25
31
  extpaths = {}
26
32
  addextpaths('.', '')
@@ -30,7 +36,11 @@ class SourceInfo:
30
36
 
31
37
  def setup_kwargs(self):
32
38
  kwargs = dict(packages = self.packages)
39
+ try:
40
+ kwargs['long_description'] = Path('README.md').read_text()
41
+ kwargs['long_description_content_type'] = 'text/markdown'
42
+ except FileNotFoundError:
43
+ pass
33
44
  if self.extpaths:
34
- from Cython.Build import cythonize
35
45
  kwargs['ext_modules'] = cythonize([path.make_ext() for path in self.extpaths])
36
46
  return kwargs
@@ -31,7 +31,7 @@ def main():
31
31
  containerexec('apt-get', 'update')
32
32
  containerexec('apt-get', 'install', '-y', *upstream_devel_packages)
33
33
  containerexec('pip', 'install', req)
34
- git.checkout[print](f"v{version}")
34
+ git.checkout[print](f"release/{version}")
35
35
  EveryVersion(ProjectInfo.seek('.'), False, False, [], True, True).nose()
36
36
 
37
37
  if '__main__' == __name__:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 104
3
+ Version: 105
4
4
  Summary: Manage development of multiple Python projects
5
5
  Home-page: https://pypi.org/project/pyven/
6
6
  Author: Homsar
@@ -11,6 +11,7 @@ pyven/files.py
11
11
  pyven/functions.py
12
12
  pyven/licheck.py
13
13
  pyven/mainmodules.py
14
+ pyven/metacheck.py
14
15
  pyven/minreqs.py
15
16
  pyven/nlcheck.py
16
17
  pyven/patchpolicy.py
@@ -1,8 +1,11 @@
1
1
  from setuptools import setup
2
-
3
- def long_description():
4
- with open('README.md') as f:
5
- return f.read()
2
+ try:
3
+ from Cython.Build import cythonize
4
+ except ModuleNotFoundError:
5
+ pass
6
+ from pathlib import Path
7
+ from setuptools import find_packages
8
+ import os
6
9
 
7
10
  class SourceInfo:
8
11
 
@@ -25,8 +28,6 @@ class SourceInfo:
25
28
  module = f"{moduleprefix}{name[:-len(suffix)]}"
26
29
  if module not in extpaths:
27
30
  extpaths[module] = self.PYXPath(module, os.path.join(dirpath, name))
28
- from setuptools import find_packages
29
- import os
30
31
  self.packages = find_packages(rootdir)
31
32
  extpaths = {}
32
33
  addextpaths('.', '')
@@ -36,18 +37,20 @@ class SourceInfo:
36
37
 
37
38
  def setup_kwargs(self):
38
39
  kwargs = dict(packages = self.packages)
40
+ try:
41
+ kwargs['long_description'] = Path('README.md').read_text()
42
+ kwargs['long_description_content_type'] = 'text/markdown'
43
+ except FileNotFoundError:
44
+ pass
39
45
  if self.extpaths:
40
- from Cython.Build import cythonize
41
46
  kwargs['ext_modules'] = cythonize([path.make_ext() for path in self.extpaths])
42
47
  return kwargs
43
48
 
44
49
  sourceinfo = SourceInfo('.')
45
50
  setup(
46
51
  name = 'pyven',
47
- version = '104',
52
+ version = '105',
48
53
  description = 'Manage development of multiple Python projects',
49
- long_description = long_description(),
50
- long_description_content_type = 'text/markdown',
51
54
  url = 'https://pypi.org/project/pyven/',
52
55
  author = 'Homsar',
53
56
  author_email = 'homsar@foyono.com',
@@ -1,14 +0,0 @@
1
- 'Pin requires to their minimum allowed versions.'
2
- from .projectinfo import ProjectInfo
3
- from venvpool import initlogging
4
-
5
- def main():
6
- initlogging()
7
- info = ProjectInfo.seek('.')
8
- minreqs = [r.minstr() for r in info.parsedrequires()]
9
- with (info.projectdir / 'project.arid').open('a') as f:
10
- print(f"requires = $list({' '.join(minreqs)})", file = f)
11
- (info.projectdir / 'requirements.txt').write_text(''.join(f"{r}\n" for r in minreqs) if minreqs else '# This file blank.\n')
12
-
13
- if '__main__' == __name__:
14
- main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes