install package which has setup_requires from local source distributions

  • Last Update :
  • Techknowledgy :

Take the following trivial package which contains setup_requires:

from setuptools
import setup
setup(name = 'my_package', setup_requires = ['cython'])

So now I have:

$ ls dist /
   my_package - 0.0 .0.tar.gz
Cython - 0.21 .1.tar.gz

Setting the following

[easy_install]
allow_hosts = ''
find_links = file: ///$(pwd)/emr-sdists

Suggestion : 2

To have your project installable from a Package Index like PyPI, you’ll need to create a Distribution (aka “Package”) for your project.,Before you can build wheels and sdists for your project, you’ll need to install the build package:,You should also create a wheel for your project. A wheel is a built package that can be installed without needing to go through the “build” process. Installing wheels is substantially faster for the end user than installing from a source distribution.,When you ran the command to create your distribution, a new directory dist/ was created under your project’s root directory. That’s where you’ll find your distribution file(s) to upload.

python3 - m pip install twine
py - m pip install twine
name = 'sample',
Cool - Stuff
cool.stuff
COOL_STUFF
CoOl__ - . - __sTuFF
version = '1.2.0',
description = 'A sample Python project',
   long_description = long_description,
   long_description_content_type = 'text/x-rst',

Suggestion : 3

This is where a package declares its core dependencies, without which it won’t be able to run. setuptools supports automatically downloading and installing these dependencies when the package is installed. Although there is more finesse to it, let’s start with a simple example.,Setuptools allows you to declare dependencies that are not installed by default. This effectively means that you can create a “variant” of your package with a set of extra functionalities.,Historically setuptools also used to support extra dependencies in console scripts, for example:,Dependencies that are not available on a package index but can be downloaded elsewhere in the form of a source repository or archive may be specified using a variant of PEP 440’s direct references:

[build - system]
requires = ["setuptools"]
#...
[project]
#...
   dependencies = [
      "docutils",
      "BazSpam == 1.1",
   ]
#...
[options]
#...
   install_requires =
   docutils
BazSpam == 1.1
setup(
   ...,
   install_requires = [
      'docutils',
      'BazSpam ==1.1',
   ],
)
[project]
#...
   dependencies = [
      "enum34; python_version<'3.4'",
   ]
#...
[options]
#...
   install_requires =
   enum34;
python_version < '3.4'

Suggestion : 4

Extra arguments to be supplied to the setup.py install command (use like --install-option=”--install-scripts=/usr/local/bin”). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.,Extra global options to be supplied to the setup.py call before the install or bdist_wheel command.,The install command has a --report option that will generate a JSON report of what pip has installed. In combination with the --dry-run and --ignore-installed it can be used to resolve a set of requirements without actually installing them.,Don’t actually install anything, just print what would be. Can be used in combination with --ignore-installed to ‘resolve’ the requirements.

python -m pip install [options] <requirement specifier> [package-index-options] ...
   python -m pip install [options] -r <requirements file> [package-index-options] ...
      python -m pip install [options] [-e] <vcs project url> ...
         python -m pip install [options] [-e] <local project path> ...
            python -m pip install [options] <archive url/path> ...
py -m pip install [options] <requirement specifier> [package-index-options] ...
   py -m pip install [options] -r <requirements file> [package-index-options] ...
      py -m pip install [options] [-e] <vcs project url> ...
         py -m pip install [options] [-e] <local project path> ...
            py -m pip install [options] <archive url/path> ...
$ python - m pip install quux
   ...
   Installing collected packages baz, bar, foo, quux

$ python - m pip install bar
   ...
   Installing collected packages foo, baz, bar
C: \ > py - m pip install quux
   ...
   Installing collected packages baz, bar, foo, quux

C: \ > py - m pip install bar
   ...
   Installing collected packages foo, baz, bar
python - m pip install SomePackage # latest version
python - m pip install SomePackage == 1.0 .4 # specific version
python - m pip install 'SomePackage>=1.0.4'
# minimum version
py - m pip install SomePackage # latest version
py - m pip install SomePackage == 1.0 .4 # specific version
py - m pip install 'SomePackage>=1.0.4'
# minimum version

Suggestion : 5

The recommended way to install setuptools on Windows is to download ez_setup.py and run it. The script will download the appropriate .egg file and install it for you.,Download ez_setup.py and run it using the target Python version. The script will download the appropriate version and install it for you:,The ez_setup script/module now displays a warning before downloading the setuptools egg, and attempts to check the downloaded egg against an internal MD5 checksum table.,Running setup.py develop on a setuptools-using project will now install setuptools if needed, instead of only downloading the egg.

Using Windows 8 or later, it’s possible to install with one simple Powershell command. Start up Powershell and paste this command:

> (Invoke - WebRequest https: //bootstrap.pypa.io/ez_setup.py).Content | python -

You must start the Powershell with Administrative privileges or you may choose to install a user-local installation:

> (Invoke - WebRequest https: //bootstrap.pypa.io/ez_setup.py).Content | python - --user

If you have Python 3.3 or later, you can use the py command to install to different Python versions. For example, to install to Python 3.3 if you have Python 2.7 installed:

> (Invoke - WebRequest https: //bootstrap.pypa.io/ez_setup.py).Content | py -3 -

Download ez_setup.py and run it using the target Python version. The script will download the appropriate version and install it for you:

> wget https: //bootstrap.pypa.io/ez_setup.py -O - | python

Note that you will may need to invoke the command with superuser privileges to install to the system Python:

> wget https: //bootstrap.pypa.io/ez_setup.py -O - | sudo python

Alternatively, Setuptools may be installed to a user-local path:

> wget https: //bootstrap.pypa.io/ez_setup.py -O - | python - --user

If your system has curl installed, follow the wget instructions but replace wget with curl and -O with -o. For example:

> curl https: //bootstrap.pypa.io/ez_setup.py -o - | python

For more advanced installation options, such as installing to custom locations or prefixes, download and extract the source tarball from Setuptools on PyPI and run setup.py with any supported distutils and Setuptools options. For example:

setuptools - x.x$ python setup.py install--prefix = /opt/setuptools

Issue #105 and Issue #113: Establish a more robust technique for determining the terminal encoding:

1. Try ``
getpreferredencoding``
2. If that returns US_ASCII or None,
try the encoding from
   ``
getdefaultlocale``.If that encoding was a "fallback"
because Python
could not figure it out from the environment or OS, encoding remains
unresolved.
3. If the encoding is resolved, then make sure Python actually implements
the encoding.
4. On the event of an error or unknown codec, revert to fallbacks(UTF - 8 on Darwin, ASCII on everything
   else).
5. On the encoding is 'mac-roman'
on Darwin, use UTF - 8 as 'mac-roman'
was
a bug on older Python releases.

On a side note, it would seem that the encoding only matters
for when SVN
does not yet support ``--xml``
and when getting repository and svn version
numbers.The ``--xml``
technique should yield UTF - 8 according to some
messages on the SVN mailing lists.So
if the version numbers are always
7 - bit ASCII clean, it may be best to only support the file parsing methods
for legacy SVN releases and support
for SVN without the subprocess command
would simple go away as support
for the older SVNs does.

Distribute #334: Provide workaround for packages that reference sys.__stdout__ such as numpy does. This change should address virtualenv `#359 <https://github.com/pypa/virtualenv/issues/359>`_ as long as the system encoding is UTF-8 or the IO encoding is specified in the environment, i.e.:

PYTHONIOENCODING = utf8 pip install numpy