Browse Source

set zip_safe=False if "typed" is enabled (see PEP-561 compatible packages: https://mypy.readthedocs.io/en/latest/installed_packages.html#making-pep-561-compatible-packages)

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
aeae098458
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
3 changed files with 21 additions and 2 deletions
  1. + 14
    - 2
      README.md
  2. + 1
    - 0
      setup.py
  3. + 6
    - 0
      src/shut/update/setuptools.py

+ 14
- 2
README.md

@ -1,7 +1,17 @@
# Shut
# shut
Shut is an opinionated tool that allows you to configure everything around the Python
packaging and release process with a single YAML configuration file.
packaging and release process from a single source of truth. It is intended to simplify
the process of publishing Python packages and prevent common pitfalls.
## Getting started
Use `shore pkg new --project-name my-package` to bootstrap a Python package directory.
Alternatively you can use the example configuration below.
**`package.yml`**
```yml
package:
@ -25,6 +35,8 @@ management, version number bumping, linter configuration, building and publishin
__Todo__
* [ ] Automatic check for license headers in files / automatically insert license headers
* [ ] Conda recipe generator and conda-forge helper
* [ ] Package data / data files
---

+ 1
- 0
setup.py

@ -69,4 +69,5 @@ setuptools.setup(
cmdclass = {},
keywords = [],
classifiers = [],
zip_safe = True,
)

+ 6
- 0
src/shut/update/setuptools.py

@ -208,6 +208,10 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
# TODO: py.typed must be included in package_data (or include_package_data=True)
data_files = '[]'
# MyPy cannot find PEP-561 compatible packages without zip_safe=False.
# See https://mypy.readthedocs.io/en/latest/installed_packages.html#making-pep-561-compatible-packages
zip_safe = not data.typed
# Write the setup function.
fp.write(textwrap.dedent('''
setuptools.setup(
@ -232,6 +236,7 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
cmdclass = {cmdclass},
keywords = {keywords!r},
classifiers = {classifiers!r},
zip_safe = {zip_safe!r},
''').rstrip().format(
name=data.name,
version=str(data.version),
@ -253,6 +258,7 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
cmdclass = '{' + ', '.join('{!r}: {}'.format(k, v) for k, v in cmdclass.items()) + '}',
keywords = data.keywords,
classifiers = data.classifiers,
zip_safe=zip_safe,
))
if data.is_universal():

Loading…
Cancel
Save