-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add custom_forge activity #223
Conversation
Hey @hadim! I am totally in favor of the custom forge idea here. It looks like you just copied a lot of the conda-forge code though. Is there any way you can split some of this out of both activites and maybe get some code reuse? Also maybe it would be good to just have a "forge" activity from which the conda-forge and/or custom forge could be specializations of. |
Do you prefer to have a single "forge" activity where a user can configure conda-forge or custom forge using configuration variables or do you prefer to have two distinct activities as it is now (with as much as possible common code refactored)? |
I prefer a single forge activity, with a subclass that specializes on conda-forge, so that existing rever.xsh files aren't broken. |
Sorry, this is still not clear to me @scopatz :-D We keep the Is that what you mean? |
Sorry for being unclear! Yeah that is exactly what I mean. I think you get it 😉 |
Thanks @scopatz. Will do that in the coming days/weeks. I have a quick question related to rever in general. What is the reason it's based on xonsh? |
There are a couple of reasons:
|
People should feel free to submit new modules and things in Python if that makes sense though too |
This PR now uses xonsh/xonsh#3705 (installed with |
(CI fails because of the xonsh version) |
I think I am confused. Do I actually need to use the xonsh PR or does https://github.com/regro/rever/pull/226/files is sufficient? |
@scopatz could you review please? The
|
I confirm channels:
- conda-forge
dependencies:
- python ==3.7.*
- pip
# rever deps
# - xonsh ==0.9.18
# pip install --no-deps https://github.com/xonsh/xonsh/archive/nothreadrc.zip
- lazyasd
- ruamel.yaml
- github3.py
- uritemplate
- conda-smithy
# dev
- black
- pytest
- pytest-flake8
- pytest-cov
- pytest-timeout
- prompt_toolkit
- codecov
- flake8
- coverage
- bibtexparser
|
CI is fixed. CircleCI is red because of the test failing in I will wait for this to be reviewed. |
Thanks @hadim - this is looking pretty good. Can you please add documentation hooks in the |
I have added the doc and news. I still struggle with the conda-forge test. Here is the full trace. The error is $ pytest -v tests/test_conda_forge_activity.py
/home/hadim/local/conda/envs/rever/lib/python3.7/site-packages/_pytest/compat.py:340: PytestDeprecationWarning: The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.
See https://docs.pytest.org/en/stable/deprecations.html#terminalreporter-writer for more information.
return getattr(object, name, default)
======================================================== test session starts ========================================================
platform linux -- Python 3.7.8, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- /home/hadim/local/conda/envs/rever/bin/python
cachedir: .pytest_cache
rootdir: /home/hadim/Code/Forge/rever, configfile: pytest.ini
plugins: flake8-1.0.6, xonsh-0.9.19, cov-2.10.1, timeout-1.4.2
collected 1 item
tests/test_conda_forge_activity.py::test_conda_forge_activity FAILED [100%]
============================================================= FAILURES ==============================================================
_____________________________________________________ test_conda_forge_activity _____________________________________________________
gitrepo = '/tmp/test_conda_forge_activity', gitecho = None
def test_conda_forge_activity(gitrepo, gitecho):
vcsutils.tag("0.0.1")
env = builtins.__xonsh__.env
recipe_dir = os.path.join(env["REVER_DIR"], "rever-feedstock", "recipe")
meta_yaml = os.path.join(recipe_dir, "meta.yaml")
os.makedirs(recipe_dir, exist_ok=True)
files = [
("rever.xsh", REVER_XSH),
(meta_yaml, ORIG_META_YAML),
("credfile", CREDFILE),
]
for filename, body in files:
with open(filename, "w") as f:
f.write(body)
vcsutils.track(".")
vcsutils.commit("Some versioned files")
> env_main(["0.1.0"])
/home/hadim/Code/Forge/rever/tests/test_conda_forge_activity.py:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/hadim/Code/Forge/rever/rever/main.xsh:246: in env_main
run_activities(ns)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ns = Namespace(activities=None, check=False, docker_base=False, docker_install=False, entrypoint=None, force=False, rc='rever.xsh', setup=False, undo=frozenset(), version='0.1.0')
def run_activities(ns):
"""Actually run activities."""
need, done = compute_activities_to_run(force=ns.force)
for name in done:
if ns.force:
msg = ("{YELLOW}Re-doing activity '" + name + "' which has already been "
"completed!{NO_COLOR}")
else:
msg = ("{GREEN}Activity '" + name + "' has already been "
"completed!{NO_COLOR}")
print_color(msg)
for name in need:
act = $DAG[name]
act.ns = ns
status = act()
if not status:
> sys.exit(1)
E SystemExit: 1
/home/hadim/Code/Forge/rever/rever/main.xsh:149: SystemExit
------------------------------------------------------- Captured stdout setup -------------------------------------------------------
Initialized empty Git repository in /tmp/test_conda_forge_activity/.git/
[master (root-commit) 44dc790] Initial readme
1 file changed, 1 insertion(+)
create mode 100644 README
------------------------------------------------------- Captured stdout call --------------------------------------------------------
Would have run: tag -f 0.0.1
Would have run: add .
Would have run: commit --allow-empty -am Some versioned files
activity-start:conda_forge:starting activity conda_forge
activity-error:conda_forge:activity failed with execption:
Traceback (most recent call last):
File "/home/hadim/Code/Forge/rever/rever/activity.xsh", line 83, in __call__
self.func(*args, **kwargs)
File "/home/hadim/Code/Forge/rever/rever/activities/conda_forge.xsh", line 104, in _func
recipe_dir=None,
File "/home/hadim/Code/Forge/rever/rever/activities/forge.xsh", line 206, in _func
repo = gh.repository(feedstock_org, feedstock_repo_name)
File "/home/hadim/local/conda/envs/rever/lib/python3.7/site-packages/github3/github.py", line 1981, in repository
json = self._json(self._get(url), 200)
File "/home/hadim/local/conda/envs/rever/lib/python3.7/site-packages/github3/models.py", line 156, in _json
raise exceptions.error_for(response)
github3.exceptions.AuthenticationFailed: 401 Bad credentials
rewinding to Would have run: rev-parse HEAD
------------------------------------------------------- Captured stderr call --------------------------------------------------------
/home/hadim/local/conda/envs/rever/lib/python3.7/site-packages/github3/session.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import Callable
/home/hadim/local/conda/envs/rever/lib/python3.7/site-packages/github3/structs.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
class GitHubIterator(models.GitHubCore, collections.Iterator):
====================================================== short test summary info ======================================================
FAILED tests/test_conda_forge_activity.py::test_conda_forge_activity - SystemExit: 1
========================================================= 1 failed in 0.78s ========================================================= |
I think I fixed the bug! Ready for another review @scopatz! |
This looks great, thanks |
Besides the unit tests, I haven't manually tested the conda forge activity. I would suggest you do it before releasing a new version. |
Yeah, releasing rever will test that? |
Ahaha good one :-D |
Tried it on xonsh, seems like it works conda-forge/xonsh-feedstock#149 |
Because of #217 (comment), this PR is against0.4.3
.A new activity called
custom_forge
is added to allow people to update a feedstock from a custom and/or private conda-forge.I have created a new activity instead of patching the existing
conda_forge
one because:I needed to be able to push directly in the
master
branch of theupstream
feedstock.Our forge uses
git_url
instead ofurl
so we don't need to hash an URL.I am also fine merging this activity with the
conda_forge
one if you prefer.Here are the default settings of the activity (different from `conda_forge):