Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge maint into master, DO NOT MERGE PR #6677

Merged
merged 34 commits into from
May 4, 2022

Conversation

yarikoptic
Copy link
Member

Just for CI, will merge locally and push

bpoldrack and others added 30 commits April 11, 2022 11:55
Annex uses a `-` instead of `_` in its JSON key names.
This correction should only have a minor impact on behavior. Instead of
the intended replacement of a list of messages under `error-messages`
with a joined message under `error_message`, the created record
unintentionally had both.

(Closes datalad#6621)
Replaced error_messages with error_message because the generic
results renderer (from datalad.interface.utils) uses error_message.

If there are multiple error messages, they will be joined into one
multi-line string (as done e.g. by annexjson2result from
datalad.interface.results).
BF: Fix wrong key name of annex' JSON records
The test expects that when calling drop with allkeys, potential error
messages reported by git-annex will be passed on to the drop's result
record (using 'error_message' key).
In particular useful while troubleshooting extensions, which would
typically reuse the same setup/teardown as of the core package.

Ran into such a desire while looking at mih/datalad-mihextras#27
This achieves the same modularization of the code as in datalad#6555,
but without making any changes to the actual credential handling.
Datalad now depends on entry_points taking kwargs, introduced in python/importlib_metadata@8320ade, first released in importlib-metadata 3.6.
Factor out credential handling of create-sibling-ghlike
MNT: Require importlib-metadata >=3.6 for Python < 3.10 for entry_points taking kwargs
ENH: include version of datalad in tests teardown Versions: report
This commit delegates the actual data transfer in
push to a new method: _transfer_data. This is done
to simplify monkey-patching via "datalad_next", in
order to implement export to git-annex special remotes
with type webdav and exporttree enabled.
This commit add the 'todo_interface_extensions' decorator
that helps to mark functions and methods that can be modified
by monkey-patching via, for example, datalad_next.
Since '_set_request_headers' in 'create_sibling_ghlike.py'
might be patched by by datalad_next, it is marked with
the newly introduced 'todo_interface_for_extensions'
decorator.
…-export-datalad-part

Factor out actual data transfer in push
Previously, log messages like this would appear at DEBUG level:

```
[DEBUG] parseParameters: Given "exclude_special_remotes: bool, optional
  if True, don't return annex special remotes", we split into [('exclude_special_remotes', "exclude_special_remotes: bool, optional\n  if True, don't return annex special remotes")]
```

These are very verbose and large in number, making debug
output needlessly complicated to read.

Moreover, they log the outcome of a trivial operation that practically
never fails in production code, at a comparatively high level (DEBUG),
and they did it in an expensive way that actually built the log string
unconditionally of the effective log level.

This change demote the log level to the lowest possible, and uses a proper
logging pattern that avoid needless string operations.
Every invocation produces this INFO-level message:

```
% datalad create myds
[INFO   ] Creating a new annex repo at /tmp/myds
create(ok): /tmp/myds (dataset)
```
This is not a long-running operation. In most cases, the INFO log and the result arrive near-simultaneously.
It also duplicates DEBUG messages:

```
[INFO   ] Creating a new annex repo at /tmp/demo12
[DEBUG  ] Initialize empty Git repository at '/tmp/demo12'
[DEBUG  ] Initializing annex repository at /tmp/demo12...
```

Removed for a cleaner user experience.

Fixes datalad#6633
Demote (to level 1 from DEBUG) and speed-up API doc logging (parseParameters)
Since majority use that form to signal beginning of some action.
Also renamed one Initating into Initializing, and removed "Attempt"
since all of them are
Add released plugin to .autorc to annotate PRs on when released
Remove unsupported parameter create_sibling_ria(existing=None)
Remove two too prominent create() INFO log message that duplicate DEBUG log and harmonize some other log messages
OPT: AnnexJsonProtocol - avoid dragging possibly long data around
Specifically, conflicts of branch name with with branch content.

Fixes datalad#6650
Fix `GitRepo.get_branch_commits_()` to handle branch names conflicts with paths
@yarikoptic
Copy link
Member Author

not sure why travis and github actions didn't trigger :-/ Anyways -- now that #6273 is merged, conflicts came up -- redoing the merge

@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #6677 (9cec945) into master (5fb9bb5) will increase coverage by 1.15%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #6677      +/-   ##
==========================================
+ Coverage   88.85%   90.00%   +1.15%     
==========================================
  Files         353      353              
  Lines       45652    45672      +20     
==========================================
+ Hits        40562    41107     +545     
+ Misses       5090     4565     -525     
Impacted Files Coverage Δ
datalad/core/local/create.py 98.58% <ø> (-0.72%) ⬇️
datalad/dataset/gitrepo.py 96.75% <ø> (ø)
datalad/distributed/create_sibling_ria.py 79.67% <ø> (ø)
datalad/support/annexrepo.py 91.02% <ø> (-0.17%) ⬇️
datalad/conftest.py 86.91% <100.00%> (-2.71%) ⬇️
datalad/core/distributed/clone.py 91.20% <100.00%> (ø)
datalad/core/distributed/push.py 92.54% <100.00%> (+0.08%) ⬆️
datalad/core/local/status.py 94.15% <100.00%> (ø)
datalad/customremotes/base.py 94.11% <100.00%> (ø)
datalad/distributed/create_sibling_ghlike.py 64.64% <100.00%> (+0.19%) ⬆️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fb9bb5...9cec945. Read the comment docs.

@yarikoptic
Copy link
Member Author

I have force pushed a newer merge, after migration to pytest. There is an oddity though which is not present in master -- pytest stalls on exit for our http server (shouldn't even run for this test):

(git)lena:~datalad/datalad-master[merge-maint]__testhome__
$> python -m pytest  -c ../tox.ini -s -v --pyargs ../datalad/tests/test_utils.py::test_is_interactive     
================================================================================================ test session starts ================================================================================================
platform linux -- Python 3.9.12, pytest-7.1.2, pluggy-1.0.0 -- /home/yoh/proj/datalad/datalad-master/venvs/dev3/bin/python
cachedir: .pytest_cache
rootdir: /home/yoh/proj/datalad/datalad-master, configfile: tox.ini
plugins: cov-3.0.0, fail-slow-0.2.0
collected 1 item                                                                                                                                                                                                    

../datalad/tests/test_utils.py::test_is_interactive XPASS (TODO: for some reason fails on Travis)
../datalad/tests/test_utils.py::test_is_interactive XFAIL (TODO: for some reason fails on Travis)

=========================================================================================== 1 xfailed, 1 xpassed in 1.03s ===========================================================================================
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/popen_fork.py", line 27, in poll
    pid, sts = os.waitpid(self.pid, flag)
Process Process-1:
KeyboardInterrupt
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yoh/proj/datalad/datalad-master/datalad/tests/utils_pytest.py", line 727, in _multiproc_serve_path_via_http
    httpd.serve_forever()
  File "/usr/lib/python3.9/socketserver.py", line 232, in serve_forever
    ready = selector.select(poll_interval)
  File "/usr/lib/python3.9/selectors.py", line 416, in select
    fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt

also note -- it looks like it did it twice -- one XPASS and one XFAIL . @jwodder -- any clue why it might do that?

here is how looks on master -- oddity that WTF is printed in the same line, not on a new one but that is the end of oddities since it runs/exits fine
(git)lena:~datalad/datalad-master[master]__testhome__
$> python -m pytest -c ../tox.ini -s -v --pyargs ../datalad/tests/test_utils.py::test_is_interactive
================================================================================================ test session starts ================================================================================================
platform linux -- Python 3.9.12, pytest-7.1.2, pluggy-1.0.0 -- /home/yoh/proj/datalad/datalad-master/venvs/dev3/bin/python
cachedir: .pytest_cache
rootdir: /home/yoh/proj/datalad/datalad-master, configfile: tox.ini
plugins: cov-3.0.0, fail-slow-0.2.0
collected 1 item                                                                                                                                                                                                    

../datalad/tests/test_utils.py::test_is_interactive XPASS (TODO: for some reason fails on Travis)Versions: annexremote=1.5.0 boto=2.49.0 cmd:7z=16.02 cmd:annex=8.20211123 cmd:bundled-git=UNKNOWN cmd:git=2.35.1 cmd:system-git=2.35.1 cmd:system-ssh=9.0p1 exifread=2.3.2 humanize=3.14.0 iso8601=1.0.2 keyring=23.5.0 keyrings.alt=UNKNOWN msgpack=1.0.3 mutagen=1.45.1 platformdirs=2.5.0 requests=2.27.1
Obscure filename: str=b' |;&%b5{}\'"\xce\x94\xd0\x99\xd7\xa7\xd9\x85\xe0\xb9\x97\xe3\x81\x82 .datc ' repr=' |;&%b5{}\'"ΔЙקم๗あ .datc '
Encodings: default='utf-8' filesystem='utf-8' locale.prefered='UTF-8'
Environment: PATH='/home/yoh/proj/datalad/datalad-master/venvs/dev3/bin:/home/yoh/miniconda/envs/datalad-py3.7/bin:/home/yoh/miniconda/condabin:/home/yoh/gocode/bin:/home/yoh/gocode/bin:/home/yoh/bin:/home/yoh/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/usr/local/sbin' LANG='en_US.UTF-8' GIT_PAGER='less --no-init --quit-if-one-screen' GIT_CONFIG_PARAMETERS="'init.defaultBranch=dl-test-branch' 'clone.defaultRemoteName=dl-test-remote'" GIT_CONFIG_GLOBAL='/home/yoh/.tmp/datalad_temp_kp_6nn25/.gitconfig' GIT_ASKPASS='true'

@yarikoptic
Copy link
Member Author

ok, that one is solved. Due to RF of code in setup/teardown fixtures and mismatch of variables, had to

$> git diff
diff --git a/datalad/conftest.py b/datalad/conftest.py
index bbba606de..5a40f04eb 100644
--- a/datalad/conftest.py
+++ b/datalad/conftest.py
@@ -159,7 +159,7 @@ def setup_package():
         lgr.debug("Printing versioning information collected so far")
         # Query for version of datalad, so it is included in ev.dumps below - useful while
         # testing extensions where version of datalad might differ in the environment.
-        ev['datalad']
+        external_versions['datalad']
         print(external_versions.dumps(query=True))
         try:
             print("Obscure filename: str=%s repr=%r"

which fixes it now (apparently error in fixture can result to such silent stalling upon exit !!!!). will force push adjusted merge with this fix

* origin/maint:
  Link docs of datalad-next
  Fix GitRepo.get_branch_commits_() to handle branch names conflicts
  OPT: AnnexJsonProtocol - avoid dragging possibly long data around
  DOC: harmonize a few log messages to use -ing form for consistency
  Add released plugin to .autorc to annotate PRs on when released
  [skip ci] Update RST changelog
  Update CHANGELOG.md [skip ci]
  Remove too prominent create() INFO log message that duplicates DEBUG log
  Remove unsupported parameter create_sibling_ria(existing=None)
  Demote and speed-up API doc logging
  Fix typo in changelog
  add extension decorator to '_set_request_headers'
  add todo_interface_extensions decorator
  factor out actual data transfer in push
  MNT: Require importlib-metadata >=3.6 for Python < 3.10
  Factor out credential handling of create-sibling-ghlike
  ENH: include version of datalad in tests teardown
  Add a test for drop
  Change a key-value pair in drop result record
  BF: Fix wrong key name of annex' JSON records

 Conflicts:
	datalad/__init__.py
     - due to switch to pytest and setup/teardown be minimalistic shims now,
       and we have no test
     - had to add that invocation of ev['datalad'] to get datalad
       version as well into moved location within datalad/tests/utils.py
       and replicate in datalad/conftest.py (as external_versions not ev)
@yarikoptic
Copy link
Member Author

I don't get it why trravis and gh aren't running... will take it out of draft -- since I am out of ideas. @jwodder - any ideas on that?

@yarikoptic yarikoptic marked this pull request as ready for review May 3, 2022 18:10
@yarikoptic yarikoptic changed the title Merge maint into master Merge maint into master, DO NOT MERGE PR May 3, 2022
@yarikoptic
Copy link
Member Author

eh, I guess CIs aren't running since merge commit has [ci skip] in the message from the merged commits descriptions! ;) appveyor has its own ideas so it doesn't care and runs and showed the need for adding an extra =None for an added/to be merged new test. So the longer we keep maint on nose and master on pytest -- more of similar migrations during merges we would need to do. Pushing that tune up and hope CIs will kick in

@yarikoptic yarikoptic marked this pull request as draft May 3, 2022 21:05
@codeclimate
Copy link

codeclimate bot commented May 3, 2022

Code Climate has analyzed commit 9cec945 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@yarikoptic
Copy link
Member Author

interesting -- it is similarish fail with test__version test picking up some prior tag instead of the logical "latest" 0.16.2

E           AssertionError: String '0.16.1+92.g1ab9602' doesn't start with '0.16.2'

which is very odd since locally I get 0.16.2-146-g9cec945af git describe for the pushed branch, so

  • that 1ab9602 isn't a known commit, so probably some merge one produced by travis
  • but why only +92?
  • master is now 0.16.1-130-g5fb9bb589 since we have not yet merged 0.16.2 into it (this is what this PR is trying to do)

So it is all a bit odd and I don't have an answer to above, but I think that there is no other issue left, so I will progress master forward to this merge now and push directly so master gets fixes from the maint

@yarikoptic yarikoptic merged commit 9cec945 into datalad:master May 4, 2022
@github-actions
Copy link

🚀 PR was released in 0.16.3 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants