When I create a source distribution (sdist
) of my python project "my-project" (below) with setuptools
, like the one below to create a .tar.gz
project, setuptools creates an encapsulating directory with the version number on the name inside of the .tar.gz
. Is there anyway to remove that?
My Project:
my-project
├── LICENSE
├── README.md
├── example_pkg
│ └── __init__.py
│ └── my_program.py
├── setup.py
└── tests
setup.py
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="my-project", # Replace with your own username
version="0.0.1",
author="DogEatDog",
author_email="author@example.com",
description="A small example package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
Running python3 setup.py sdist
should create:
dist/my-project-0.0.1.tar.gz
Extracting this tarball tar -xvf dist/my-project-0.0.1.tar.gz
will extract to:
my-project-0.0.1
With all of the source inside my-project-0.0.1/<my source>
.
Is there anyway to change setuptools
to create a tarball that will extract into the current directory instead of the named directory? Such that running tar -xvf my-project-0.0.1.tar.gz
would extract into the current directory?
OR
Is there a way in setuptools
to specify the name of the encapsulating directory? Such that tar -xvf my-project-0.0.1.tar.gz
would extract to my-chosen-dir-name
instead of my-project-0.0.1
?
OR
Is there a way in setuptools
to remove the version number from encapsulating directory? Such that tar -xvf my-project-0.0.1.tar.gz
would extract to my-project
instead of my-project-0.0.1
?