Simplified packaging of Python modules

Related tags

Build Tools flit
Overview

Flit is a simple way to put Python packages and modules on PyPI. It tries to require less thought about packaging and help you avoid common mistakes. See Why use Flit? for more about how it compares to other Python packaging tools.

Install

$ python3 -m pip install flit

Flit requires Python 3 and therefore needs to be installed using the Python 3 version of pip.

Python 2 modules can be distributed using Flit, but need to be importable on Python 3 without errors.

Usage

Say you're writing a module foobar — either as a single file foobar.py, or as a directory — and you want to distribute it.

  1. Make sure that foobar's docstring starts with a one-line summary of what the module is, and that it has a __version__:

    """An amazing sample package!"""
    
    __version__ = '0.1'
  2. Install flit if you don't already have it:

    python3 -m pip install flit
    
  3. Run flit init in the directory containing the module to create a pyproject.toml file. It will look something like this:

    [build-system]
    requires = ["flit_core >=2,<4"]
    build-backend = "flit_core.buildapi"
    
    [tool.flit.metadata]
    module = "foobar"
    author = "Sir Robin"
    author-email = "[email protected]"
    home-page = "https://github.com/sirrobin/foobar"

    You can edit this file to add other metadata, for example to set up command line scripts. See the pyproject.toml page of the documentation.

    If you have already got a flit.ini file to use with older versions of Flit, convert it to pyproject.toml by running python3 -m flit.tomlify.

  4. Run this command to upload your code to PyPI:

    flit publish
    

Once your package is published, people can install it using pip just like any other package. In most cases, pip will download a 'wheel' package, a standard format it knows how to install. If you specifically ask pip to install an 'sdist' package, it will install and use Flit in a temporary environment.

To install a package locally for development, run:

flit install [--symlink] [--python path/to/python]

Flit packages a single importable module or package at a time, using the import name as the name on PyPI. All subpackages and data files within a package are included automatically.

Comments
  • support src/ directories

    support src/ directories

    A src/ directory is a best practice these days (outlined here: https://hynek.me/articles/testing-packaging/#src ); it ensures you've made your package importable on purpose, and helps make sure you're not just picking up the one in cwd just because you happen to have a shell open in that directory.

    I think all flit would need to do is sys.path.append here in some cases.

    opened by glyph 68
  • Central sdist / setup.py discussion

    Central sdist / setup.py discussion

    I've been asked a few times to provide setup.py files and/or sdists for projects packaged with flit. This is a central place to think about problems and potential solutions. It is not a commitment to add any particular support for this in flit.

    The problems that have been encountered are:

    • People want to pip install directly from a Github URL, which only works if the repository contains a setup.py at the top level.
    • People using legacy tools such as buildout may be unable to install wheels (see e.g. pexpect/ptyprocess#31).
    • Linux distro packagers have toolchains that expect a source tarball with a setup.py file (e.g. jupyter/testpath#6). I don't have much sympathy with this issue, because I think declarative metadata and standard formats will ultimately make repackaging easier.

    Potential solutions to some of these problems:

    • flituptools is a module which reads metadata from a flit config file and invokes setuptools with it. The idea is that you can check in a setup.py that just calls flituptools.setup(), and either copy flituptools into your repo, or tell users they need it to pip install directly from Github. However:
      • Packages are only installable with flit already installed, and consequently with Python 3.
      • Eeuw, setuptools.
    • make_sdist.py is a script I wrote for ptyprocess, to generate a basic sdist from flit metadata. The sdist does not depend on flit, so it can be installed in any version of Python. However:
      • No setup.py in the repo, so it doesn't allow pip install directly from Github. If you do generate a setup.py and check it in, you have duplicate information to keep up to date.
      • People ask for things like tests and docs in sdists, so before you know it, you're reinventing MANIFEST.in, which really doesn't appeal.
      • Technically Linux distro packagers shouldn't use the sdists, as setup.py is generated rather than a source file. In reality, most probably won't notice or won't care.
    • @njsmith proposed a new sdist format which would have used a declarative config file to specify the buildsystem to use to make wheels. However:
      • The proposal got mired in different opinions on what it was trying to achieve, and didn't go anywhere.
      • It presumably wouldn't help people with legacy tools, though at least a new standard would provide a better argument for moving to newer tools.
    • One could write a setup.py that implements the necessary command line interface for pip (documented here) without calling into distutils/setuptools (thanks @njsmith for the suggestion). Apparently other projects have done this. However:
      • The pip specification basically says "do what setuptools does" - specifically the egg_info command, which creates metadata in setuptools' non-standard format.
        • Perhaps a PR could be made against pip to try bdist_wheel first, and not bother with egg_info if it succeeds? That would make it easier to integrate.
    opened by takluyver 47
  • Vendor tomli to break the circular dependency.

    Vendor tomli to break the circular dependency.

    Minimal vendoring implementation based on pip vendoring.

    This seems to be straightforward maintenance wise and should make things a lot easier when it comes to bootstrapping flit_core.

    opened by jameshilliard 35
  • Build steps?

    Build steps?

    This is another speculative issue for discussion, not something that's necessarily going to be implemented. The question is whether & how to support build steps to run when producing a wheel.

    Should we?

    So far, I have always said that flit is a simple tool for simple packages, i.e. those with no build step. I think these are the vast majority of packages we publish, and the simplicity argument is still an important one against adding such features. I also don't know much about compilers, which are one of the most common sorts of build steps.

    The best argument I see in favour is that you may start packaging something with flit, then add something that requires a build step. With no support for that, you have to throw away your packaging metadata and workflows to switch to another tool.

    I expect that the majority of people looking at this issue will be those who want such features, so I'm not going to pay too much attention to +1s.

    How would it work?

    Briefly, the wheel build would copy files (the files in the package and... some others?) to a temporary location, and invoke external tools there to do the build.

    It would need some way to figure out the compatibility effects of the hooks:

    • Some do not restrict compatibility (e.g. minifying JS code)
    • Some restrict compatibility towards the platform they're run on (e.g. standard compilation)
    • Some restrict compatibility towards a specific platform regardless of where they're run.
    • Some can be asked to target a particular platform (cross compilation)

    It would also need to elegantly combine multiple build hooks - e.g. if you have a C extension module and a Qt designer .ui file to compile, it should be possible to specify those as two independent build steps, without either needing to be aware of the other. Or maybe this composition should be the responsibility of a proper build system which we invoke.

    opened by takluyver 35
  • 3.5.1: cannot add module metadata in project tree

    3.5.1: cannot add module metadata in project tree

    I'm trying ot add .{dist|egg}.info metadata in structlog module which is using as build backend flit and looks like it is not possible to do that

    + cd structlog-21.5.0
    + /usr/bin/python3 -sBm build -w
    * Creating venv isolated environment...
    * Installing packages in isolated environment... (flit_core >=3.4,<4)
    * Getting dependencies for wheel...
    * Building wheel...
    Successfully built structlog-21.5.0-py3-none-any.whl
    + pip install -e .
    Defaulting to user installation because normal site-packages is not writeable
    Obtaining file:///home/tkloczko/rpmbuild/BUILD/structlog-21.5.0
      Installing build dependencies ... done
      Checking if build backend supports build_editable ... done
      Getting requirements to build editable ... done
      Preparing editable metadata (pyproject.toml) ... done
    Building wheels for collected packages: structlog
      Building editable for structlog (pyproject.toml) ... done
      Created wheel for structlog: filename=structlog-21.5.0-py3-none-any.whl size=8107 sha256=e193ec3c74a678106d51a2b593a7d5037c7fa94cc2fdeae0fbb66b7eb0081bc1
      Stored in directory: /tmp/pip-ephem-wheel-cache-68zzmr4f/wheels/35/89/3a/cd47c49b9d6c16185c5a0f83a41dd101771681f0d2bcadf8f3
    Successfully built structlog
    Installing collected packages: structlog
      Attempting uninstall: structlog
        Found existing installation: structlog 21.5.0
        Uninstalling structlog-21.5.0:
          Successfully uninstalled structlog-21.5.0
    Successfully installed structlog-21.5.0
    

    Loks like pip is not able to take [project] section from pyproject.toml. How can I do that? flit command seems does not offer anything like generate .{dist|egg}.info directory :/

    opened by kloczek 31
  • Add bootstrap install script for flit_core

    Add bootstrap install script for flit_core

    This builds a wheel and unzips it to site-packages, which is my suggestion for how downstream packagers bootstrap packaging tools. This isn't the only possible approach: https://github.com/FFY00/python-bootstrap shows how to have a set of basic tools all importable together for the bootstrapping phase.

    This is deliberately lacking install features like removing a previous version, or atomic installation. It's meant to be run in a context where you know it's not already installed, and where a failure means the resulting state will be discarded anyway.

    @jameshilliard, does this look like it would help you, following our discussion in #462?

    If this approach is useful, it might be reasonable to add similar scripts for a few other pieces of low-level packaging infrastructure - in particular tomli and installer (cc @hukkin, @pradyunsg ). This is just a starting point for discussion.

    opened by takluyver 24
  • WIP: allow src dir

    WIP: allow src dir

    I'd really like to use flit for projects with src directories.

    The flit project already has 2 types of projects.

    1. just a module, like foo.py
    2. a package (directory with __init__.py), like foo/__init__.py

    This would add a 3rd and 4th.

    1. just a module, but in src, like src/foo.py
    2. a package in src, like src/foo/__init__.py

    It has minimal impact on the rest of the code, only touching 2 functions. All existing tests still pass.

    opened by okken 23
  • ModuleNotFoundError: No module named 'flit_core.dummy'

    ModuleNotFoundError: No module named 'flit_core.dummy'

    I'm building my project with

    [build-system]
    requires = ["flit_core >=3.2,<4"]
    build-backend = "flit_core.buildapi"
    

    and since earlier today I'm getting the error message

          [...]
          ModuleNotFoundError: No module named 'flit_core.dummy'
          [end of output]
    

    when running pip install . on the repo. Perhaps I messed up something in the package, but the error message points towards flit. Any idea what's going on?

    bug 
    opened by nschloe 22
  • Q: how to build install and test flit in isolated network?

    Q: how to build install and test flit in isolated network?

    I'm trying to build flit in isolated network and really struggling with doing that. I'm trying to use build module like with few other modulke and to be hones I'm stuck

    + cd flit-3.2.0
    + cd flit_core
    + PYTHONPATH=/home/tkloczko/rpmbuild/BUILD/flit-3.2.0/flit_core/flit_core:/home/tkloczko/rpmbuild/BUILD/flit-3.2.0/flit_core/flit
    + FLIT_NO_NETWORK=1
    + /usr/bin/python3 -m build --no-isolation
    + cd -
    /home/tkloczko/rpmbuild/BUILD/flit-3.2.0
    + PYTHONPATH=/home/tkloczko/rpmbuild/BUILD/flit-3.2.0/flit_core:/home/tkloczko/rpmbuild/BUILD/flit-3.2.0/flit
    + /usr/bin/python3 -m build --no-isolation
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/runpy.py", line 194, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/home/tkloczko/rpmbuild/BUILD/flit-3.2.0/flit/build.py", line 12, in <module>
        from .config import read_flit_config, ConfigError
    ImportError: attempted relative import with no known parent package
    

    May I ask for some hints/advices or help?

    opened by kloczek 22
  • flit publish fails: this api is no longer supported

    flit publish fails: this api is no longer supported

    Running flit publish results in the following. Last time I did this, May 24 (withflit wheel --upload) it worked. I'm not sure what it means by simply upload the file.

    Copying package file(s) from bowtie                                                                       I-flit.wheel
    Writing metadata files                                                                                    I-flit.wheel
    Writing the record of files                                                                               I-flit.wheel
    Built wheel: dist/bowtie-0.4.0-py2.py3-none-any.whl                                                       I-flit.wheel
    Found 62 files tracked in git                                                                             I-flit.sdist
    Writing generated setup.py                                                                                I-flit.sdist
    Built sdist: dist/bowtie-0.4.0.tar.gz                                                                     I-flit.sdist
    Using repository at https://upload.pypi.org/legacy/                                                      I-flit.upload
    Install keyring to store passwords securely                                                              W-flit.upload
    Server  : https://upload.pypi.org/legacy/
    Username: jwkvam
    Password:
    Uploading dist/bowtie-0.4.0-py2.py3-none-any.whl...                                                      I-flit.upload
    Uploading forbidden; trying to register and upload again                                                 W-flit.upload
    Traceback (most recent call last):
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/upload.py", line 256, in do_upload
        upload_file(file, metadata, repo)
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/upload.py", line 225, in upload_file
        resp.raise_for_status()
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/requests/models.py", line 937, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/jacques/miniconda/bin/flit", line 11, in <module>
        sys.exit(main())
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/__init__.py", line 123, in main
        main(args.ini_file, args.repository, formats=set(args.format or []))
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/upload.py", line 276, in main
        do_upload(built.wheel.file, built.wheel.builder.metadata, repo_name)
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/upload.py", line 262, in do_upload
        register(metadata, repo)
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/flit/upload.py", line 237, in register
        resp.raise_for_status()
      File "/Users/jacques/miniconda/lib/python3.6/site-packages/requests/models.py", line 937, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 410 Client Error: This API is no longer supported, instead simply upload the file. for url: https://upload.pypi.org/legacy/
    
    opened by jwkvam 22
  • WIP: added supporting namespace package

    WIP: added supporting namespace package

    • [won't fix] support pkg_resources style namespace package (adding namespace_packages in setup.py)
    • [x] fix installing via symlink
    • [x] refactor variable names
    opened by aodag 18
  • Support PEP 582 - Python local packages directory

    Support PEP 582 - Python local packages directory

    Support PEP 582 - Python local packages directory

    Is your feature request related to a problem? Please describe.

    PEP 582 is not supported by flit.

    Describe the solution you'd like

    The PEP proposes to add to Python a mechanism to automatically recognize a __pypackages__ directory and prefer importing packages installed in this location over user or global site-packages. This will avoid the steps to create, activate or deactivate “virtual environments”. Python will use the __pypackages__ from the base directory of the script when present.

    Additional context

    https://peps.python.org/pep-0582/

    wontfix 
    opened by HLFH 2
  • Question: Distribution Package with two Import Packages: Install only one Import Package

    Question: Distribution Package with two Import Packages: Install only one Import Package

    This question was also asked on setuptools dicussion forum. I know nothing then setuptools and now try to look around for alternatives that maybe able to solve my "problem".

    I have a Distribution Package named bit_demo containing the two Import Packages bitcli and bitgui.

    bit_demo
    ├── pyproject.toml
    ├── src
    │   ├── bitcli
    │   │   ├── __init__.py
    │   │   └── __main__.py
    │   └── bitgui
    │       ├── __init__.py
    │       └── __main__.py
    └── tests
        ├── integration
        └── unit
    

    When I install it via python3 -m pip install bit_demo I do have the two import packages in my system.

    Would it be possible to install bit_demo but only with bitcli? Can I install a distribution package excluding some of its import packages?

    For example

    python3 -m pip install bit_demo.bitcli
    
    python3 -m pip install bit_demo  --exclude bit_demo.bitgui
    

    Background of my question

    I think about the distro maintainers (e.g. Debian, Arch) who need to create a deb file of my upstream repo. There need to be two packages in the distro. When users only want to use the CLI interface without GUI (e.g. on a headless server) they would do apt install bitcli. But when they need it with GUI they would do apt install bitgui (and bitlic comes in as dependency).

    Technically bitcli can live alone. But bitgui is useless alone because it use a lot of bitcli code. Because of that I don't think it would be a good idea to create two separate git repositories. I would prefer to keep them together as one repo/distribution package.

    opened by buhtz 1
  • Doc: Terminology about packages

    Doc: Terminology about packages

    This is about rational.rst where you say on the second bullet point.

    • Subpackages are automatically included: you only need to specify the top-level package.

    It is not clear (for me) to what kind of packages you referring to. With "top-level package" do you mean Distribution Packages and with "subpackages" do you mean Import Packages?

    documentation 
    opened by buhtz 1
  • requires-extra not documented for new style metadata

    requires-extra not documented for new style metadata

    requires-extra is documented only under the old style metadata https://flit.pypa.io/en/latest/pyproject_toml.html#module-section

    I want to add a requires-extra section to a module that uses the new style metadata, and I'm stuck with trying to migrate from new-style to old-style, which is lossy and I suppose it is not what flit wants its users to do.

    documentation 
    opened by koubaa 4
  • 3.8.0: pytest is failing in four units

    3.8.0: pytest is failing in four units

    I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

    • python3 -sBm build -w --no-isolation
    • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
    • install .whl file in </install/prefix>
    • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

    Here is pytest output:

    + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-flit-3.8.0-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-flit-3.8.0-6.fc35.x86_64/usr/lib/python3.8/site-packages
    + /usr/bin/pytest -ra
    =========================================================================== test session starts ============================================================================
    platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
    rootdir: /home/tkloczko/rpmbuild/BUILD/flit-3.8.0
    collected 205 items
    
    flit_core/flit_core/tests/test_build_thyself.py ...                                                                                                                  [  1%]
    flit_core/flit_core/tests/test_buildapi.py .........                                                                                                                 [  5%]
    flit_core/flit_core/tests/test_common.py ....................                                                                                                        [ 15%]
    flit_core/flit_core/tests/test_config.py .............................................                                                                               [ 37%]
    flit_core/flit_core/tests/test_sdist.py ......                                                                                                                       [ 40%]
    flit_core/flit_core/tests/test_versionno.py .                                                                                                                        [ 40%]
    flit_core/flit_core/tests/test_wheel.py .....                                                                                                                        [ 43%]
    tests/test_build.py .....                                                                                                                                            [ 45%]
    tests/test_command.py ..                                                                                                                                             [ 46%]
    tests/test_config.py .                                                                                                                                               [ 47%]
    tests/test_find_python_executable.py .......                                                                                                                         [ 50%]
    tests/test_init.py ..................                                                                                                                                [ 59%]
    tests/test_install.py ...F..F..........F.F........                                                                                                                   [ 73%]
    tests/test_sdist.py ............                                                                                                                                     [ 79%]
    tests/test_tomlify.py .                                                                                                                                              [ 79%]
    tests/test_upload.py .......                                                                                                                                         [ 82%]
    tests/test_validate.py ................                                                                                                                              [ 90%]
    tests/test_vcs.py .                                                                                                                                                  [ 91%]
    tests/test_wheel.py ..................                                                                                                                               [100%]
    
    ================================================================================= FAILURES =================================================================================
    ____________________________________________________________________ InstallTests.test_install_data_dir ____________________________________________________________________
    
    self = <tests.test_install.InstallTests testMethod=test_install_data_dir>
    
        def test_install_data_dir(self):
    >       Installer.from_ini_path(
                core_samples_dir / 'with_data_dir' / 'pyproject.toml',
            ).install_directly()
    
    tests/test_install.py:296:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    flit/install.py:310: in install_directly
        self.install_requirements()
    flit/install.py:263: in install_requirements
        check_call(cmd)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    popenargs = (['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...],), kwargs = {}, retcode = 1
    cmd = ['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...]
    
        def check_call(*popenargs, **kwargs):
            """Run command with arguments.  Wait for command to complete.  If
            the exit code was zero then return, otherwise raise
            CalledProcessError.  The CalledProcessError object will have the
            return code in the returncode attribute.
    
            The arguments are the same as for the call function.  Example:
    
            check_call(["ls", "-l"])
            """
            retcode = call(*popenargs, **kwargs)
            if retcode:
                cmd = kwargs.get("args")
                if cmd is None:
                    cmd = popenargs[0]
    >           raise CalledProcessError(retcode, cmd)
    E           subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', '/tmp/tmp7kwihz9srequirements.txt']' returned non-zero exit status 1.
    
    /usr/lib64/python3.8/subprocess.py:364: CalledProcessError
    --------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
    Requirement already satisfied: requests>=2.18 in /usr/lib/python3.8/site-packages (from -r /tmp/tmp7kwihz9srequirements.txt (line 1)) (2.28.1)
    Requirement already satisfied: docutils in /usr/lib/python3.8/site-packages (from -r /tmp/tmp7kwihz9srequirements.txt (line 2)) (0.18.1)
    Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp7kwihz9srequirements.txt (line 1)) (3.4)
    Requirement already satisfied: charset-normalizer>=2 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp7kwihz9srequirements.txt (line 1)) (3.0.0)
    Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp7kwihz9srequirements.txt (line 1)) (1.26.12)
    --------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/tkloczko/.local/lib/python3.8/site-packages'
    Check the permissions.
    
    _________________________________________________________________ InstallTests.test_install_module_pep621 __________________________________________________________________
    
    self = <tests.test_install.InstallTests testMethod=test_install_module_pep621>
    
        def test_install_module_pep621(self):
    >       Installer.from_ini_path(
                core_samples_dir / 'pep621_nodynamic' / 'pyproject.toml',
            ).install_directly()
    
    tests/test_install.py:60:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    flit/install.py:310: in install_directly
        self.install_requirements()
    flit/install.py:263: in install_requirements
        check_call(cmd)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    popenargs = (['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...],), kwargs = {}, retcode = 1
    cmd = ['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...]
    
        def check_call(*popenargs, **kwargs):
            """Run command with arguments.  Wait for command to complete.  If
            the exit code was zero then return, otherwise raise
            CalledProcessError.  The CalledProcessError object will have the
            return code in the returncode attribute.
    
            The arguments are the same as for the call function.  Example:
    
            check_call(["ls", "-l"])
            """
            retcode = call(*popenargs, **kwargs)
            if retcode:
                cmd = kwargs.get("args")
                if cmd is None:
                    cmd = popenargs[0]
    >           raise CalledProcessError(retcode, cmd)
    E           subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', '/tmp/tmpfoibwf0erequirements.txt']' returned non-zero exit status 1.
    
    /usr/lib64/python3.8/subprocess.py:364: CalledProcessError
    --------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
    Requirement already satisfied: requests>=2.18 in /usr/lib/python3.8/site-packages (from -r /tmp/tmpfoibwf0erequirements.txt (line 1)) (2.28.1)
    Requirement already satisfied: docutils in /usr/lib/python3.8/site-packages (from -r /tmp/tmpfoibwf0erequirements.txt (line 2)) (0.18.1)
    Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpfoibwf0erequirements.txt (line 1)) (3.4)
    Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpfoibwf0erequirements.txt (line 1)) (1.26.12)
    Requirement already satisfied: charset-normalizer>=2 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpfoibwf0erequirements.txt (line 1)) (3.0.0)
    --------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/tkloczko/.local/lib/python3.8/site-packages'
    Check the permissions.
    
    ---------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
    WARNING  flit_core.versionno:versionno.py:124 Version number normalised: '0.03' -> '0.3' (see PEP 440)
    ____________________________________________________________________ InstallTests.test_symlink_data_dir ____________________________________________________________________
    
    self = <tests.test_install.InstallTests testMethod=test_symlink_data_dir>
    
        def test_symlink_data_dir(self):
            if os.name == 'nt':
                raise SkipTest("symlink")
    >       Installer.from_ini_path(
                core_samples_dir / 'with_data_dir' / 'pyproject.toml', symlink=True
            ).install_directly()
    
    tests/test_install.py:305:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    flit/install.py:310: in install_directly
        self.install_requirements()
    flit/install.py:263: in install_requirements
        check_call(cmd)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    popenargs = (['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...],), kwargs = {}, retcode = 1
    cmd = ['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...]
    
        def check_call(*popenargs, **kwargs):
            """Run command with arguments.  Wait for command to complete.  If
            the exit code was zero then return, otherwise raise
            CalledProcessError.  The CalledProcessError object will have the
            return code in the returncode attribute.
    
            The arguments are the same as for the call function.  Example:
    
            check_call(["ls", "-l"])
            """
            retcode = call(*popenargs, **kwargs)
            if retcode:
                cmd = kwargs.get("args")
                if cmd is None:
                    cmd = popenargs[0]
    >           raise CalledProcessError(retcode, cmd)
    E           subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', '/tmp/tmp1nztui2qrequirements.txt']' returned non-zero exit status 1.
    
    /usr/lib64/python3.8/subprocess.py:364: CalledProcessError
    --------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
    Requirement already satisfied: requests>=2.18 in /usr/lib/python3.8/site-packages (from -r /tmp/tmp1nztui2qrequirements.txt (line 1)) (2.28.1)
    Requirement already satisfied: docutils in /usr/lib/python3.8/site-packages (from -r /tmp/tmp1nztui2qrequirements.txt (line 2)) (0.18.1)
    Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp1nztui2qrequirements.txt (line 1)) (3.4)
    Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp1nztui2qrequirements.txt (line 1)) (1.26.12)
    Requirement already satisfied: charset-normalizer>=2 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmp1nztui2qrequirements.txt (line 1)) (3.0.0)
    --------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/tkloczko/.local/lib/python3.8/site-packages'
    Check the permissions.
    
    _________________________________________________________________ InstallTests.test_symlink_module_pep621 __________________________________________________________________
    
    self = <tests.test_install.InstallTests testMethod=test_symlink_module_pep621>
    
        def test_symlink_module_pep621(self):
            if os.name == 'nt':
                raise SkipTest("symlink")
    >       Installer.from_ini_path(
                core_samples_dir / 'pep621_nodynamic' / 'pyproject.toml', symlink=True
            ).install_directly()
    
    tests/test_install.py:160:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    flit/install.py:310: in install_directly
        self.install_requirements()
    flit/install.py:263: in install_requirements
        check_call(cmd)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    popenargs = (['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...],), kwargs = {}, retcode = 1
    cmd = ['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...]
    
        def check_call(*popenargs, **kwargs):
            """Run command with arguments.  Wait for command to complete.  If
            the exit code was zero then return, otherwise raise
            CalledProcessError.  The CalledProcessError object will have the
            return code in the returncode attribute.
    
            The arguments are the same as for the call function.  Example:
    
            check_call(["ls", "-l"])
            """
            retcode = call(*popenargs, **kwargs)
            if retcode:
                cmd = kwargs.get("args")
                if cmd is None:
                    cmd = popenargs[0]
    >           raise CalledProcessError(retcode, cmd)
    E           subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', '/tmp/tmpkabqdk4prequirements.txt']' returned non-zero exit status 1.
    
    /usr/lib64/python3.8/subprocess.py:364: CalledProcessError
    --------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
    Requirement already satisfied: requests>=2.18 in /usr/lib/python3.8/site-packages (from -r /tmp/tmpkabqdk4prequirements.txt (line 1)) (2.28.1)
    Requirement already satisfied: docutils in /usr/lib/python3.8/site-packages (from -r /tmp/tmpkabqdk4prequirements.txt (line 2)) (0.18.1)
    Requirement already satisfied: idna>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpkabqdk4prequirements.txt (line 1)) (3.4)
    Requirement already satisfied: charset-normalizer>=2 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpkabqdk4prequirements.txt (line 1)) (3.0.0)
    Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.18->-r /tmp/tmpkabqdk4prequirements.txt (line 1)) (1.26.12)
    --------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/tkloczko/.local/lib/python3.8/site-packages'
    Check the permissions.
    
    ---------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
    WARNING  flit_core.versionno:versionno.py:124 Version number normalised: '0.03' -> '0.3' (see PEP 440)
    ========================================================================= short test summary info ==========================================================================
    FAILED tests/test_install.py::InstallTests::test_install_data_dir - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...
    FAILED tests/test_install.py::InstallTests::test_install_module_pep621 - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '...
    FAILED tests/test_install.py::InstallTests::test_symlink_data_dir - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '-r', ...
    FAILED tests/test_install.py::InstallTests::test_symlink_module_pep621 - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '--user', '...
    ====================================================================== 4 failed, 201 passed in 6.96s =======================================================================
    

    Here is list of installed modules in build env

    Package                       Version
    ----------------------------- -----------------
    alabaster                     0.7.12
    appdirs                       1.4.4
    attrs                         22.1.0
    Babel                         2.11.0
    Brlapi                        0.8.3
    build                         0.9.0
    charset-normalizer            3.0.0
    codespell                     2.2.1
    contourpy                     1.0.5
    cssselect                     1.1.0
    cycler                        0.11.0
    distro                        1.7.0
    dnspython                     2.2.1
    docutils                      0.18.1
    extras                        1.0.0
    fixtures                      4.0.0
    fonttools                     4.38.0
    gpg                           1.17.1-unknown
    idna                          3.4
    imagesize                     1.4.1
    importlib-metadata            5.0.0
    iniconfig                     1.1.1
    Jinja2                        3.1.1
    kiwisolver                    1.4.4
    libcomps                      0.1.19
    louis                         3.23.0
    lxml                          4.9.1
    MarkupSafe                    2.1.1
    matplotlib                    3.6.0
    numpy                         1.23.1
    olefile                       0.46
    packaging                     21.3
    pbr                           5.9.0
    pep517                        0.13.0
    Pillow                        9.2.0
    pip                           22.2.2
    pluggy                        1.0.0
    py                            1.11.0
    Pygments                      2.13.0
    PyGObject                     3.42.2
    pyparsing                     3.0.9
    pytest                        7.1.3
    python-dateutil               2.8.2
    pytz                          2022.4
    requests                      2.28.1
    requests_download             0.1.2
    responses                     0.22.0
    rpm                           4.17.0
    scour                         0.38.2
    six                           1.16.0
    snowballstemmer               2.2.0
    Sphinx                        5.3.0
    sphinx-rtd-theme              1.1.0
    sphinxcontrib-applehelp       1.0.2.dev20220730
    sphinxcontrib-devhelp         1.0.2.dev20220730
    sphinxcontrib-htmlhelp        2.0.0
    sphinxcontrib-jsmath          1.0.1.dev20220730
    sphinxcontrib-qthelp          1.0.3.dev20220730
    sphinxcontrib-serializinghtml 1.1.5
    testpath                      0.6.0
    testtools                     2.5.0
    toml                          0.10.2
    tomli                         2.0.1
    tomli_w                       1.0.0
    types-toml                    0.10.8
    urllib3                       1.26.12
    wheel                         0.37.1
    zipp                          3.9.0
    
    opened by kloczek 5
  • Add `flit new` CLI

    Add `flit new` CLI

    Currently poetry has a poetry new my_package command which create a new folder containing the minimal required files to publish a project to PyPI.

    This is very convenient because I can publish a new PyPI project directly from the CLI:

    poetry new my_project
    cd my_project
    poetry build
    poetry publish
    

    However this is currently not possible with flit because the lack of new command. Like everything in flit, the default template could be something minimal, like:

    my_project/
        my_project/
            __init__.py
        pyproject.toml
        README.md
    
    opened by Conchylicultor 3
The official binary distribution format for Python

wheel This library is the reference implementation of the Python wheel packaging standard, as defined in PEP 427. It has two different roles: A setupt

Python Packaging Authority 368 Dec 23, 2022
Python-based continuous integration testing framework; your pull requests are more than welcome!

Buildbot The Continuous Integration Framework Buildbot is based on original work from Brian Warner, and currently maintained by the Botherders. Visit

Buildbot 5k Jan 5, 2023
Python-based project scripting.

Paver - Easy Scripting for Software Projects Web: https://pythonhosted.org/Paver/ Download: https://pypi.python.org/pypi/Paver/ Source: https://github

Paver community 452 Dec 9, 2022
Buildout is a deployment automation tool written in and extended with Python

Buildout Buildout is a project designed to solve 2 problems: Application-centric assembly and deployment Assembly runs the gamut from stitching togeth

buildout 552 Nov 26, 2022
A pynt of Python build.

A pynt of Python build. Raghunandan Rao Features Easy to learn. Build tasks are just python funtions. Manages dependencies between tasks. Automaticall

Raghunandan Rao 154 Jan 4, 2023
🔨🐍Make-like build automation tool for Python projects with extensive DSL features.

Pyke (WIP, Beta Release) Make-like build automation tool for Python projects with extensive DSL features. Features: Users can specify tasks, subtasks,

Ire 17 Jul 5, 2022
Python program for installing many tools automatically

Tool Installer is a script made with python which help user in installing tools automatically

Spider Anongreyhat 6 Mar 13, 2022
PyPacker: a dumb little script for turning Python apps into standalone executable packages on Windows

PyPacker: a dumb little script for turning Python apps into standalone executable packages on Windows PyPacker is my attempt at creating a way to make

Serdar Yegulalp 9 Mar 15, 2022
A Star Trek Online build tool in Python

SETS - STO Equipment and Trait Selector A Star Trek Online build tool in Python Description Pre-alpha version of build tool for STO Getting Started De

Star Trek Online Community Developers 7 Nov 12, 2022
This is a python helper package for Telebirr H5 Web payment integration helper.

Telebirr This is a python helper package for Telebirr H5 Web payment integration helper. The use case for this interface is payment via web. Third par

null 24 Dec 13, 2022
Python package used on Hardfight projects to make building, testing and deploying easy.

Hardfight Devtools Build, test and deploy Hardfight projects easly ?? What is it Devtools is a Python tool to make building, testing and deploying int

Hardfight 1 Dec 5, 2021
Clang-based cross platform build system written in Python

Clang-build Find the full documentation at https://clang-build.readthedocs.io First steps Customisations Multiple targets Multiple projects Defaults M

Trick 17 9 Jun 29, 2022
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

Poetry 23.1k Jan 1, 2023
Python PyPi staging server and packaging, testing, release tool

devpi: PyPI server and packaging/testing/release tool This repository contains three packages comprising the core devpi system on the server and clien

null 629 Jan 1, 2023
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

Poetry 23.2k Jan 5, 2023
A modern Python application packaging and distribution tool

PyOxidizer PyOxidizer is a utility for producing binaries that embed Python. The over-arching goal of PyOxidizer is to make complex packaging and dist

Gregory Szorc 4.5k Jan 7, 2023
A simple weather tool. I made this as a way for me to learn Python, API, and PyPi packaging.

A simple weather tool. I made this as a way for me to learn Python, API, and PyPi packaging.

Clint E. 105 Dec 31, 2022
A library which implements low-level functions that relate to packaging and distribution of Python

What is it? Distlib is a library which implements low-level functions that relate to packaging and distribution of Python software. It is intended to

Python Packaging Authority 29 Oct 11, 2022
Pipeline is an asset packaging library for Django.

Pipeline Pipeline is an asset packaging library for Django, providing both CSS and JavaScript concatenation and compression, built-in JavaScript templ

Jazzband 1.4k Dec 26, 2022
Pipeline is an asset packaging library for Django.

Pipeline Pipeline is an asset packaging library for Django, providing both CSS and JavaScript concatenation and compression, built-in JavaScript templ

Jazzband 1.4k Jan 3, 2023