question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package py code and dependency to pyz

See original GitHub issue

I noticed there say “ we can publish a single file .pyz so that people can download and run without installing any dependencies”。How do you do that?for example: pyproject.toml

[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["qbit"]

[tool.poetry.dependencies]
python = "^3.8"
requests = "~2.25.1"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

test.py

import requests

def test():
    r = requests.get(r'https://www.httpbin.org/get')
    print(r)

if __name__ == '__main__':
    test()

It is best to compile to pyc before packaging :)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
frostmingcommented, Jul 16, 2021

Fine, I didn’t check those carefully. So I am going to close the issue since it is resolved.

0reactions
qbit-gitcommented, Jul 16, 2021

@frostming OK. Thanks for your time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can you bundle all your python code into a single zip file?
It is available from Python 3.5 onwards. One way to create a bundle is to add a top-level file named __main__.py , which...
Read more >
BTOdell/pyz: Packages all source code and ... - GitHub
This library allows you to bundle all of your Python code AND your dependencies into a single Python zip application file.
Read more >
pyz · PyPI
Packages all source code and dependencies into a single Python zip application.
Read more >
pyz - Python Package Health Analysis - Snyk
Packages all source code and dependencies into a single Python zip application. For more information about how to use this package see README....
Read more >
Python Zip Imports: Distribute Modules and Packages Quickly
Python allows you to import code from ZIP files directly through Zip imports. This interesting built-in feature enables you to zip Python ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found