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

Add findns: directive to config #1420

Closed
wants to merge 10 commits into from

Conversation

@silkentrance
Copy link
Contributor

@silkentrance silkentrance commented Jul 11, 2018

Summary of changes

  • extend documentation on new findns: directive
  • realize new findns: directive

Closes #1419

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details
@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

@pganssle Have a look and tell me if that is the right direction. I so, I will continue with implementing required tests.

@pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

Is there a reason it can't be find_namespace? I'm even dubious about the find_packages_ns name, since it seems too obscure to me, I'd rather it be find_namespace_packages or something.

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

@pganssle can we handle this in a different issue/PR?

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

As for the directive, sure, this I can rename right now.

@silkentrance silkentrance force-pushed the coldrye-collaboration:gh-1419 branch 2 times, most recently from 42c3da2 to 81ae059 Jul 11, 2018
@silkentrance silkentrance force-pushed the coldrye-collaboration:gh-1419 branch from 81ae059 to 8eeca1e Jul 11, 2018
@pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

The find_packages_ns stuff is indeed a completely different discussion so don't worry about that.

@pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

This seems like it will work, but the implementation might be a bit cleaner if you do this:

directive = value.split(':', 1)[0]
if directive not in {'find', 'find_namespace'}:
    ...
@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

@pganssle good point, but this will be a different commit
but still I have to find out whether it is find_namespace... will think about that

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

@pganssle note that with the latest commit I refrained from using string.split() and instead used value.strip(). and maybe even this op is redundant as the parser might have normalized the value already, but we can never know...

Copy link
Contributor

@agronholm agronholm left a comment

Minor things

@@ -2389,8 +2389,8 @@ Metadata and options are set in the config sections of the same name.
* In some cases, complex values can be provided in dedicated subsections for
clarity.

* Some keys allow ``file:``, ``attr:``, and ``find:`` directives in order to
cover common usecases.
* Some keys allow ``file:``, ``attr:``, and ``find:`` and ``find_namespace:`` directives i

This comment has been minimized.

@agronholm

agronholm Jul 11, 2018
Contributor

Typo at the end?

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

will look into this

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

done

if not value.startswith(find_directive):
return self._parse_list(value)
if not trimmed_value in find_directives:
return self._parse_list(value)

This comment has been minimized.

@agronholm

agronholm Jul 11, 2018
Contributor

Bad indentation

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

oops nice find

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

and there was even more where this came from...

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

done


return find_packages(**find_kwargs)

def parse_section_packages__find(self, section_options):
"""Parses `packages.find` configuration file section.
"""Parses `packages.find[ns]` configuration file section.

This comment has been minimized.

@agronholm

agronholm Jul 11, 2018
Contributor

Does this really use a packages.findns section? The tests do not.

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

nice find, fixing right now

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

done

' fake_package.sub_one\n'
)
with get_dist(tmpdir) as dist:
assert set(dist.packages) == set(

This comment has been minimized.

@agronholm

agronholm Jul 11, 2018
Contributor

You can use a set literal here. Python 2.6 support was dropped in v37.

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

will do

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

The other tests also use the non set literal, should I proceed?

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

done

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

If you comply to the changes, I will proceed with fixing #1421 based upon these changes.


py2_only = pytest.mark.xfail(not PY2, reason="Test runs on Python 2 only")

This comment has been minimized.

@pganssle

pganssle Jul 11, 2018
Member

I think these should be pytest.mark.skip, not xfail.

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

will have to fix the tests for find_packages_ns as well. you would want to fix the other tests that use that pattern.

This comment has been minimized.

@agronholm

agronholm Jul 11, 2018
Contributor

I concur.

This comment has been minimized.

@silkentrance

silkentrance Jul 11, 2018
Author Contributor

six.PY2 seems to fail when marking tests for specific versions

SKIP [1] setuptools/tests/test_config.py:604: Test runs on Python 2 only

This comment has been minimized.

@pganssle

pganssle Jul 11, 2018
Member

I think that's indicating that the test was skipped. When you mark something xfail, it actually runs the test and ignores the result if it fails (or if you make it a strict xfail, actually fails the test suite if the test passes). skip doesn't run the test at all, so I believe that message is expected.

You are right that we should be switching many xfails over to skip. I was planning on doing that at some point, but it takes time to figure out which ones are intended as an actual xfail (which generally means "this should work but it's a known bug - when this test starts passing drop this decorator") and which are just using the wrong decorator for skip.

Copy link
Contributor

@agronholm agronholm left a comment

Looks alright now!

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 11, 2018

currently working on py2_only/py3_only for test_config. It does not seem to work as expected, reporting false results.

tomorrow will be a new day...

@pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

@silkentrance That's my mistake, the correct mark is skipif, skip skips unconditionally (though I'm not sure why it accepts a random argument).

@pganssle
Copy link
Member

@pganssle pganssle commented Jul 11, 2018

I pushed an updated version with the proper decorator to your branch.

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 12, 2018

@pganssle thanks. I did find out about skipif in the morning, too. Yesterday I was way too tired...

@silkentrance
Copy link
Contributor Author

@silkentrance silkentrance commented Jul 12, 2018

I have refactored out the markers for py2/py3 into tests/init.py since they had been redeclared. Other test modules can be refactored, too, but I leave it at that for the time being.

@silkentrance silkentrance force-pushed the coldrye-collaboration:gh-1419 branch from 6deb251 to 3c30cf3 Jul 12, 2018
silkentrance added a commit to coldrye-collaboration/setuptools that referenced this pull request Jul 12, 2018
silkentrance added a commit to coldrye-collaboration/setuptools that referenced this pull request Jul 14, 2018
silkentrance added a commit to coldrye-collaboration/setuptools that referenced this pull request Jul 18, 2018
pganssle added a commit to coldrye-collaboration/setuptools that referenced this pull request Aug 11, 2018
pganssle added a commit to coldrye-collaboration/setuptools that referenced this pull request Aug 11, 2018
@silkentrance silkentrance deleted the coldrye-collaboration:gh-1419 branch Aug 14, 2018
silkentrance added a commit to coldrye-collaboration/setuptools that referenced this pull request Aug 14, 2018
silkentrance added a commit to coldrye-collaboration/setuptools that referenced this pull request Aug 14, 2018
pganssle added a commit that referenced this pull request Aug 17, 2018
* fix #1419 PEP420: add find_namespace: directive

* fix #1419 PEP420: add find_namespace: directive to documentation

* fix #1419 PEP420: add tests

* fix #1419 PEP420: clean up code

* fix #1419 PEP420: fix typo in documentation

* fix #1419 PEP420: fix typo in documentation

* fix #1419 PEP420: clean up code

* fix #1419 PEP420: add changelog entry

* fixup! fix #1419 PEP420: add tests

* fix #1419 PEP420: cleanup code refactor markers

* #1420: Rename find_namespace_ns to find_namespace_packages

*  #1420: update changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants