Skip to content

Use the pkgutil-style namespace techniques#22

Merged
jaraco merged 1 commit intomasterfrom
georgehartzell/pkgutil-style
Jan 23, 2019
Merged

Use the pkgutil-style namespace techniques#22
jaraco merged 1 commit intomasterfrom
georgehartzell/pkgutil-style

Conversation

@jaraco
Copy link
Copy Markdown
Owner

@jaraco jaraco commented Jan 23, 2019

This PR is a resubmit of PR 2 from the original repo by George Hartzell.

This commit converts the `configparser` package to use the
*pkgutil-style* namespace techniques.

It simply applies the changes from [the nixpkgs project][nix-fix], which
I found in [configparser issue 17][17].

There is more than one way to create a namespace in Python, [details
here][namespaces].

The important detail is that one can not mix *pkgutil-style* and
*pkg_resources-style* packages.

The `backports` package established the *backports* namespace as
`pkgutil-style` ([details here][backports]) and other backports
packages have followed its lead.

`configparser` using the *pkg_resource-style* has caused many
problems, see e.g. [configparser issue #17][17].

After applying the changes from the [nixpkgs project][nix-fix] I
updated the `tox.ini` file to use `py27,py36` (the only version I have
access to) and I believe that the tests passed (I'm not to `tox`).

```
(alice)[17:30:47]configparser>>tox
GLOB sdist-make: /Users/hartzell/tmp/configparser/setup.py
py27 create: /Users/hartzell/tmp/configparser/.tox/py27
py27 inst: /Users/hartzell/tmp/configparser/.tox/dist/configparser-3.6.0.zip
py27 installed: configparser==3.6.0
py27 runtests: PYTHONHASHSEED='2393890676'
py27 runtests: commands[0] | /Users/hartzell/tmp/configparser/.tox/py27/bin/python test_configparser.py
.................................................................................................................................................s.................................................................................................................s............................................../Users/hartzell/tmp/configparser/src/backports/configparser/__init__.py:988: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if key == self.default_section:
........
----------------------------------------------------------------------
Ran 314 tests in 0.460s

OK (skipped=2)
py27 runtests: commands[1] | /Users/hartzell/tmp/configparser/.tox/py27/bin/python test_helpers.py
py36 create: /Users/hartzell/tmp/configparser/.tox/py36
py36 inst: /Users/hartzell/tmp/configparser/.tox/dist/configparser-3.6.0.zip
py36 installed: configparser==3.6.0
py36 runtests: PYTHONHASHSEED='2393890676'
py36 runtests: commands[0] | /Users/hartzell/tmp/configparser/.tox/py36/bin/python test_configparser.py
.................................................................................................................................................s.................................................................................................................s...........................................ssss.......
----------------------------------------------------------------------
Ran 314 tests in 0.378s
  1 # example user config (see 'hg help config' for more info)

  1 Use pkgutil-style namespaces
OK (skipped=6)
py36 runtests: commands[1] | /Users/hartzell/tmp/configparser/.tox/py36/bin/python test_helpers.py
____________________________________________________ summary _____________________________________________________
  py27: commands succeeded
  1 Use pkgutil-style namespaces
  py36: commands succeeded
  congratulations :)
(alice)[17:31:05]configparser>>
```

[backports]: https://pypi.org/project/backports/
[namespaces]: https://packaging.python.org/guides/packaging-namespace-packages/
[nix-fix]: https://github.com/FRidh/nixpkgs/blob/master/pkgs/development/python-modules/configparser/0001-namespace-fix.patch
[17]: https://bitbucket.org/ambv/configparser/issues/17/importerror-when-used-with-other-backports

--HG--
branch : pkgutil-style
@hartzell
Copy link
Copy Markdown
Contributor

Wonderful!

What is the relationship of this repository to the bitbucket repository of @Łukasz Langa?

@hartzell
Copy link
Copy Markdown
Contributor

Ah, just dug around on bitbucket a bit, and it looks like you're the new package owner and have migrated the offici{al,ous} repository here. Great.

What are your release plans?

@jaraco jaraco deleted the georgehartzell/pkgutil-style branch January 24, 2019 01:11
hartzell pushed a commit to hartzell/spack that referenced this pull request Jan 24, 2019
This release includes a fix to clean up how configparser used namespaces.

I can now install `py-flake8`, load the resulting `py-flake8` module,
and have a working `flake8` command (this was the failure case in

Chain of details starts here:
jaraco/configparser#22

Closes spack#8343, spack#7370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants