Skip to content

Commit 1deb27c

Browse files
authored
build: Use poetry for building, update docs and Makefiles (#270)
See also: vcs-python/vcspull#303
2 parents 65b6eda + 17b7367 commit 1deb27c

File tree

21 files changed

+196
-557
lines changed

21 files changed

+196
-557
lines changed

.github/workflows/libvcs-ci.yml renamed to .github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: libvcs CI
1+
name: tests
22

33
on: [push]
44

@@ -61,7 +61,7 @@ jobs:
6161
run: poetry run python -m pip install pip -U
6262

6363
- name: Install dependencies
64-
run: poetry install -E "docs test coverage lint format deploy"
64+
run: poetry install -E "docs test coverage lint format"
6565

6666
- name: Lint with flake8
6767
run: poetry run flake8

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,3 @@ pip-wheel-metadata/
8080

8181
# Used by publish-docs.yml CI
8282
.updated_files
83-
84-
# mkdocs
85-
site/
86-
87-
# vim
88-
.vim/

CHANGES

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Generally speaking, refactor / magic is in the process of being stripped
88
out in the next few releases. The API is subject to change significantly
99
in pre-1.0 builds.
1010

11-
- [refactor] [#267](https://github.com/vcs-python/libvcs/pull/267) overhaul docs
11+
- [refactor] [#267] overhaul docs
1212

1313
- Move sphinx api format to Numpy-style
1414

@@ -18,13 +18,20 @@ in pre-1.0 builds.
1818

1919
- Move from RTD to GitHub Action, full support of poetry extras packages, deploys straight to
2020
S3 and CloudFront
21+
- [#270] Build and publish packages via poetry
22+
- [#270] Overhaul development docs
23+
24+
[#270]: https://github.com/vcs-python/libvcs/pull/270
25+
[#267]: https://github.com/vcs-python/libvcs/pull/267
2126

2227
## libvcs 0.4.4 (2020-08-05)
2328

24-
- `268` `libvcs.base.BaseRepo`:
29+
- [#268] `libvcs.base.BaseRepo`:
2530
- no longer sets `**kwargs` to dictionary on the object
2631
- remove `__slot__` and rename `name` attribute to `repo_name`
2732

33+
[#268]: https://github.com/vcs-python/libvcs/pull/268
34+
2835
## libvcs 0.4.3 (2020-08-01)
2936

3037
- \[bug\] `libvcs.git.extract_status()` Fix issue capturing branch
@@ -112,12 +119,14 @@ avoid implicit behavior.
112119
## libvcs 0.3.1 (2020-07-25)
113120

114121
- Fix issue with subprocess.Popen loud warning on Python 3.8
115-
- `296` - Move from Pipfile to poetry
122+
- [#296] - Move from Pipfile to poetry
116123
- Sort imports
117124
- Add isort package, isort configuration in setup.cfg, and
118125
`make isort` task to Makefile.
119126
- Add `project_urls` to setup.py
120127

128+
[#296] https://github.com/vcs-python/libvcs/pull/296
129+
121130
## libvcs 0.3.0 (2018-03-12)
122131

123132
- Move vcspull to the vcs-python organization
@@ -137,8 +146,9 @@ avoid implicit behavior.
137146

138147
## libvcs 0.2.2 (2016-11-23)
139148

140-
- Fix bug with unused `support` module in vcspull. See
141-
[\#43](https://github.com/vcs-python/vcspull/issues/43)
149+
- Fix bug with unused `support` module in vcspull. See [vcspull#43]
150+
151+
[vcspull#43]: https://github.com/vcs-python/vcspull/pull/43
142152

143153
## libvcs 0.2.1 (2016-09-13)
144154

@@ -150,11 +160,14 @@ avoid implicit behavior.
150160

151161
## libvcs 0.2.0 (2016-06-24)
152162

153-
- `9` Support for `progress_callback` to use realtime output from
163+
- [#9] Support for `progress_callback` to use realtime output from
154164
commands in progress (such as `git fetch`).
155-
- `9` More tests, internal factoring and documentation, thanks @jcfr
156-
- `9` Official support for pypy, pypy3
157-
- `11` : Fix unbound local when updating git repos
165+
- [#9] More tests, internal factoring and documentation, thanks @jcfr
166+
- [#9] Official support for pypy, pypy3
167+
- [#11] : Fix unbound local when updating git repos
168+
169+
[#9]: https://github.com/vcs-python/libvcs/pull/9
170+
[#11]: https://github.com/vcs-python/libvcs/pull/11
158171

159172
## libvcs 0.1.7 (2016-06-21)
160173

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include README.md LICENSE CHANGES pyproject.toml .tmuxp.yaml
2-
include requirements/*.txt
32
recursive-include docs *.rst

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PY_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]py$$' 2> /dev/null
22
DOC_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]rst\$\|.*[.]md\$\|.*[.]css\$\|.*[.]py\$\|mkdocs\.yml\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
3+
SHELL := /bin/bash
34

45

56
entr_warn:
@@ -23,19 +24,19 @@ watch_test:
2324
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
2425

2526
build_docs:
26-
poetry run mkdocs build
27+
$(MAKE) -C docs html
2728

2829
watch_docs:
2930
if command -v entr > /dev/null; then ${DOC_FILES} | entr -c $(MAKE) build_docs; else $(MAKE) build_docs entr_warn; fi
3031

3132
serve_docs:
32-
python -m http.server --directory site
33+
$(MAKE) -C docs serve
3334

3435
dev_docs:
3536
$(MAKE) -j watch_docs serve_docs
3637

3738
flake8:
38-
flake8 libvcs tests
39+
poetry run flake8
3940

4041
watch_flake8:
4142
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi

README.rst

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
|pypi| |docs| |build-status| |coverage| |license|
44

5-
Install:
5+
Setup
6+
-----
67

78
.. code-block:: sh
89
@@ -18,6 +19,8 @@ Open up python:
1819
$ pip install ptpython
1920
$ ptpython
2021
22+
Usage
23+
-----
2124
Create a `Repo`_ object of the project to inspect / checkout / update:
2225

2326
.. code-block:: python
@@ -50,7 +53,6 @@ Get revision:
5053
5154
Donations
5255
---------
53-
5456
Your donations fund development of new features, testing and support.
5557
Your money will go directly to maintenance and development of the project.
5658
If you are an individual, feel free to give whatever feels right for the
@@ -60,33 +62,17 @@ See donation options at https://www.git-pull.com/support.html.
6062

6163
More information
6264
----------------
63-
64-
============== ==========================================================
65-
Python support Python 2.7, >= 3.4, pypy
66-
VCS supported git(1), svn(1), hg(1)
67-
Source https://github.com/vcs-python/libvcs
68-
Docs https://libvcs.git-pull.com
69-
Changelog https://libvcs.git-pull.com/history.html
70-
API https://libvcs.git-pull.com/api.html
71-
Issues https://github.com/vcs-python/libvcs/issues
72-
Test Coverage https://codecov.io/gh/vcs-python/libvcs
73-
pypi https://pypi.python.org/pypi/libvcs
74-
Open Hub https://www.openhub.net/p/libvcs
75-
License `MIT`_.
76-
git repo .. code-block:: bash
77-
78-
$ git clone https://github.com/vcs-python/libvcs.git
79-
install dev .. code-block:: bash
80-
81-
$ git clone https://github.com/vcs-python/libvcs.git libvcs
82-
$ cd ./libvcs
83-
$ virtualenv .venv
84-
$ source .venv/bin/activate
85-
$ pip install -e .
86-
tests .. code-block:: bash
87-
88-
$ py.test
89-
============== ==========================================================
65+
- Python support: Python 2.7, >= 3.4, pypy
66+
- VCS supported: git(1), svn(1), hg(1)
67+
- Source: https://github.com/vcs-python/libvcs
68+
- Docs: https://libvcs.git-pull.com
69+
- Changelog: https://libvcs.git-pull.com/history.html
70+
- API: https://libvcs.git-pull.com/api.html
71+
- Issues: https://github.com/vcs-python/libvcs/issues
72+
- Test Coverage: https://codecov.io/gh/vcs-python/libvcs
73+
- pypi: https://pypi.python.org/pypi/libvcs
74+
- Open Hub: https://www.openhub.net/p/libvcs
75+
- License: `MIT`_.
9076

9177
.. _MIT: https://opensource.org/licenses/MIT
9278
.. _Documentation: https://libvcs.git-pull.com/
@@ -99,13 +85,13 @@ tests .. code-block:: bash
9985
:alt: Python Package
10086
:target: http://badge.fury.io/py/libvcs
10187

102-
.. |docs| image:: https://github.com/tony/libvcs/workflows/Publish%20Docs/badge.svg
88+
.. |docs| image:: https://github.com/vcs-python/libvcs/workflows/Publish%20Docs/badge.svg
10389
:alt: Docs
10490
:target: https://github.com/vcs-python/libvcs/actions?query=workflow%3A"Publish+Docs"
10591

106-
.. |build-status| image:: https://github.com/tony/libvcs/workflows/libvcs%20CI/badge.svg
92+
.. |build-status| image:: https://github.com/vcs-python/libvcs/workflows/tests/badge.svg
10793
:alt: Build Status
108-
:target: https://github.com/vcs-python/libvcs/actions?query=workflow%3A"libvcs+CI"
94+
:target: https://github.com/vcs-python/libvcs/actions?query=workflow%3A"tests"
10995

11096
.. |coverage| image:: https://codecov.io/gh/vcs-python/libvcs/branch/master/graph/badge.svg
11197
:alt: Code Coverage

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ checkbuild:
159159
rm -rf $(BUILDDIR)
160160
$(SPHINXBUILD) -n -q ./ $(BUILDDIR)
161161

162-
WATCH_FILES= find .. -type f -not -path '*/\.*' | grep -i '.*[.]rst\$\|.*[.]py\$\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
162+
WATCH_FILES= find .. -type f -not -path '*/\.*' | grep -i '.*[.]rst\$\|.*[.].md\|.*[.]py\$\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
163163

164164
watch:
165165
if command -v entr > /dev/null; then ${WATCH_FILES} | entr -c $(MAKE) html; else $(MAKE) html; fi

docs/_static/favicon.ico

0 Bytes
Binary file not shown.

docs/conf.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# -*- coding: utf-8 -*-
2+
import inspect
23
import os
4+
import sys
5+
from os.path import dirname, relpath
36

47
import alagitpull
58
from recommonmark.transform import AutoStructify
69

10+
import libvcs
11+
712
# Get the project root dir, which is the parent dir of this
813
cwd = os.getcwd()
914
project_root = os.path.dirname(cwd)
@@ -128,3 +133,74 @@ def setup(app):
128133
'py': ('https://docs.python.org/2', None),
129134
'pip': ('http://pip.readthedocs.io/en/latest/', None),
130135
}
136+
137+
138+
def linkcode_resolve(domain, info): # NOQA: C901
139+
"""
140+
Determine the URL corresponding to Python object
141+
142+
Notes
143+
-----
144+
From https://github.com/numpy/numpy/blob/v1.15.1/doc/source/conf.py, 7c49cfa
145+
on Jul 31. License BSD-3. https://github.com/numpy/numpy/blob/v1.15.1/LICENSE.txt
146+
"""
147+
if domain != 'py':
148+
return None
149+
150+
modname = info['module']
151+
fullname = info['fullname']
152+
153+
submod = sys.modules.get(modname)
154+
if submod is None:
155+
return None
156+
157+
obj = submod
158+
for part in fullname.split('.'):
159+
try:
160+
obj = getattr(obj, part)
161+
except Exception:
162+
return None
163+
164+
# strip decorators, which would resolve to the source of the decorator
165+
# possibly an upstream bug in getsourcefile, bpo-1764286
166+
try:
167+
unwrap = inspect.unwrap
168+
except AttributeError:
169+
pass
170+
else:
171+
obj = unwrap(obj)
172+
173+
try:
174+
fn = inspect.getsourcefile(obj)
175+
except Exception:
176+
fn = None
177+
if not fn:
178+
return None
179+
180+
try:
181+
source, lineno = inspect.getsourcelines(obj)
182+
except Exception:
183+
lineno = None
184+
185+
if lineno:
186+
linespec = "#L%d-L%d" % (lineno, lineno + len(source) - 1)
187+
else:
188+
linespec = ""
189+
190+
fn = relpath(fn, start=dirname(libvcs.__file__))
191+
192+
if 'dev' in about['__version__']:
193+
return "%s/blob/master/%s/%s%s" % (
194+
about['__github__'],
195+
about['__package_name__'],
196+
fn,
197+
linespec,
198+
)
199+
else:
200+
return "%s/blob/v%s/%s/%s%s" % (
201+
about['__github__'],
202+
about['__version__'],
203+
about['__package_name__'],
204+
fn,
205+
linespec,
206+
)

0 commit comments

Comments
 (0)