Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

300
Visualizações
Python commands to build distribution setup.py build vs python -m build

I'm learning about Python packaging, and according to this guide, the command to build a python distribution package seems to be python3 -m build.

But I aslo found that there is a command line interface for setup.py file from setuptools:

$ python setup.py --help-commands
Standard commands:
  build             build everything needed to install
  sdist             create a source distribution (tarball, zip file, etc.)
  bdist             create a built (binary) distribution
  bdist_dumb        create a "dumb" built distribution
  bdist_rpm         create an RPM distribution
  ...

It seems that python setup.py build, sdist or bdist can aslo build distribution, but I didn't find detailed intructions for these commands, the setuptools command reference lacks explanation for build sdist bdist.

So I'm a bit confused, what is the difference between python setup.py build and python -m build, or between python setup.py sdist and python -m build --sdist? Is the python setup.py command deprecated hence the lack of full documentation? When should I use python -m build or python setup.py build?

Any help would be appreciated.


Update: The doc of build module says “build is roughly the equivalent of setup.py sdist bdist_wheel but with PEP 517 support, allowing use with projects that don’t use setuptools”.

So should I always prefer build module rather than running python setup.py manually?. Is there still a use-case for setup.py build?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda