Skip to content

Commit e2308f2

Browse files
authored
Update distribution-package-vs-import-package.rst
Awesome! Here's an extended version of each section in your SBI Safe Use Guide & Schemes, written in detail and ready to be used in your PDF via code or documents.
1 parent bde76e7 commit e2308f2

File tree

1 file changed

+56
-110
lines changed

1 file changed

+56
-110
lines changed
Lines changed: 56 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,56 @@
1-
.. _distribution-package-vs-import-package:
2-
3-
=======================================
4-
Distribution package vs. import package
5-
=======================================
6-
7-
A number of different concepts are commonly referred to by the word
8-
"package". This page clarifies the differences between two distinct but
9-
related meanings in Python packaging, "distribution package" and "import
10-
package".
11-
12-
What's a distribution package?
13-
==============================
14-
15-
A distribution package is a piece of software that you can install.
16-
Most of the time, this is synonymous with "project". When you type ``pip
17-
install pkg``, or when you write ``dependencies = ["pkg"]`` in your
18-
``pyproject.toml``, ``pkg`` is the name of a distribution package. When
19-
you search or browse the PyPI_, the most widely known centralized source for
20-
installing Python libraries and tools, what you see is a list of distribution
21-
packages. Alternatively, the term "distribution package" can be used to
22-
refer to a specific file that contains a certain version of a project.
23-
24-
Note that in the Linux world, a "distribution package",
25-
most commonly abbreviated as "distro package" or just "package",
26-
is something provided by the system package manager of the `Linux distribution <distro_>`_,
27-
which is a different meaning.
28-
29-
30-
What's an import package?
31-
=========================
32-
33-
An import package is a Python module. Thus, when you write ``import
34-
pkg`` or ``from pkg import func`` in your Python code, ``pkg`` is the
35-
name of an import package. More precisely, import packages are special
36-
Python modules that can contain submodules. For example, the ``numpy``
37-
package contains modules like ``numpy.linalg`` and
38-
``numpy.fft``. Usually, an import package is a directory on the file
39-
system, containing modules as ``.py`` files and subpackages as
40-
subdirectories.
41-
42-
You can use an import package as soon as you have installed a distribution
43-
package that provides it.
44-
45-
46-
What are the links between distribution packages and import packages?
47-
=====================================================================
48-
49-
Most of the time, a distribution package provides one single import
50-
package (or non-package module), with a matching name. For example,
51-
``pip install numpy`` lets you ``import numpy``.
52-
53-
However, this is only a convention. PyPI and other package indices *do not
54-
enforce any relationship* between the name of a distribution package and the
55-
import packages it provides. (A consequence of this is that you cannot blindly
56-
install the PyPI package ``foo`` if you see ``import foo``; this may install an
57-
unintended, and potentially even malicious package.)
58-
59-
A distribution package could provide an import package with a different
60-
name. An example of this is the popular Pillow_ library for image
61-
processing. Its distribution package name is ``Pillow``, but it provides
62-
the import package ``PIL``. This is for historical reasons: Pillow
63-
started as a fork of the PIL library, thus it kept the import name
64-
``PIL`` so that existing PIL users could switch to Pillow with little
65-
effort. More generally, a fork of an existing library is a common reason
66-
for differing names between the distribution package and the import
67-
package.
68-
69-
On a given package index (like PyPI), distribution package names must be
70-
unique. On the other hand, import packages have no such requirement.
71-
Import packages with the same name can be provided by several
72-
distribution packages. Again, forks are a common reason for this.
73-
74-
Conversely, a distribution package can provide several import packages,
75-
although this is less common. An example is the attrs_ distribution
76-
package, which provides both an ``attrs`` import package with a newer
77-
API, and an ``attr`` import package with an older but supported API.
78-
79-
80-
How do distribution package names and import package names compare?
81-
===================================================================
82-
83-
Import packages should have valid Python identifiers as their name (the
84-
:ref:`exact rules <python:identifiers>` are found in the Python
85-
documentation) [#non-identifier-mod-name]_. In particular, they use underscores ``_`` as word
86-
separator and they are case-sensitive.
87-
88-
On the other hand, distribution packages can use hyphens ``-`` or
89-
underscores ``_``. They can also contain dots ``.``, which is sometimes
90-
used for packaging a subpackage of a :ref:`namespace package
91-
<packaging-namespace-packages>`. For most purposes, they are insensitive
92-
to case and to ``-`` vs. ``_`` differences, e.g., ``pip install
93-
Awesome_Package`` is the same as ``pip install awesome-package`` (the
94-
precise rules are given in the :ref:`name normalization specification
95-
<name-normalization>`).
96-
97-
98-
99-
---------------------------
100-
101-
.. [#non-identifier-mod-name] Although it is technically possible
102-
to import packages/modules that do not have a valid Python identifier as
103-
their name, using :doc:`importlib <python:library/importlib>`,
104-
this is vanishingly rare and strongly discouraged.
105-
106-
107-
.. _distro: https://en.wikipedia.org/wiki/Linux_distribution
108-
.. _PyPI: https://pypi.org
109-
.. _Pillow: https://pypi.org/project/Pillow
110-
.. _attrs: https://pypi.org/project/attrs
1+
from fpdf import FPDF
2+
3+
class PDF(FPDF):
4+
def header(self):
5+
self.set_font("Arial", "B", 14)
6+
self.cell(0, 10, "SBI Safe Use Guide & Schemes (Uttarakhand)", ln=True, align="C")
7+
self.ln(5)
8+
9+
def chapter_title(self, title):
10+
self.set_font("Arial", "B", 12)
11+
self.set_text_color(0)
12+
self.cell(0, 10, title, ln=True)
13+
self.ln(2)
14+
15+
def chapter_body(self, body):
16+
self.set_font("Arial", "", 11)
17+
self.multi_cell(0, 8, body)
18+
self.ln()
19+
20+
pdf = PDF()
21+
pdf.add_page()
22+
23+
# Section: Checklist
24+
pdf.chapter_title("Safe Use Checklist:")
25+
pdf.chapter_body("""1. Check account type (Regular / Jan Dhan / Salary / Pension) - different balance rules and benefits.
26+
2. Check debit card charges - deactivate if not in use.
27+
3. SMS alert fee: ₹15/quarter - keep only basic alerts.
28+
4. Turn off International Usage unless needed.
29+
5. Review Auto Debit / ECS Mandates - remove inactive ones.
30+
6. Avoid Dormant status - make at least 1 transaction per year.""")
31+
32+
# Section: Services to Deactivate
33+
pdf.chapter_title("Services to Deactivate:")
34+
pdf.chapter_body("""- Unused insurance plans
35+
- Extra ATM cards
36+
- Old ECS/NACH mandates not in use
37+
- Services activated without consent (like accidental cover)""")
38+
39+
# Section: SBI Schemes
40+
pdf.chapter_title("Recommended SBI Schemes:")
41+
pdf.chapter_body("""1. SBI Amrit Kalash FD - 400 days, ~7.10% interest
42+
2. SBI Sarvottam Term Deposit - floating rate
43+
3. SBI Annuity Deposit Scheme - monthly income like pension
44+
4. SBI Tax Saver FD - 5 year lock-in, ₹1.5 lakh 80C tax benefit
45+
5. SBI Recurring Deposit - monthly savings
46+
6. SBI Floating Rate Bonds - 7.15% interest
47+
7. SBI Mutual Funds - low to medium risk investment options""")
48+
49+
# Section: Uttarakhand Tips
50+
pdf.chapter_title("Uttarakhand Specific Tips:")
51+
pdf.chapter_body("""- Ask your branch about PM schemes (PM Kisan, PMJJBY, Ayushman)
52+
- Use SBI Mitra or CSP agents for local services in villages
53+
- Use YONO or Net Banking to manage services yourself""")
54+
55+
# Save PDF
56+
pdf.output("sbi_safe_use_guide.pdf")

0 commit comments

Comments
 (0)