Is there a way to prevent accidental publication of private package such as "private": true
in NPM?
A Python file that relies only on the standard library can be redistributed and reused without the need to use setuptools. But for projects that consist of multiple files, need additional libraries, or need a specific version of Python, setuptools will be required.
python setup.py bdist_wheel. This will build any C extensions in the project and then package those and the pure Python code into a . whl file in the dist directory.
Most Python users will not want to use this module directly, but instead use the cross-version tools maintained by the Python Packaging Authority. In particular, setuptools is an enhanced alternative to distutils that provides: support for declaring project dependencies.
setuptools in Python setuptools is a library which is built on top of distutils that has been deprecated (and up for removal as of Python 3.12).
You can add something like this to the top of your setup.py script:
import sys
for arg in sys.argv:
if arg in ('upload', 'register', 'testarg'):
print('This setup is not designed to be uploaded or registered.')
sys.exit(-1)
You can test it works safely by doing:
python setup.py testarg
This should display a message and immediately exit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With