pyven 99__tar.gz → 101__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 (41) hide show
  1. {pyven-99 → pyven-101}/PKG-INFO +2 -8
  2. {pyven-99 → pyven-101}/README.md +1 -7
  3. pyven-101/pyven/README.md.aridt +42 -0
  4. {pyven-99 → pyven-101}/pyven/checks.py +10 -1
  5. {pyven-99 → pyven-101}/pyven/files.py +10 -19
  6. pyven-101/pyven/minreqs.py +15 -0
  7. {pyven-99 → pyven-101}/pyven/projectinfo.py +11 -6
  8. {pyven-99 → pyven-101}/pyven/release.py +0 -5
  9. {pyven-99 → pyven-101}/pyven/util.py +1 -25
  10. {pyven-99 → pyven-101}/pyven.egg-info/PKG-INFO +2 -8
  11. {pyven-99 → pyven-101}/pyven.egg-info/SOURCES.txt +0 -2
  12. {pyven-99 → pyven-101}/pyven.egg-info/entry_points.txt +0 -2
  13. {pyven-99 → pyven-101}/setup.py +2 -2
  14. pyven-99/pyven/README.md.aridt +0 -30
  15. pyven-99/pyven/drmake.py +0 -11
  16. pyven-99/pyven/launch.py +0 -23
  17. pyven-99/pyven/minreqs.py +0 -10
  18. {pyven-99 → pyven-101}/pyven/__init__.py +0 -0
  19. {pyven-99 → pyven-101}/pyven/bdist.py +0 -0
  20. {pyven-99 → pyven-101}/pyven/divcheck.py +0 -0
  21. {pyven-99 → pyven-101}/pyven/execcheck.py +0 -0
  22. {pyven-99 → pyven-101}/pyven/functions.py +0 -0
  23. {pyven-99 → pyven-101}/pyven/licheck.py +0 -0
  24. {pyven-99 → pyven-101}/pyven/mainmodules.py +0 -0
  25. {pyven-99 → pyven-101}/pyven/nlcheck.py +0 -0
  26. {pyven-99 → pyven-101}/pyven/patchpolicy.py +0 -0
  27. {pyven-99 → pyven-101}/pyven/pipify.py +0 -0
  28. {pyven-99 → pyven-101}/pyven/projectinfo.arid +0 -0
  29. {pyven-99 → pyven-101}/pyven/pyproject.toml.aridt +0 -0
  30. {pyven-99 → pyven-101}/pyven/release.arid +0 -0
  31. {pyven-99 → pyven-101}/pyven/setup.cfg.aridt +0 -0
  32. {pyven-99 → pyven-101}/pyven/setup.py.aridt +0 -0
  33. {pyven-99 → pyven-101}/pyven/setuptools.arid +0 -0
  34. {pyven-99 → pyven-101}/pyven/sourceinfo.py +0 -0
  35. {pyven-99 → pyven-101}/pyven/tasks.py +0 -0
  36. {pyven-99 → pyven-101}/pyven/tests/__init__.py +0 -0
  37. {pyven-99 → pyven-101}/pyven/tryinstall.py +0 -0
  38. {pyven-99 → pyven-101}/pyven.egg-info/dependency_links.txt +0 -0
  39. {pyven-99 → pyven-101}/pyven.egg-info/requires.txt +0 -0
  40. {pyven-99 → pyven-101}/pyven.egg-info/top_level.txt +0 -0
  41. {pyven-99 → pyven-101}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 99
3
+ Version: 101
4
4
  Summary: Manage development of multiple Python projects
5
5
  Home-page: https://pypi.org/project/pyven/
6
6
  Author: Homsar
@@ -19,14 +19,8 @@ Manage development of multiple Python projects
19
19
 
20
20
  ## Commands
21
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
22
  ### minreqs
29
- Print project.arid snippet pinning requires to their minimum allowed versions.
23
+ Pin requires to their minimum allowed versions.
30
24
 
31
25
  ### pipify
32
26
  Generate setuptools files for a project.arid project.
@@ -3,14 +3,8 @@ Manage development of multiple Python projects
3
3
 
4
4
  ## Commands
5
5
 
6
- ### drmake
7
- Build a Docker image with automatic tag.
8
-
9
- ### launch
10
- Run project using a suitable venv from the pool.
11
-
12
6
  ### minreqs
13
- Print project.arid snippet pinning requires to their minimum allowed versions.
7
+ Pin requires to their minimum allowed versions.
14
8
 
15
9
  ### pipify
16
10
  Generate setuptools files for a project.arid project.
@@ -0,0 +1,42 @@
1
+ # $(name)
2
+ $(tagline)$try($.($(verbose_blank)
3
+
4
+ ## Install
5
+ These are generic installation instructions.
6
+
7
+ ### To use, disposably
8
+ Install the current release from PyPI to a virtual environment:
9
+ ```
10
+ python$first$(pyversions) -m venv venvname
11
+ venvname/bin/pip install -U pip
12
+ venvname/bin/pip install $(name)
13
+ . venvname/bin/activate
14
+ ```
15
+
16
+ ### To use, permanently
17
+ ```
18
+ pip$first$(pyversions) install --user $(name)
19
+ ```
20
+ See `~/.local/bin` for executables.
21
+
22
+ ### To develop
23
+ First install venvpool to get the `motivate` command:
24
+ ```
25
+ pip3 install --user venvpool
26
+ ```
27
+ Get codebase and install executables:
28
+ ```
29
+ git clone git@github.com:$(github account)/$(name).git
30
+ motivate $(name)
31
+ ```
32
+ Requirements will be satisfied just in time, using sibling projects with matching .egg-info if any.) $.())$try($join$list$first$map($(commands) $.[
33
+
34
+ ## Commands]) $.())$join$map($(commands) $.[
35
+
36
+ ### $(name)
37
+ $(doc)])$try($.(
38
+
39
+ ## API
40
+
41
+ $(pydoc)$hole$.(
42
+ )) $.())
@@ -10,6 +10,7 @@ from diapyr.util import singleton
10
10
  from itertools import chain
11
11
  from lagoon import diff
12
12
  from lagoon.program import NOEOL, partial
13
+ from pathlib import Path
13
14
  from setuptools import find_packages
14
15
  from shutil import copytree, ignore_patterns
15
16
  from tempfile import NamedTemporaryFile
@@ -49,7 +50,7 @@ class EveryVersion:
49
50
  self.transient = transient
50
51
 
51
52
  def allchecks(self):
52
- for check in self.licheck, self.nlcheck, self.execcheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
53
+ for check in self.licheck, self.nlcheck, self.execcheck, self.reqscheck, self.divcheck, self.pyflakes, self.nose, self.readme, self.github, self.linktree:
53
54
  check()
54
55
 
55
56
  def licheck(self):
@@ -69,6 +70,14 @@ class EveryVersion:
69
70
  from .execcheck import execcheck
70
71
  _runcheck('*', execcheck, self.files.pypaths)
71
72
 
73
+ def reqscheck(self):
74
+ def reqscheck():
75
+ expected = ''.join(f"{r}\n" for r in self.info.allrequires)
76
+ if not expected:
77
+ expected = '# This file blank.\n'
78
+ assert expected == Path(self.info.projectdir, 'requirements.txt').read_text()
79
+ _runcheck('*', reqscheck)
80
+
72
81
  def divcheck(self):
73
82
  from . import divcheck
74
83
  scriptpath = divcheck.__file__
@@ -1,4 +1,3 @@
1
- from .util import stripeol
2
1
  from collections import defaultdict
3
2
  import os, subprocess, xml.dom.minidom as dom
4
3
 
@@ -23,24 +22,16 @@ class Files:
23
22
  @classmethod
24
23
  def relpaths(cls, root, suffixes, prefixes):
25
24
  paths = list(cls._findfiles(root, suffixes, prefixes))
26
- with open(os.devnull) as devnull:
27
- if not subprocess.call(['hg', 'root'], stdout = devnull, stderr = devnull, cwd = root):
28
- badstatuses = set('IR ')
29
- for line in subprocess.Popen(['hg', 'st', '-A'] + paths, stdout = subprocess.PIPE, cwd = root).stdout:
30
- line = stripeol(line).decode()
31
- if line[0] not in badstatuses:
32
- yield line[2:]
33
- else:
34
- if os.path.exists(os.path.join(root, '.gitmodules')):
35
- for submoduleslash in (l.split(' ', 1)[1] + os.sep for l in subprocess.check_output(['git', 'config', '--file', '.gitmodules', '--get-regexp', '^submodule[.].+[.]path$'], cwd = root).decode().splitlines()):
36
- paths = [p for p in paths if not p.startswith(submoduleslash)]
37
- if paths:
38
- p = subprocess.Popen(['git', 'check-ignore'] + paths, stdout = subprocess.PIPE, cwd = root)
39
- ignored = set(p.communicate()[0].decode().splitlines())
40
- assert p.wait() in [0, 1]
41
- for path in paths:
42
- if path not in ignored:
43
- yield path
25
+ if os.path.exists(os.path.join(root, '.gitmodules')):
26
+ for submoduleslash in (l.split(' ', 1)[1] + os.sep for l in subprocess.check_output(['git', 'config', '--file', '.gitmodules', '--get-regexp', '^submodule[.].+[.]path$'], cwd = root).decode().splitlines()):
27
+ paths = [p for p in paths if not p.startswith(submoduleslash)]
28
+ if paths:
29
+ p = subprocess.Popen(['git', 'check-ignore'] + paths, stdout = subprocess.PIPE, cwd = root)
30
+ ignored = set(p.communicate()[0].decode().splitlines())
31
+ assert p.wait() in [0, 1]
32
+ for path in paths:
33
+ if path not in ignored:
34
+ yield path
44
35
 
45
36
  def __init__(self, root):
46
37
  srcsuffixes = sum(([s, "%s.aridt" % s] for s in ['.py', '.py3', '.pyx', '.s', '.sh', '.h', '.cpp', '.cxx', '.arid', '.gradle', '.java', '.mk', '.md']), [])
@@ -0,0 +1,15 @@
1
+ 'Pin requires to their minimum allowed versions.'
2
+ from .projectinfo import ProjectInfo
3
+ from pathlib import Path
4
+ from venvpool import initlogging
5
+
6
+ def main():
7
+ initlogging()
8
+ info = ProjectInfo.seek('.')
9
+ minreqs = [r.minstr() for r in info.parsedrequires()]
10
+ with Path(info.projectdir, 'project.arid').open('a') as f:
11
+ print(f"requires = $list({' '.join(minreqs)})", file = f)
12
+ Path(info.projectdir, 'requirements.txt').write_text(''.join(f"{r}\n" for r in minreqs) if minreqs else '# This file blank.\n')
13
+
14
+ if '__main__' == __name__:
15
+ main()
@@ -1,10 +1,11 @@
1
1
  from . import mainmodules
2
2
  from .files import Files
3
- from .util import Path
3
+ from .util import Seek
4
4
  from aridity.config import ConfigCtrl
5
5
  from aridity.model import Entry, Resource
6
6
  from aridity.util import openresource
7
7
  from inspect import getsource
8
+ from pathlib import Path
8
9
  from pkg_resources import parse_requirements
9
10
  from setuphacks import getsetupkwargs
10
11
  from venvpool import ParsedRequires, TemporaryDirectory
@@ -106,7 +107,7 @@ class ProjectInfo:
106
107
 
107
108
  @classmethod
108
109
  def seek(cls, realdir):
109
- path = Path.seek(realdir, cls.projectaridname)
110
+ path = Seek.seek(realdir, cls.projectaridname)
110
111
  if path is None:
111
112
  raise ProjectInfoNotFoundException(realdir)
112
113
  return cls(path.parent, path)
@@ -117,15 +118,19 @@ class ProjectInfo:
117
118
  return cls.seek(realdir)
118
119
  except ProjectInfoNotFoundException:
119
120
  pass
120
- setuppath = Path.seek(realdir, 'setup.py')
121
+ setuppath = Seek.seek(realdir, 'setup.py')
121
122
  if setuppath is not None:
122
123
  log.info('Use setuptools mode.')
123
- return setuptoolsinfo(setuppath)
124
+ return _setuptoolsinfo(setuppath)
124
125
  log.info('Use uninstallable mode.')
125
- projectdir = os.path.dirname(Path.seek(realdir, '.git'))
126
+ projectdir = os.path.dirname(Seek.seek(realdir, '.git'))
126
127
  with openresource(__name__, 'setuptools.arid') as f:
127
128
  info = cls(projectdir, f)
128
129
  info.config.name = os.path.basename(os.path.abspath(projectdir))
130
+ try:
131
+ info.allrequires.extend((Path(projectdir) / 'requirements.txt').read_text().splitlines())
132
+ except FileNotFoundError:
133
+ pass
129
134
  return info
130
135
 
131
136
  def __init__(self, projectdir, infopathorstream):
@@ -203,7 +208,7 @@ class MainModule:
203
208
  for k, v in d.items():
204
209
  setattr(self, k, v)
205
210
 
206
- def setuptoolsinfo(setuppath):
211
+ def _setuptoolsinfo(setuppath):
207
212
  with openresource(__name__, 'setuptools.arid') as f:
208
213
  info = ProjectInfo(os.path.dirname(setuppath), f)
209
214
  setupkwargs = getsetupkwargs(setuppath, ['name', 'install_requires', 'entry_points'])
@@ -16,7 +16,6 @@ import lagoon, logging, os, re, shutil, sys, sysconfig
16
16
 
17
17
  log = logging.getLogger(__name__)
18
18
  distrelpath = 'dist'
19
- targetremote = 'origin'
20
19
 
21
20
  class Arch:
22
21
 
@@ -89,10 +88,6 @@ def main():
89
88
  if git.status.__porcelain():
90
89
  raise Exception('Uncommitted changes!')
91
90
  log.debug('No uncommitted changes.')
92
- remotename, _ = git.rev_parse.__abbrev_ref('@{u}').split('/')
93
- if targetremote != remotename:
94
- raise Exception("Current branch must track some %s branch." % targetremote)
95
- log.debug("Good remote: %s", remotename)
96
91
  with TemporaryDirectory() as tempdir:
97
92
  copydir = os.path.join(tempdir, os.path.basename(os.path.abspath(info.projectdir)))
98
93
  log.info("Copying project to: %s", copydir)
@@ -7,10 +7,6 @@ def stderr(obj):
7
7
  sys.stderr.write(str(obj))
8
8
  sys.stderr.write(os.linesep)
9
9
 
10
- def stripeol(line):
11
- line, = line.splitlines()
12
- return line
13
-
14
10
  class Excludes:
15
11
 
16
12
  def __init__(self, globs):
@@ -33,7 +29,7 @@ class Excludes:
33
29
  def __contains__(self, relpath):
34
30
  return self.pattern.search(relpath) is not None
35
31
 
36
- class Path(str):
32
+ class Seek(str):
37
33
 
38
34
  @classmethod
39
35
  def seek(cls, dirpath, name):
@@ -47,26 +43,6 @@ class Path(str):
47
43
  break
48
44
  dirpath = parent
49
45
 
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
46
  @contextmanager
71
47
  def bgcontainer(*dockerrunargs):
72
48
  from lagoon import docker
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyven
3
- Version: 99
3
+ Version: 101
4
4
  Summary: Manage development of multiple Python projects
5
5
  Home-page: https://pypi.org/project/pyven/
6
6
  Author: Homsar
@@ -19,14 +19,8 @@ Manage development of multiple Python projects
19
19
 
20
20
  ## Commands
21
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
22
  ### minreqs
29
- Print project.arid snippet pinning requires to their minimum allowed versions.
23
+ Pin requires to their minimum allowed versions.
30
24
 
31
25
  ### pipify
32
26
  Generate setuptools files for a project.arid project.
@@ -6,11 +6,9 @@ pyven/__init__.py
6
6
  pyven/bdist.py
7
7
  pyven/checks.py
8
8
  pyven/divcheck.py
9
- pyven/drmake.py
10
9
  pyven/execcheck.py
11
10
  pyven/files.py
12
11
  pyven/functions.py
13
- pyven/launch.py
14
12
  pyven/licheck.py
15
13
  pyven/mainmodules.py
16
14
  pyven/minreqs.py
@@ -1,6 +1,4 @@
1
1
  [console_scripts]
2
- drmake = pyven.drmake:main
3
- launch = pyven.launch:main
4
2
  minreqs = pyven.minreqs:main
5
3
  pipify = pyven.pipify:main
6
4
  release = pyven.release:main
@@ -44,7 +44,7 @@ class SourceInfo:
44
44
  sourceinfo = SourceInfo('.')
45
45
  setup(
46
46
  name = 'pyven',
47
- version = '99',
47
+ version = '101',
48
48
  description = 'Manage development of multiple Python projects',
49
49
  long_description = long_description(),
50
50
  long_description_content_type = 'text/markdown',
@@ -54,6 +54,6 @@ setup(
54
54
  py_modules = [],
55
55
  install_requires = ['aridity>=77', 'diapyr>=31', 'lagoon>=24', 'pydoc-markdown>=3.3', 'setuptools>=44.1.1', 'twine>=1.15.0', 'venvpool>=14'],
56
56
  package_data = {'': ['*.pxd', '*.pyx', '*.pyxbld', '*.arid', '*.aridt']},
57
- entry_points = {'console_scripts': ['drmake=pyven.drmake:main', 'launch=pyven.launch:main', 'minreqs=pyven.minreqs:main', 'pipify=pyven.pipify:main', 'release=pyven.release:main', 'tasks=pyven.tasks:main', 'tryinstall=pyven.tryinstall:main', 'tests=pyven.tests.__init__:main']},
57
+ entry_points = {'console_scripts': ['minreqs=pyven.minreqs:main', 'pipify=pyven.pipify:main', 'release=pyven.release:main', 'tasks=pyven.tasks:main', 'tryinstall=pyven.tryinstall:main', 'tests=pyven.tests.__init__:main']},
58
58
  **sourceinfo.setup_kwargs(),
59
59
  )
@@ -1,30 +0,0 @@
1
- # $(name)
2
- $(tagline)$try($.($(verbose_blank)
3
-
4
- ## Install
5
- These are generic installation instructions.
6
-
7
- ### To use, permanently
8
- The quickest way to get started is to install the current release from PyPI:
9
- ```
10
- pip$first$(pyversions) install --user $(name)
11
- ```
12
-
13
- ### To use, temporarily
14
- If you prefer to keep .local clean, install to a virtualenv:
15
- ```
16
- python$first$(pyversions) -m venv venvname
17
- venvname/bin/pip install -U pip
18
- venvname/bin/pip install $(name)
19
- . venvname/bin/activate
20
- ```) $.())$try($join$list$first$map($(commands) $.[
21
-
22
- ## Commands]) $.())$join$map($(commands) $.[
23
-
24
- ### $(name)
25
- $(doc)])$try($.(
26
-
27
- ## API
28
-
29
- $(pydoc)$hole$.(
30
- )) $.())
pyven-99/pyven/drmake.py DELETED
@@ -1,11 +0,0 @@
1
- 'Build a Docker image with automatic tag.'
2
- from .projectinfo import ProjectInfo
3
- import os
4
-
5
- def main():
6
- info = ProjectInfo.seek('.')
7
- command = 'docker', 'build', '-t', info.config.docker.tag, info.projectdir
8
- os.execvp(command[0], command)
9
-
10
- if '__main__' == __name__:
11
- main()
pyven-99/pyven/launch.py DELETED
@@ -1,23 +0,0 @@
1
- 'Run project using a suitable venv from the pool.'
2
- from .pipify import InstallDeps
3
- from .projectinfo import ProjectInfo
4
- from argparse import ArgumentParser
5
- from venvpool import initlogging, Pool
6
- import subprocess, sys
7
-
8
- def main(): # TODO: Retire in favour of venvpool module.
9
- initlogging()
10
- parser = ArgumentParser()
11
- parser.add_argument('--build', action = 'store_true', help = 'rebuild native components')
12
- args = parser.parse_args()
13
- info = ProjectInfo.seekany('.')
14
- _, objref = next(iter(info.console_scripts())).split('=') # XXX: Support more than just the first?
15
- modulename, qname = objref.split(':')
16
- with InstallDeps(info, False, None) as installdeps, Pool(sys.version_info.major).readonlyorreadwrite[args.build](installdeps) as venv:
17
- if args.build:
18
- venv.install(['--no-deps', '-e', info.projectdir]) # XXX: Can this be done without venv install?
19
- status = subprocess.call([venv.programpath('python'), '-c', "from %s import %s; %s()" % (modulename, qname.split('.')[0], qname)])
20
- sys.exit(status)
21
-
22
- if '__main__' == __name__:
23
- main()
pyven-99/pyven/minreqs.py DELETED
@@ -1,10 +0,0 @@
1
- 'Print project.arid snippet pinning requires to their minimum allowed versions.'
2
- from .projectinfo import ProjectInfo
3
- from venvpool import initlogging
4
-
5
- def main():
6
- initlogging()
7
- print("requires = $list(%s)" % ' '.join(r.minstr() for r in ProjectInfo.seek('.').parsedrequires()))
8
-
9
- if '__main__' == __name__:
10
- 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