Skip to content

Commit

Permalink
sample_projects: Add example Conda project
Browse files Browse the repository at this point in the history
This was created with the following commands:

  - conda create --name conda_example python=3.12
  - conda activate conda_example
  - conda install requests
  - conda env export --from-history > environment.yml
  - echo "import requests" > main.py

followed by copying the corresponding Conda environment from
~/.conda/envs/conda_example into this sample project directory,
and then removing/truncating files that I do not currently consider
to be important for FawltyDeps to make sense of this project.

The result is a simple Conda project with two declared Conda
dependencies (Python itself + requests), along with a single source
file that imports requests.

The expected result of running FawltyDeps here is to report no
undeclared or unused dependencies.

Please note that since Conda puts environments under ~/.conda, and NOT
inside the project directory, this example is somewhat contrived: We can
not expect the Conda environment to be automatically discovered by
FawltyDeps (unless FD itself is installed and running from there),
but we must instead rely on the use of --pyenv to point to
~/.conda/envs/conda_example (in the general case, or
tests/sample_project/conda_example/.conda/envs/conda_example in this
test case)
  • Loading branch information
jherland committed Sep 19, 2024
1 parent 10a3374 commit 7487261
Show file tree
Hide file tree
Showing 39 changed files with 16,078 additions and 0 deletions.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
==> 2024-09-18 10:05:31 <==
# cmd: /home/jherland/.conda/bin/conda create --name conda_example python=3.12
# conda version: 4.11.0
+defaults/linux-64::_libgcc_mutex-0.1-main
+defaults/linux-64::_openmp_mutex-5.1-1_gnu
+defaults/linux-64::bzip2-1.0.8-h5eee18b_6
+defaults/linux-64::ca-certificates-2024.7.2-h06a4308_0
+defaults/linux-64::expat-2.6.3-h6a678d5_0
+defaults/linux-64::ld_impl_linux-64-2.38-h1181459_1
+defaults/linux-64::libffi-3.4.4-h6a678d5_1
+defaults/linux-64::libgcc-ng-11.2.0-h1234567_1
+defaults/linux-64::libgomp-11.2.0-h1234567_1
+defaults/linux-64::libstdcxx-ng-11.2.0-h1234567_1
+defaults/linux-64::libuuid-1.41.5-h5eee18b_0
+defaults/linux-64::ncurses-6.4-h6a678d5_0
+defaults/linux-64::openssl-3.0.15-h5eee18b_0
+defaults/linux-64::pip-24.2-py312h06a4308_0
+defaults/linux-64::python-3.12.5-h5148396_1
+defaults/linux-64::readline-8.2-h5eee18b_0
+defaults/linux-64::setuptools-72.1.0-py312h06a4308_0
+defaults/linux-64::sqlite-3.45.3-h5eee18b_0
+defaults/linux-64::tk-8.6.14-h39e8969_0
+defaults/linux-64::wheel-0.44.0-py312h06a4308_0
+defaults/linux-64::xz-5.4.6-h5eee18b_1
+defaults/linux-64::zlib-1.2.13-h5eee18b_1
+defaults/noarch::tzdata-2024a-h04d1e81_0
# update specs: ['python=3.12']
==> 2024-09-18 10:06:21 <==
# cmd: /home/jherland/.conda/bin/conda install requests
# conda version: 4.11.0
+defaults/linux-64::brotli-python-1.0.9-py312h6a678d5_8
+defaults/linux-64::certifi-2024.8.30-py312h06a4308_0
+defaults/linux-64::idna-3.7-py312h06a4308_0
+defaults/linux-64::pysocks-1.7.1-py312h06a4308_0
+defaults/linux-64::requests-2.32.3-py312h06a4308_0
+defaults/linux-64::urllib3-2.2.2-py312h06a4308_0
+defaults/noarch::charset-normalizer-3.3.2-pyhd3eb1b0_0
# update specs: ['requests']

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory exists so that 3rd party packages can be installed
here. Read the source for site.py for more details.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conda
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Metadata-Version: 2.1
Name: requests
Version: 2.32.3
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: [email protected]
License: Apache-2.0
Project-URL: Documentation, https://requests.readthedocs.io
Project-URL: Source, https://github.com/psf/requests
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: charset-normalizer <4,>=2
Requires-Dist: idna <4,>=2.5
Requires-Dist: urllib3 <3,>=1.21.1
Requires-Dist: certifi >=2017.4.17
Provides-Extra: security
Provides-Extra: socks
Requires-Dist: PySocks !=1.5.7,>=1.5.6 ; extra == 'socks'
Provides-Extra: use_chardet_on_py3
Requires-Dist: chardet <6,>=3.0.2 ; extra == 'use_chardet_on_py3'
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
requests-2.32.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
requests-2.32.3.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
requests-2.32.3.dist-info/METADATA,sha256=ZY7oRUweLnb7jCEnEW9hFWs7IpQbNVnAA4ncpwA4WBo,4610
requests-2.32.3.dist-info/RECORD,,
requests-2.32.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
requests-2.32.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
requests-2.32.3.dist-info/direct_url.json,sha256=j3hUqUs06824tF2S0ppVIpBEjzBybIkBlLGeAym03v8,68
requests-2.32.3.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9
requests/__init__.py,sha256=4xaAERmPDIBPsa2PsjpU9r06yooK-2mZKHTZAhWRWts,5072
requests/__pycache__/__init__.cpython-312.pyc,,
requests/__pycache__/__version__.cpython-312.pyc,,
requests/__pycache__/_internal_utils.cpython-312.pyc,,
requests/__pycache__/adapters.cpython-312.pyc,,
requests/__pycache__/api.cpython-312.pyc,,
requests/__pycache__/auth.cpython-312.pyc,,
requests/__pycache__/certs.cpython-312.pyc,,
requests/__pycache__/compat.cpython-312.pyc,,
requests/__pycache__/cookies.cpython-312.pyc,,
requests/__pycache__/exceptions.cpython-312.pyc,,
requests/__pycache__/help.cpython-312.pyc,,
requests/__pycache__/hooks.cpython-312.pyc,,
requests/__pycache__/models.cpython-312.pyc,,
requests/__pycache__/packages.cpython-312.pyc,,
requests/__pycache__/sessions.cpython-312.pyc,,
requests/__pycache__/status_codes.cpython-312.pyc,,
requests/__pycache__/structures.cpython-312.pyc,,
requests/__pycache__/utils.cpython-312.pyc,,
requests/__version__.py,sha256=FVfglgZmNQnmYPXpOohDU58F5EUb_-VnSTaAesS187g,435
requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495
requests/adapters.py,sha256=KIcecscqam6reOCXRl4DwP4jX8Jcl8sd57ft17KR2cQ,27451
requests/api.py,sha256=_Zb9Oa7tzVIizTKwFrPjDEY9ejtm_OnSRERnADxGsQs,6449
requests/auth.py,sha256=kF75tqnLctZ9Mf_hm9TZIj4cQWnN5uxRz8oWsx5wmR0,10186
requests/certs.py,sha256=Z9Sb410Anv6jUFTyss0jFFhU6xst8ctELqfy8Ev23gw,429
requests/compat.py,sha256=C5w_DPLSurXPgcdWU78fora0APmbYkX2G89QvH5xzPA,1817
requests/cookies.py,sha256=bNi-iqEj4NPZ00-ob-rHvzkvObzN3lEpgw3g6paS3Xw,18590
requests/exceptions.py,sha256=jJPS1UWATs86ShVUaLorTiJb1SaGuoNEWgICJep-VkY,4260
requests/help.py,sha256=gPX5d_H7Xd88aDABejhqGgl9B1VFRTt5BmiYvL3PzIQ,3875
requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733
requests/models.py,sha256=k42roXzC8u_OagAPQi9U4MkfO7i4r2FdaqvMqstPehc,35418
requests/packages.py,sha256=_g0gZ681UyAlKHRjH6kanbaoxx2eAb6qzcXiODyTIoc,904
requests/sessions.py,sha256=ykTI8UWGSltOfH07HKollH7kTBGw4WhiBVaQGmckTw4,30495
requests/status_codes.py,sha256=iJUAeA25baTdw-6PfD0eF4qhpINDJRJI-yaMqxs4LEI,4322
requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912
requests/utils.py,sha256=HiQC6Nq_Da3ktaMiFzQkh-dCk3iQHHKEsYS5kDc-8Cw,33619
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.43.0)
Root-Is-Purelib: true
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"dir_info": {}, "url": "file:///croot/requests_1721410876868/work"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests
7 changes: 7 additions & 0 deletions tests/sample_projects/conda_example/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: conda_example
channels:
- defaults
dependencies:
- python=3.12
- requests
prefix: /home/user/.conda/envs/conda_example
24 changes: 24 additions & 0 deletions tests/sample_projects/conda_example/expected.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[project]
# General information about a simplified project: Its name, why we test it,
# its relation to real world projects
name = "conda_example"
description = "An example of a Conda project with default settings."

[experiments.default]
description = "Run fawltydeps with no options on entire project"

# 3rd-party imports found in the code:
imports = [
"requests", # main.py
]

# Declared dependencies found in the project configuration:
declared_deps = [
"requests", # Conda dependency
]

# Import names in the code that do not have a matching dependency declared:
undeclared_deps = []

# Declared dependencies which were never `import`ed from the code:
unused_deps = []
1 change: 1 addition & 0 deletions tests/sample_projects/conda_example/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import requests

0 comments on commit 7487261

Please sign in to comment.