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.

`tests` directory is installed with `pip install`

See original GitHub issue

Problem description

Version: 4.2.0

Observed:

$ pip install smart-open --target /tmp/smart-open
$ cd /tmp/smart-open/smart_open
$ du -hcs *

We get:

16K	azure.py
8,0K	bytebuffer.py
4,0K	compression.py
4,0K	concurrency.py
4,0K	constants.py
8,0K	doctools.py
20K	gcs.py
4,0K	hdfs.py
12K	http.py
4,0K	__init__.py
4,0K	local_file.py
160K	__pycache__
44K	s3.py
16K	smart_open_lib.py
8,0K	ssh.py
524K	tests
4,0K	transport.py
8,0K	utils.py
4,0K	version.py
8,0K	webhdfs.py
864K	total

==> Tests files represent 60% of the total package size. These files are not needed at “run time”.

Expected: ==> Tests files are not installed with $ pip install. (So the size of the package goes down to 340 kB.)

Additional information: If this issue is validated, I can fix it and provide a PR. The size of packages are important when using AWS Lambdas. (We want to keep Lambdas size as small as possible.)

Checklist

Before you create the issue, please make sure you have:

  • Described the problem clearly
  • Provided a minimal reproducible example, including any required data
  • Provided the version numbers of the relevant software

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
e-nalepacommented, Mar 4, 2021
1reaction
piskvorkycommented, Mar 4, 2021

That PR included data required by smart_open tests, so that the tests pass.

I think what’s being asked here is different: remove the tests from the packaged distribution altogether, both code and data.

FWIW I have no objection, the packaged tests serve no purpose to me. Personally when I want to test a package, I go full dev-mode and install from git and tinker (as opposed to test a pip install-ed prepackaged distribution). But other people may have different valid use-cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

exclude tests directory when doing pip install #74 - GitHub
There should be a way to exclude this directory from consideration during builds.
Read more >
Install Test Python Package in Different directory Using Pip
I have a python distutils module that I use in production. I have that production module installed in a virtual environment. However, I'd...
Read more >
Testing your python package as installed - Paul Ganssle
Testing your python package as installed ... it is often convenient that Python searches the local directory for modules to import, ...
Read more >
Good Integration Practices — pytest documentation
You can then install your package in “editable” mode by running from the same directory: pip install -e . which lets you change...
Read more >
pip install - pip documentation v22.3.1
Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%Python on Windows. (See the Python documentation for site.
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