Repository: pypa/sample-namespace-packages
Branch: master
Commit: 134414420e5f
Files: 35
Total size: 51.8 KB
Directory structure:
gitextract_kazeylgz/
├── .github/
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .python-versions-used
├── LICENSE
├── README.md
├── constraints.txt
├── legacy_table.md
├── native/
│ ├── pkg_a/
│ │ ├── example_pkg/
│ │ │ └── a/
│ │ │ └── __init__.py
│ │ ├── pyproject.toml
│ │ └── setup.py
│ └── pkg_b/
│ ├── example_pkg/
│ │ └── b/
│ │ └── __init__.py
│ ├── pyproject.toml
│ └── setup.py
├── noxfile.py
├── pkg_resources/
│ ├── pkg_a/
│ │ ├── example_pkg/
│ │ │ ├── __init__.py
│ │ │ └── a/
│ │ │ └── __init__.py
│ │ ├── pyproject.toml
│ │ └── setup.py
│ └── pkg_b/
│ ├── example_pkg/
│ │ ├── __init__.py
│ │ └── b/
│ │ └── __init__.py
│ ├── pyproject.toml
│ └── setup.py
├── pkgutil/
│ ├── README.md
│ ├── pkg_a/
│ │ ├── example_pkg/
│ │ │ ├── __init__.py
│ │ │ └── a/
│ │ │ └── __init__.py
│ │ ├── pyproject.toml
│ │ └── setup.py
│ └── pkg_b/
│ ├── example_pkg/
│ │ ├── __init__.py
│ │ └── b/
│ │ └── __init__.py
│ ├── pyproject.toml
│ └── setup.py
├── report_to_table.py
├── requirements.txt
├── table.md
└── verify_packages.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches: ["master", "src-layout"]
pull_request:
branches: ["master", "src-layout"]
schedule:
- cron: "0 12 1 * *"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
generate-compatibility-matrix:
name: >-
Check for any uncommitted
table alteration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Determine Python versions
run: |
{
echo 'PYTHON_VERSIONS<<EOF'
cat '.python-versions-used'
echo 'EOF'
} >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSIONS }}
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Generate compatibility matrix with nox
continue-on-error: true
run: |
python -m nox --report report.json
- name: Verify table has not been altered
run: |
set -xeEuo pipefail
cat report.json
python report_to_table.py
echo 'DIFF_FOR_TABLE<<EOF' >> "${GITHUB_OUTPUT}"
git diff table.md | tee -a "${GITHUB_OUTPUT}"
echo 'EOF' >> "${GITHUB_OUTPUT}"
id: verify-table
- name: Fail the job if the committed table differs from the calculated one
if: steps.verify-table.outputs.DIFF_FOR_TABLE != ''
run: |
echo "::error file=table.md::Table has been altered but not committed!"
exit 1
================================================
FILE: .gitignore
================================================
dist
build
__pycache__
*.pyc
*.egg-info
.nox
report.json
================================================
FILE: .python-versions-used
================================================
3.8
3.10
3.12
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# Python Namespace Package Examples
This repository contains samples for the various ways to create namespace
packages in Python. For more details, see the
[documentation on namespace packages](https://packaging.python.org/namespace_packages/)
## Testing
This repo also contains testing tools to exercise installation scenarios for
namespace packages.
To run the scenarios:
```
$ pip install -r requirements.txt
$ nox --report report.json
```
`nox` will execute all of the scenarios and report whether the namespace
packages are able to be imported successfully after installation. You can
use `python report_to_table.py` to transform the report into a
markdown-friendly table.
# Current status
To see the status since the last time the scenarios were run open [table.md](table.md)[^1].
Please note:
* Mixing package types within a single namespace is not supported. While it may work in some cases, it may also break depending on the software versions used, the install commands issued, or the order of commands. It is generally advisable not to mix types.
* The `pkg_resources` method of namspacing is [deprecated](https://setuptools.pypa.io/en/latest/pkg_resources.html).
Whenever possible, developers are encouraged to migrate away from it.
* [PEP 420](https://www.python.org/dev/peps/pep-0420/) was accepted as part of Python 3.3. For wider compatibility (going back to Python 2.3), use the `pkgutil` method.
* Zipped eggs don't play nicely with namespace packaging, and may be implicitly installed by commands like `python setup.py install`. To prevent this, it is recommended that you set [`zip_safe=False`](http://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag) in `setup.py`, as we do here. Please also note that distributing packages via egg files is considered deprecated.
* The tests reported in [table.md](table.md) use `pip` with *build isolation* and build-backend APIs.
This is triggered by the presence of a `pyproject.toml` file in each package source directory.
If your package does not have a `pyproject.toml` file,
`pip` might select a legacy (and deprecated) installation procedure, which can behave differently.
# Remarks on staggered migrations
It is difficult migrate away from deprecated `pkg_resources` namepaces in large projects.
Ideally, all packages sharing a namespace should coordinate and simultaneously drop `__init__.py` files to conform with PEP 420.
However, developers might be interested in carrying out a *staggered migration* plan and temporarily mix different namespacing techniques
to mitigate the migration effort and spread the work load in time.
Based on the results for the scenarios mixing `pkg_resources` and other namespace methods reported in
[table.md](table.md) and [legacy_table.md](legacy_table.md),
we can see that (in principle) a staggered migration plan can be successful,
as long as the developers are willing to accept some limitations:
- Deprecated installation methods will not be supported (e.g. `python setup.py install`),
- Editable installations will not be supported.
Please note, however, that these are preliminary studies.
Developers should carry out an independent investigation, and check for the
specific use cases they are interested in supporting.
[^1]: If you would like to know about deprecated installation methods (e.g. via
`python setup.py install`) or Python 2.7, please have a look at [legacy_table.md](legacy_table.md).
================================================
FILE: constraints.txt
================================================
setuptools >= 68.2.2
wheel >= 0.42.0
================================================
FILE: legacy_table.md
================================================
| Type | Interpreter | Package A command | Package B command | Status |
| --- | --- | --- | --- | --- |
| pkgutil | python2.7 | pip install . | pip install . | ✅ |
| pkgutil | python2.7 | pip install . | pip install -e . | ✅ |
| pkgutil | python2.7 | pip install . | python setup.py install | ✅ |
| pkgutil | python2.7 | pip install . | python setup.py develop | ✅ |
| pkgutil | python2.7 | pip install -e . | pip install . | ✅ |
| pkgutil | python2.7 | pip install -e . | pip install -e . | ✅ |
| pkgutil | python2.7 | pip install -e . | python setup.py install | ✅ |
| pkgutil | python2.7 | pip install -e . | python setup.py develop | ✅ |
| pkgutil | python2.7 | python setup.py install | pip install . | ✅ |
| pkgutil | python2.7 | python setup.py install | pip install -e . | ✅ |
| pkgutil | python2.7 | python setup.py install | python setup.py install | ✅ |
| pkgutil | python2.7 | python setup.py install | python setup.py develop | ✅ |
| pkgutil | python2.7 | python setup.py develop | pip install . | ✅ |
| pkgutil | python2.7 | python setup.py develop | pip install -e . | ✅ |
| pkgutil | python2.7 | python setup.py develop | python setup.py install | ✅ |
| pkgutil | python2.7 | python setup.py develop | python setup.py develop | ✅ |
| pkgutil | python3.7 | pip install . | pip install . | ✅ |
| pkgutil | python3.7 | pip install . | pip install -e . | ✅ |
| pkgutil | python3.7 | pip install . | python setup.py install | ✅ |
| pkgutil | python3.7 | pip install . | python setup.py develop | ✅ |
| pkgutil | python3.7 | pip install -e . | pip install . | ✅ |
| pkgutil | python3.7 | pip install -e . | pip install -e . | ✅ |
| pkgutil | python3.7 | pip install -e . | python setup.py install | ✅ |
| pkgutil | python3.7 | pip install -e . | python setup.py develop | ✅ |
| pkgutil | python3.7 | python setup.py install | pip install . | ✅ |
| pkgutil | python3.7 | python setup.py install | pip install -e . | ✅ |
| pkgutil | python3.7 | python setup.py install | python setup.py install | ✅ |
| pkgutil | python3.7 | python setup.py install | python setup.py develop | ✅ |
| pkgutil | python3.7 | python setup.py develop | pip install . | ✅ |
| pkgutil | python3.7 | python setup.py develop | pip install -e . | ✅ |
| pkgutil | python3.7 | python setup.py develop | python setup.py install | ✅ |
| pkgutil | python3.7 | python setup.py develop | python setup.py develop | ✅ |
| pkg_resources | python2.7 | pip install . | pip install . | ✅ |
| pkg_resources | python2.7 | pip install . | pip install -e . | ✅ |
| pkg_resources | python2.7 | pip install . | python setup.py install | ❌ |
| pkg_resources | python2.7 | pip install . | python setup.py develop | ✅ |
| pkg_resources | python2.7 | pip install -e . | pip install . | ✅ |
| pkg_resources | python2.7 | pip install -e . | pip install -e . | ✅ |
| pkg_resources | python2.7 | pip install -e . | python setup.py install | ❌ |
| pkg_resources | python2.7 | pip install -e . | python setup.py develop | ✅ |
| pkg_resources | python2.7 | python setup.py install | pip install . | ❌ |
| pkg_resources | python2.7 | python setup.py install | pip install -e . | ❌ |
| pkg_resources | python2.7 | python setup.py install | python setup.py install | ✅ |
| pkg_resources | python2.7 | python setup.py install | python setup.py develop | ❌ |
| pkg_resources | python2.7 | python setup.py develop | pip install . | ✅ |
| pkg_resources | python2.7 | python setup.py develop | pip install -e . | ✅ |
| pkg_resources | python2.7 | python setup.py develop | python setup.py install | ❌ |
| pkg_resources | python2.7 | python setup.py develop | python setup.py develop | ✅ |
| pkg_resources | python3.7 | pip install . | pip install . | ✅ |
| pkg_resources | python3.7 | pip install . | pip install -e . | ✅ |
| pkg_resources | python3.7 | pip install . | python setup.py install | ❌ |
| pkg_resources | python3.7 | pip install . | python setup.py develop | ✅ |
| pkg_resources | python3.7 | pip install -e . | pip install . | ✅ |
| pkg_resources | python3.7 | pip install -e . | pip install -e . | ✅ |
| pkg_resources | python3.7 | pip install -e . | python setup.py install | ❌ |
| pkg_resources | python3.7 | pip install -e . | python setup.py develop | ✅ |
| pkg_resources | python3.7 | python setup.py install | pip install . | ❌ |
| pkg_resources | python3.7 | python setup.py install | pip install -e . | ❌ |
| pkg_resources | python3.7 | python setup.py install | python setup.py install | ✅ |
| pkg_resources | python3.7 | python setup.py install | python setup.py develop | ❌ |
| pkg_resources | python3.7 | python setup.py develop | pip install . | ✅ |
| pkg_resources | python3.7 | python setup.py develop | pip install -e . | ✅ |
| pkg_resources | python3.7 | python setup.py develop | python setup.py install | ❌ |
| pkg_resources | python3.7 | python setup.py develop | python setup.py develop | ✅ |
| pep420 | python2.7 | pip install . | pip install . | ❌ |
| pep420 | python2.7 | pip install . | pip install -e . | ❌ |
| pep420 | python2.7 | pip install . | python setup.py install | ❌ |
| pep420 | python2.7 | pip install . | python setup.py develop | ❌ |
| pep420 | python2.7 | pip install -e . | pip install . | ❌ |
| pep420 | python2.7 | pip install -e . | pip install -e . | ❌ |
| pep420 | python2.7 | pip install -e . | python setup.py install | ❌ |
| pep420 | python2.7 | pip install -e . | python setup.py develop | ❌ |
| pep420 | python2.7 | python setup.py install | pip install . | ❌ |
| pep420 | python2.7 | python setup.py install | pip install -e . | ❌ |
| pep420 | python2.7 | python setup.py install | python setup.py install | ❌ |
| pep420 | python2.7 | python setup.py install | python setup.py develop | ❌ |
| pep420 | python2.7 | python setup.py develop | pip install . | ❌ |
| pep420 | python2.7 | python setup.py develop | pip install -e . | ❌ |
| pep420 | python2.7 | python setup.py develop | python setup.py install | ❌ |
| pep420 | python2.7 | python setup.py develop | python setup.py develop | ❌ |
| pep420 | python3.7 | pip install . | pip install . | ✅ |
| pep420 | python3.7 | pip install . | pip install -e . | ✅ |
| pep420 | python3.7 | pip install . | python setup.py install | ✅ |
| pep420 | python3.7 | pip install . | python setup.py develop | ✅ |
| pep420 | python3.7 | pip install -e . | pip install . | ✅ |
| pep420 | python3.7 | pip install -e . | pip install -e . | ✅ |
| pep420 | python3.7 | pip install -e . | python setup.py install | ✅ |
| pep420 | python3.7 | pip install -e . | python setup.py develop | ✅ |
| pep420 | python3.7 | python setup.py install | pip install . | ✅ |
| pep420 | python3.7 | python setup.py install | pip install -e . | ✅ |
| pep420 | python3.7 | python setup.py install | python setup.py install | ✅ |
| pep420 | python3.7 | python setup.py install | python setup.py develop | ✅ |
| pep420 | python3.7 | python setup.py develop | pip install . | ✅ |
| pep420 | python3.7 | python setup.py develop | pip install -e . | ✅ |
| pep420 | python3.7 | python setup.py develop | python setup.py install | ✅ |
| pep420 | python3.7 | python setup.py develop | python setup.py develop | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | pip install . | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install . | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install . | python setup.py develop | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install -e . | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install -e . | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | pip install -e . | python setup.py develop | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py install | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py install | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py install | python setup.py install | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py install | python setup.py develop | ✅ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py develop | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py develop | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py develop | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python2.7 | python setup.py develop | python setup.py develop | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python3.7 | pip install . | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install . | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install . | python setup.py develop | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install -e . | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install -e . | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | pip install -e . | python setup.py develop | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py install | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py install | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py install | python setup.py install | ✅ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py install | python setup.py develop | ✅ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py develop | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py develop | pip install -e . | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py develop | python setup.py install | ❌ |
| cross_pkg_resources_pkgutil | python3.7 | python setup.py develop | python setup.py develop | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install . | pip install . | ✅ |
| cross_pep420_pkgutil | python2.7 | pip install . | pip install -e . | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install . | python setup.py install | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install . | python setup.py develop | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install -e . | pip install . | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install -e . | pip install -e . | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install -e . | python setup.py install | ❌ |
| cross_pep420_pkgutil | python2.7 | pip install -e . | python setup.py develop | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py install | pip install . | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py install | pip install -e . | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py install | python setup.py install | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py install | python setup.py develop | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py develop | pip install . | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py develop | pip install -e . | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py develop | python setup.py install | ❌ |
| cross_pep420_pkgutil | python2.7 | python setup.py develop | python setup.py develop | ❌ |
| cross_pep420_pkgutil | python3.7 | pip install . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install . | python setup.py install | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install . | python setup.py develop | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install -e . | python setup.py install | ✅ |
| cross_pep420_pkgutil | python3.7 | pip install -e . | python setup.py develop | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py install | pip install . | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py install | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py install | python setup.py install | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py install | python setup.py develop | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py develop | pip install . | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py develop | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py develop | python setup.py install | ✅ |
| cross_pep420_pkgutil | python3.7 | python setup.py develop | python setup.py develop | ✅ |
================================================
FILE: native/pkg_a/example_pkg/a/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'a'
================================================
FILE: native/pkg_a/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: native/pkg_a/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup
setup(
name='example_pkg_a',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=['example_pkg.a'],
zip_safe=False,
)
================================================
FILE: native/pkg_b/example_pkg/b/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'b'
================================================
FILE: native/pkg_b/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: native/pkg_b/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup
setup(
name='example_pkg_b',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=['example_pkg.b'],
zip_safe=False,
)
================================================
FILE: noxfile.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import nox
HERE = os.path.abspath(os.path.dirname(__file__))
# -- REQUIRES: nox >= 2023.04.22
# SEE: https://nox.thea.codes/en/stable/index.html
USE_PYTHON_VERSIONS = os.environ.get("NOXFILE_PYTHON_VERSIONS", "").split()
if not USE_PYTHON_VERSIONS:
with open(os.path.join(HERE, ".python-versions-used"), "r") as file:
USE_PYTHON_VERSIONS = [x.strip() for x in file]
install_commands = (("pip", "install", "."), ("pip", "install", "-e", "."))
def install_packages(session, package_a, package_b, command_a, command_b):
env = {**os.environ, "PIP_CONSTRAINT": f"{HERE}/constraints.txt"}
session.install("--upgrade", "pip", env=env)
session.chdir(package_a)
session.run("rm", "-rf", "dist", "build", "*.egg-info")
session.run(*command_a, env=env)
session.chdir(HERE)
session.chdir(package_b)
session.run("rm", "-rf", "dist", "build", "*.egg-info")
session.run(*command_b, env=env)
session.chdir(HERE)
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pkgutil(session, command_a, command_b):
install_packages(session, "pkgutil/pkg_a", "pkgutil/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pkg_resources(session, command_a, command_b):
install_packages(
session, "pkg_resources/pkg_a", "pkg_resources/pkg_b", command_a, command_b
)
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pep420(session, command_a, command_b):
install_packages(session, "native/pkg_a", "native/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_cross_pkg_resources_pkgutil(session, command_a, command_b):
install_packages(
session, "pkg_resources/pkg_a", "pkgutil/pkg_b", command_a, command_b
)
session.run("python", "-m", "pip", "list")
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_cross_pep420_pkgutil(session, command_a, command_b):
install_packages(session, "native/pkg_a", "pkgutil/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pep420_pkg_resources(session, command_a, command_b):
install_packages(
session, 'native/pkg_a', 'pkg_resources/pkg_b', command_a, command_b
)
session.run("python", "verify_packages.py")
@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pkg_resources_pep420(session, command_a, command_b):
install_packages(
session, 'pkg_resources/pkg_a', 'native/pkg_b', command_a, command_b
)
session.run("python", "verify_packages.py")
================================================
FILE: pkg_resources/pkg_a/example_pkg/__init__.py
================================================
__import__('pkg_resources').declare_namespace(__name__)
================================================
FILE: pkg_resources/pkg_a/example_pkg/a/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'a'
================================================
FILE: pkg_resources/pkg_a/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: pkg_resources/pkg_a/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(
name='example_pkg_a',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=find_packages(),
namespace_packages=['example_pkg'],
zip_safe=False,
)
================================================
FILE: pkg_resources/pkg_b/example_pkg/__init__.py
================================================
__import__('pkg_resources').declare_namespace(__name__)
================================================
FILE: pkg_resources/pkg_b/example_pkg/b/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'b'
================================================
FILE: pkg_resources/pkg_b/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: pkg_resources/pkg_b/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(
name='example_pkg_b',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=find_packages(),
namespace_packages=['example_pkg'],
zip_safe=False,
)
================================================
FILE: pkgutil/README.md
================================================
# [pkgutil-style namespace packages](https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages)
The following examples demonstrates the usage / installation of `pkgutil` style namespace packages.
```
pkgutil/
├ pkg_a/ # the name of this dir doesn't matter
│ ├ setup.py
│ └ example_pkg/ # namespace package name
│ ├__init__.py # special pkgutil namespace __init__.py
│ └ a/ # dir name must match the package name from `setup.py`
│ └ __init__.py
│ ├ module1.py
.
.
.
└ pkg_b/
```
The anatomy of a namespace package name is `<namespaceA>.<package_name>`.
Namespaces can also be nested an take the form `<namespaceA>.<namespace_N>.<package_name>`.
This subdirectory contains two packages (`"a"` & `"b"`) that share the namespace `example_pkg`.
When installed these packages will have the names `example_pkg.a` & `example_pkg.b` respectively.
### Detailed Requirements
The directories `pkg_a` and `pkg_b` in this subdirectory contain two different python packages.
The names of these directories have no effect on the installed package.
Each of these directories should at least contain:
1. A configuration file, in this case `setup.py`.
2. A directory, whose name determines the namespace name.
In this example `example_pkg` is the name of the namespace. This directory should contain:
1. The `__init__.py` file for the namespace package, which must contain only the following:
```python
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
```
Nested namespaces must contain an identical `__init__.py`.
2. A directory, whose name determines the `package_name`. This directory holds the package's source code.
- The directory name, must match the name given in the `setup.py`.
### Practical Usage
When using namespace packages, it is helpful to understand that the delimiter between the
`namespace` and the `package_name` is not consistent throughout common python workflows.
For example, here is how to reference the namespace package `"a"` from this repository.
- Creating your namespace package with setuptools in `setup.py`:
- `setup(name="example_pkg_a")`
- Installing / Uninstalling a namespace package with `pip`:
- `pip install example-pkg-a`
- Importing a namespace package with`python`:
- `import example_pkg.a`
From the root directory, running the following command will install a package called `example_pkg.a`.
```bash
cd pkgutil/pkg_a
python -m pip install .
# Test the install by printing the `name` from the `__init__.py` file.
python -c "import example_pkg.a as a; print(a.name)"
```
================================================
FILE: pkgutil/pkg_a/example_pkg/__init__.py
================================================
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
================================================
FILE: pkgutil/pkg_a/example_pkg/a/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'a'
================================================
FILE: pkgutil/pkg_a/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: pkgutil/pkg_a/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(
name='example_pkg_a',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=find_packages(),
zip_safe=False,
)
================================================
FILE: pkgutil/pkg_b/example_pkg/__init__.py
================================================
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
================================================
FILE: pkgutil/pkg_b/example_pkg/b/__init__.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name = 'b'
================================================
FILE: pkgutil/pkg_b/pyproject.toml
================================================
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
================================================
FILE: pkgutil/pkg_b/setup.py
================================================
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(
name='example_pkg_b',
version='1',
description='',
long_description='',
author='Jon Wayne Parrott',
author_email='jonwayne@google.com',
license='Apache Software License',
packages=find_packages(),
zip_safe=False,
)
================================================
FILE: report_to_table.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
import io
import json
with io.open('report.json', 'r') as f:
data = json.load(f)
with io.open('table.md', 'w') as f:
f.write('| Type | Interpreter | Package A command | Package B command | Status |\n')
f.write('| --- | --- | --- | --- | --- |\n')
for session in data['sessions']:
session_name = session['name']
session_detailled_name = session['signatures'][-1]
session_interpreter = session_detailled_name.replace(session_name + "-", "python")
# TODO: Replace with `str.removeprefix()` in Python 3.12
session_name = session_name[len("session_") :]
f.write('| {} | {} | {} | {} | {} |\n'.format(
session_name,
session_interpreter,
' '.join(session['args']['command_a']),
' '.join(session['args']['command_b']),
'✅' if session['result_code'] else '❌'
))
================================================
FILE: requirements.txt
================================================
# -- PYTHON PACKAGE REQUIREMENTS:
# USE: pip install -r <THIS_FILE>
nox >= 2023.04.22
================================================
FILE: table.md
================================================
| Type | Interpreter | Package A command | Package B command | Status |
| --- | --- | --- | --- | --- |
| pkgutil | python3.8 | pip install . | pip install . | ✅ |
| pkgutil | python3.8 | pip install . | pip install -e . | ✅ |
| pkgutil | python3.8 | pip install -e . | pip install . | ✅ |
| pkgutil | python3.8 | pip install -e . | pip install -e . | ✅ |
| pkgutil | python3.10 | pip install . | pip install . | ✅ |
| pkgutil | python3.10 | pip install . | pip install -e . | ✅ |
| pkgutil | python3.10 | pip install -e . | pip install . | ✅ |
| pkgutil | python3.10 | pip install -e . | pip install -e . | ✅ |
| pkgutil | python3.12 | pip install . | pip install . | ✅ |
| pkgutil | python3.12 | pip install . | pip install -e . | ✅ |
| pkgutil | python3.12 | pip install -e . | pip install . | ✅ |
| pkgutil | python3.12 | pip install -e . | pip install -e . | ✅ |
| pkg_resources | python3.8 | pip install . | pip install . | ✅ |
| pkg_resources | python3.8 | pip install . | pip install -e . | ✅ |
| pkg_resources | python3.8 | pip install -e . | pip install . | ✅ |
| pkg_resources | python3.8 | pip install -e . | pip install -e . | ✅ |
| pkg_resources | python3.10 | pip install . | pip install . | ✅ |
| pkg_resources | python3.10 | pip install . | pip install -e . | ✅ |
| pkg_resources | python3.10 | pip install -e . | pip install . | ✅ |
| pkg_resources | python3.10 | pip install -e . | pip install -e . | ✅ |
| pkg_resources | python3.12 | pip install . | pip install . | ✅ |
| pkg_resources | python3.12 | pip install . | pip install -e . | ✅ |
| pkg_resources | python3.12 | pip install -e . | pip install . | ✅ |
| pkg_resources | python3.12 | pip install -e . | pip install -e . | ✅ |
| pep420 | python3.8 | pip install . | pip install . | ✅ |
| pep420 | python3.8 | pip install . | pip install -e . | ✅ |
| pep420 | python3.8 | pip install -e . | pip install . | ✅ |
| pep420 | python3.8 | pip install -e . | pip install -e . | ✅ |
| pep420 | python3.10 | pip install . | pip install . | ✅ |
| pep420 | python3.10 | pip install . | pip install -e . | ✅ |
| pep420 | python3.10 | pip install -e . | pip install . | ✅ |
| pep420 | python3.10 | pip install -e . | pip install -e . | ✅ |
| pep420 | python3.12 | pip install . | pip install . | ✅ |
| pep420 | python3.12 | pip install . | pip install -e . | ✅ |
| pep420 | python3.12 | pip install -e . | pip install . | ✅ |
| pep420 | python3.12 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.8 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python3.8 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.8 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python3.8 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.10 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python3.10 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.10 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python3.10 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.12 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pkgutil | python3.12 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pkgutil | python3.12 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pkgutil | python3.12 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.8 | pip install . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.8 | pip install . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.8 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.8 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.10 | pip install . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.10 | pip install . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.10 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.10 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.12 | pip install . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.12 | pip install . | pip install -e . | ✅ |
| cross_pep420_pkgutil | python3.12 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkgutil | python3.12 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkg_resources | python3.8 | pip install . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.8 | pip install . | pip install -e . | ❌ |
| cross_pep420_pkg_resources | python3.8 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.8 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkg_resources | python3.10 | pip install . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.10 | pip install . | pip install -e . | ❌ |
| cross_pep420_pkg_resources | python3.10 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.10 | pip install -e . | pip install -e . | ✅ |
| cross_pep420_pkg_resources | python3.12 | pip install . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.12 | pip install . | pip install -e . | ❌ |
| cross_pep420_pkg_resources | python3.12 | pip install -e . | pip install . | ✅ |
| cross_pep420_pkg_resources | python3.12 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.8 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pep420 | python3.8 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.8 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pep420 | python3.8 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.10 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pep420 | python3.10 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.10 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pep420 | python3.10 | pip install -e . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.12 | pip install . | pip install . | ✅ |
| cross_pkg_resources_pep420 | python3.12 | pip install . | pip install -e . | ✅ |
| cross_pkg_resources_pep420 | python3.12 | pip install -e . | pip install . | ❌ |
| cross_pkg_resources_pep420 | python3.12 | pip install -e . | pip install -e . | ✅ |
================================================
FILE: verify_packages.py
================================================
from example_pkg import a
from example_pkg import b
print(a.name)
print(a.__path__)
print(b.name)
print(b.__path__)
gitextract_kazeylgz/ ├── .github/ │ └── workflows/ │ └── ci.yml ├── .gitignore ├── .python-versions-used ├── LICENSE ├── README.md ├── constraints.txt ├── legacy_table.md ├── native/ │ ├── pkg_a/ │ │ ├── example_pkg/ │ │ │ └── a/ │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── setup.py │ └── pkg_b/ │ ├── example_pkg/ │ │ └── b/ │ │ └── __init__.py │ ├── pyproject.toml │ └── setup.py ├── noxfile.py ├── pkg_resources/ │ ├── pkg_a/ │ │ ├── example_pkg/ │ │ │ ├── __init__.py │ │ │ └── a/ │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── setup.py │ └── pkg_b/ │ ├── example_pkg/ │ │ ├── __init__.py │ │ └── b/ │ │ └── __init__.py │ ├── pyproject.toml │ └── setup.py ├── pkgutil/ │ ├── README.md │ ├── pkg_a/ │ │ ├── example_pkg/ │ │ │ ├── __init__.py │ │ │ └── a/ │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── setup.py │ └── pkg_b/ │ ├── example_pkg/ │ │ ├── __init__.py │ │ └── b/ │ │ └── __init__.py │ ├── pyproject.toml │ └── setup.py ├── report_to_table.py ├── requirements.txt ├── table.md └── verify_packages.py
SYMBOL INDEX (8 symbols across 1 files) FILE: noxfile.py function install_packages (line 31) | def install_packages(session, package_a, package_b, command_a, command_b): function session_pkgutil (line 47) | def session_pkgutil(session, command_a, command_b): function session_pkg_resources (line 55) | def session_pkg_resources(session, command_a, command_b): function session_pep420 (line 65) | def session_pep420(session, command_a, command_b): function session_cross_pkg_resources_pkgutil (line 73) | def session_cross_pkg_resources_pkgutil(session, command_a, command_b): function session_cross_pep420_pkgutil (line 84) | def session_cross_pep420_pkgutil(session, command_a, command_b): function session_cross_pep420_pkg_resources (line 92) | def session_cross_pep420_pkg_resources(session, command_a, command_b): function session_cross_pkg_resources_pep420 (line 102) | def session_cross_pkg_resources_pep420(session, command_a, command_b):
Condensed preview — 35 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (57K chars).
[
{
"path": ".github/workflows/ci.yml",
"chars": 1596,
"preview": "name: CI\non:\n push:\n branches: [\"master\", \"src-layout\"]\n pull_request:\n branches: [\"master\", \"src-layout\"]\n sch"
},
{
"path": ".gitignore",
"chars": 57,
"preview": "dist\nbuild\n__pycache__\n*.pyc\n*.egg-info\n.nox\nreport.json\n"
},
{
"path": ".python-versions-used",
"chars": 14,
"preview": "3.8\n3.10\n3.12\n"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 3462,
"preview": "# Python Namespace Package Examples\n\nThis repository contains samples for the various ways to create namespace\npackages "
},
{
"path": "constraints.txt",
"chars": 36,
"preview": "setuptools >= 68.2.2\nwheel >= 0.42.0"
},
{
"path": "legacy_table.md",
"chars": 12760,
"preview": "| Type | Interpreter | Package A command | Package B command | Status |\n| --- | --- | --- | --- | --- |\n| pkgutil | pyth"
},
{
"path": "native/pkg_a/example_pkg/a/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "native/pkg_a/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "native/pkg_a/setup.py",
"chars": 873,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "native/pkg_b/example_pkg/b/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "native/pkg_b/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "native/pkg_b/setup.py",
"chars": 873,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "noxfile.py",
"chars": 4020,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkg_resources/pkg_a/example_pkg/__init__.py",
"chars": 56,
"preview": "__import__('pkg_resources').declare_namespace(__name__)\n"
},
{
"path": "pkg_resources/pkg_a/example_pkg/a/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkg_resources/pkg_a/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "pkg_resources/pkg_a/setup.py",
"chars": 926,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkg_resources/pkg_b/example_pkg/__init__.py",
"chars": 56,
"preview": "__import__('pkg_resources').declare_namespace(__name__)\n"
},
{
"path": "pkg_resources/pkg_b/example_pkg/b/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkg_resources/pkg_b/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "pkg_resources/pkg_b/setup.py",
"chars": 926,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkgutil/README.md",
"chars": 2660,
"preview": "# [pkgutil-style namespace packages](https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-nam"
},
{
"path": "pkgutil/pkg_a/example_pkg/__init__.py",
"chars": 65,
"preview": "__path__ = __import__('pkgutil').extend_path(__path__, __name__)\n"
},
{
"path": "pkgutil/pkg_a/example_pkg/a/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkgutil/pkg_a/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "pkgutil/pkg_a/setup.py",
"chars": 886,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkgutil/pkg_b/example_pkg/__init__.py",
"chars": 65,
"preview": "__path__ = __import__('pkgutil').extend_path(__path__, __name__)\n"
},
{
"path": "pkgutil/pkg_b/example_pkg/b/__init__.py",
"chars": 588,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "pkgutil/pkg_b/pyproject.toml",
"chars": 81,
"preview": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n"
},
{
"path": "pkgutil/pkg_b/setup.py",
"chars": 886,
"preview": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this "
},
{
"path": "report_to_table.py",
"chars": 932,
"preview": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport io\nimport json\n\n\nwith io.open('report.json', 'r') as f:\n data = jso"
},
{
"path": "requirements.txt",
"chars": 87,
"preview": "# -- PYTHON PACKAGE REQUIREMENTS:\n# USE: pip install -r <THIS_FILE>\n\nnox >= 2023.04.22\n"
},
{
"path": "table.md",
"chars": 6364,
"preview": "| Type | Interpreter | Package A command | Package B command | Status |\n| --- | --- | --- | --- | --- |\n| pkgutil | pyth"
},
{
"path": "verify_packages.py",
"chars": 117,
"preview": "from example_pkg import a\nfrom example_pkg import b\n\nprint(a.name)\nprint(a.__path__)\nprint(b.name)\nprint(b.__path__)\n"
}
]
About this extraction
This page contains the full source code of the pypa/sample-namespace-packages GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 35 files (51.8 KB), approximately 14.3k tokens, and a symbol index with 8 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.