8000 Use README as package long description · AmarisAI/python-stdnum@be094f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit be094f8

Browse files
committed
Use README as package long description
This also shortens the stdnum module docstring and updates the Sphinx configuration.
1 parent c576bc4 commit be094f8

File tree

6 files changed

+44
-174
lines changed

6 files changed

+44
-174
lines changed

README

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ python-stdnum
22
=============
33

44
A Python module to parse, validate and reformat standard numbers and codes
5-
in different formats.
5+
in different formats. It contains a large collection of number formats.
6+
7+
Basically any number or code that has some validation mechanism available
8+
or some common formatting is eligible for inclusion in this library.
9+
10+
https://arthurdejong.org/python-stdnum/
11+
612

713
Available formats
814
-----------------
@@ -152,17 +158,29 @@ and use of the specified numbers, only parsing and handling functions.
152158
Interface
153159
---------
154160

161+
All modules implement a common interface. For example for ISBN validation:
162+
163+
>>> from stdnum import isbn
164+
>>> isbn.validate('978-9024538270')
165+
'9789024538270'
166+
>>> isbn.validate('978-9024538271')
167+
Traceback (most recent call last):
168+
...
169+
InvalidChecksum: ...
170+
155171
Most of these modules implement the following functions:
156172

157-
validate() - validate the correctness of the passed number and return a
158-
compact representation of the number
159-
invalid numbers are rejected with one of the exceptions
160-
from the stdnum.exceptions module
161-
compact() - return a compact representation of the number or code
162-
this function generally does not do validation but may raise
163-
exceptions for wildly incorrect numbers
164-
format() - return a formatted version of the number in the preferred format
165-
this function generally expects to be passed a valid number or code
173+
* `validate()`
174+
validate the correctness of the passed number and return a compact
175+
representation of the number invalid numbers are rejected with one of the
176+
exceptions from the stdnum.exceptions module
177+
* `compact()`
178+
return a compact representation of the number or code this function
179+
generally does not do validation but may raise exceptions for wildly
180+
incorrect numbers
181+
* `format()`
182+
return a formatted version of the number in the preferred format this
183+
function generally expects to be passed a valid number or code
166184

167185
Apart from the above, the module may add extra parsing, validation or
168186
conversion functions.

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
# General information about the project.
4848
project = u'python-stdnum'
49-
copyright = u'2013, Arthur de Jong'
49+
copyright = u'2013-2017, Arthur de Jong'
5050

5151
# The version info for the project you're documenting, acts as replacement for
5252
# |version| and |release|, also used in various other places throughout the
@@ -69,7 +69,7 @@
6969

7070
# List of patterns, relative to source directory, that match files and
7171
# directories to ignore when looking for source files.
72-
exclude_patterns = ['_*', '.svn']
72+
exclude_patterns = ['_*', '.svn', '.git']
7373

7474
# The reST default role (used for this markup: `text`) to use for all documents.
7575
#default_role = None
@@ -132,7 +132,7 @@
132132

133133
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
134134
# using the given strftime format.
135-
html_last_updated_fmt = '%b %d, %Y'
135+
html_last_updated_fmt = '%Y-%m-%d'
136136

137137
# If true, SmartyPants will be used to convert quotes and dashes to
138138
# typographically correct entities.
@@ -189,3 +189,5 @@
189189

190190
# If true, show URL addresses after external links.
191191
#man_show_urls = False
192+
193+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}

docs/index.rst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
.. module:: stdnum
22

3-
python-stdnum
4-
=============
5-
6-
A Python module to parse, validate and reformat standard numbers and codes
7-
in different formats. It contains a large collection of number formats.
8-
9-
Basically any number or code that has some validation mechanism available
10-
or some common formatting is eligible for inclusion in this library.
11-
12-
https://arthurdejong.org/python-stdnum/
3+
.. include:: ../README
4+
:end-before: Available formats
135

146

157
Common Interface
@@ -26,8 +18,8 @@ Most of the number format modules implement the following functions:
2618

2719
.. function:: is_valid(number)
2820

29-
Return either True or False depending on whether the passed number is
30-
in any supported and valid form and passes all embedded checks of the
21+
Return either ``True`` or ``False`` depending on whether the passed number
22+
is in any supported and valid form and passes all embedded checks of the
3123
number. This function should never raise an exception.
3224

3325
.. function:: compact(number)

getnumlist.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# getnumlist.py - script to get a list of number formats in stdnum
44
#
5-
# Copyright (C) 2012-2016 Arthur de Jong
5+
# Copyright (C) 2012-2017 Arthur de Jong
66
#
77
# This library is free software; you can redistribute it and/or
88
# modify it under the terms of the GNU Lesser General Public
@@ -45,14 +45,6 @@ def get_number_modules():
4545
for module in get_number_modules():
4646
print ' * %s' % util.get_module_name(module)
4747
print ''
48-
print 'For stdnum/__init__.py:'
49-
print ''
50-
for module in get_number_modules():
51-
print '* %s: %s' % (
52-
module.__name__.replace('stdnum.', ''),
53-
util.get_module_name(module),
54-
)
55-
print ''
5648
print 'For docs/index.rst:'
5749
print ''
5850
for module in get_number_modules():

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@
3232
os.system('chmod -R a+rX .')
3333
os.umask(int('022', 8))
3434

35+
base_dir = os.path.dirname(__file__)
36+
37+
with open(os.path.join(base_dir, 'README'), 'r') as fp:
38+
long_description = fp.read()
39+
3540
setup(name='python-stdnum',
3641
version=stdnum.__version__,
3742
description='Python module to handle standardized numbers and codes',
38-
long_description=stdnum.__doc__,
43+
long_description=long_description,
3944
author='Arthur de Jong',
4045
author_email='arthur@arthurdejong.org',
4146
url='https://arthurdejong.org/python-stdnum/',

stdnum/__init__.py

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -23,145 +23,6 @@
2323
This library offers functions for parsing, validating and reformatting
2424
standard numbers and codes in various formats.
2525
26-
Currently this package supports the following formats:
27-
28-
* al.nipt: NIPT (Numri i Identifikimit për Personin e Tatueshëm, Albanian VAT number)
29-
* ar.cbu: CBU (Clave Bancaria Uniforme, Argentine bank account number)
30-
* ar.cuit: CUIT (Código Único de Identificación Tributaria, Argentinian tax number)
31-
* at.businessid: Austrian Company Register Numbers
32-
* at.uid: UID (Umsatzsteuer-Identifikationsnummer, Austrian VAT number)
33-
* au.abn: ABN (Australian Business Number)
34-
* au.acn: ACN (Australian Company Number)
35-
* au.tfn: TFN (Australian Tax File Number)
36-
* be.vat: BTW, TVA, NWSt, ondernemingsnummer (Belgian enterprise number)
37-
* bg.egn: EGN (ЕГН, Единен граждански номер, Bulgarian personal identity codes)
38-
* bg.pnf: PNF (ЛНЧ, Личен номер на чужденец, Bulgarian number of a foreigner)
39-
* bg.vat: VAT (Идентификационен номер по ДДС, Bulgarian VAT number)
40-
* br.cnpj: CNPJ (Cadastro Nacional da Pessoa Jurídica, Brazillian company identifier)
41-
* br.cpf: CPF (Cadastro de Pessoas Físicas, Brazillian national identifier)
42-
* ca.bn: BN (Canadian Business Number)
43-
* ca.sin: SIN (Canadian Social Insurance Number)
44-
* ch.ssn: Swiss social security number ("Sozialversicherungsnummer")
45-
* ch.uid: UID (Unternehmens-Identifikationsnummer, Swiss business identifier)
46-
* ch.vat: VAT, MWST, TVA, IVA, TPV (Mehrwertsteuernummer, the Swiss VAT number)
47-
* cl.rut: RUT (Rol Único Tributario, Chilean national tax number)
48-
* cn.ric: RIC No. (Chinese Resident Identity Card Number)
49-
* co.nit: NIT (Número De Identificación Tributaria, Colombian identity code)
50-
* cusip: CUSIP number (financial security identification number)
51-
* cy.vat: Αριθμός Εγγραφής Φ.Π.Α. (Cypriot VAT number)
52-
* cz.dic: DIČ (Daňové identifikační číslo, Czech VAT number)
53-
* cz.rc: RČ (Rodné číslo, the Czech birth number)
54-
* de.idnr: IdNr (Steuerliche Identifikationsnummer, German personal tax number)
55-
* de.vat: Ust ID Nr. (Umsatzsteur Identifikationnummer, German VAT number)
56-
* de.wkn: Wertpapierkennnummer (German securities identification code)
57-
* dk.cpr: CPR (personnummer, the Danish citizen number)
58-
* dk.cvr: CVR (Momsregistreringsnummer, Danish VAT number)
59-
* do.cedula: Cedula (Dominican Republic national identification number)
60-
* do.rnc: RNC (Registro Nacional del Contribuyente, Dominican Republic tax number)
61-
* ean: EAN (International Article Number)
62-
* ec.ci: CI (Cédula de identidad, Ecuadorian personal identity code)
63-
* ec.ruc: RUC (Registro Único de Contribuyentes, Ecuadorian company tax number)
64-
* ee.ik: Isikukood (Estonian Personcal ID number)
65-
* ee.kmkr: KMKR (Käibemaksukohuslase, Estonian VAT number)
66-
* ee.registrikood: Registrikood (Estonian organisation registration code)
67-
* es.ccc: CCC (Código Cuenta Corriente, Spanish Bank Account Code)
68-
* es.cif: CIF (Certificado de Identificación Fiscal, Spanish company tax number)
69-
* es.cups: CUPS (Código Unificado de Punto de Suministro, Supply Point Unified Code)
70-
* es.dni: DNI (Documento nacional de identidad, Spanish personal identity codes)
71-
* es.iban: Spanish IBAN (International Bank Account Number)
72-
* es.nie: NIE (Número de Identificación de Extranjeros, Spanish foreigner number)
73-
* es.nif: NIF (Número de Identificación Fiscal, Spanish VAT number)
74-
* es.referenciacatastral: Referencia Catastral (Spanish real estate property id)
75-
* eu.at_02: SEPA Identifier of the Creditor (AT-02)
76-
* eu.eic: EIC (European Energy Identification Code)
77-
* eu.nace: NACE (classification for businesses in the European Union)
78-
* eu.vat: VAT (European Union VAT number)
79-
* fi.alv: ALV nro (Arvonlisäveronumero, Finnish VAT number)
80-
* fi.associationid: Finnish Association Identifier
81-
* fi.hetu: HETU (Henkilötunnus, Finnish personal identity code)
82-
* fi.veronumero: Veronumero (Finnish individual tax number)
83-
* fi.ytunnus: Y-tunnus (Finnish business identifier)
84-
* fr.nif: NIF (Numéro d'Immatriculation Fiscale, French tax identification number)
85-
* fr.nir: NIR (French personal identification number)
86-
* fr.siren: SIREN (a French company identification number)
87-
* fr.siret: SIRET (a French company establishment identification number)
88-
* fr.tva: n° TVA (taxe sur la valeur ajoutée, French VAT number)
89-
* gb.nhs: NHS (United Kingdom National Health Service patient identifier)
90-
* gb.sedol: SEDOL number (Stock Exchange Daily Official List number)
91-
* gb.upn: UPN (English Unique Pupil Number)
92-
* gb.vat: VAT (United Kingdom (and Isle of Man) VAT registration number)
93-
* gr.vat: FPA, ΦΠΑ, ΑΦΜ (Αριθμός Φορολογικού Μητρώου, the Greek VAT number)
94-
* grid: GRid (Global Release Identifier)
95-
* hr.oib: OIB (Osobni identifikacijski broj, Croatian identification number)
96-
* hu.anum: ANUM (Közösségi adószám, Hungarian VAT number)
97-
* iban: IBAN (International Bank Account Number)
98-
* ie.pps: PPS No (Personal Public Service Number, Irish personal number)
99-
* ie.vat: VAT (Irish tax reference number)
100-
* imei: IMEI (International Mobile Equipment Identity)
101-
* imo: IMO number (International Maritime Organization number)
102-
* imsi: IMSI (International Mobile Subscriber Identity)
103-
* is_.kennitala: Kennitala (Icelandic personal and organisation identity code)
104-
* is_.vsk: VSK number (Virðisaukaskattsnúmer, Icelandic VAT number)
105-
* isan: ISAN (International Standard Audiovisual Number)
106-
* isbn: ISBN (International Standard Book Number)
107-
* isil: ISIL (International Standard Identifier for Libraries)
108-
* isin: ISIN (International Securities Identification Number)
109-
* ismn: ISMN (International Standard Music Number)
110-
* iso6346: ISO 6346 (International standard for container identification)
111-
* iso9362: ISO 9362 (Business identifier codes)
112-
* issn: ISSN (International Standard Serial Number)
113-
* it.codicefiscale: Codice Fiscale (Italian tax code for individuals)
114-
* it.iva: Partita IVA (Italian VAT number)
115-
* lei: LEI (Legal Entity Identifier)
116-
* lt.pvm: PVM (Pridėtinės vertės mokestis mokėtojo kodas, Lithuanian VAT number)
117-
* lu.tva: TVA (taxe sur la valeur ajoutée, Luxembourgian VAT number)
118-
* lv.pvn: PVN (Pievienotās vērtības nodokļa, Latvian VAT number)
119-
* mc.tva: n° TVA (taxe sur la valeur ajoutée, Monacan VAT number)
120-
* meid: MEID (Mobile Equipment Identifier)
121-
* mt.vat: VAT (Maltese VAT number)
122-
* mx.rfc: RFC (Registro Federal de Contribuyentes, Mexican tax number)
123-
* my.nric: NRIC No. (Malaysian National Registration Identity Card Number)
124-
* nl.brin: Brin number (Dutch number for schools)
125-
* nl.bsn: BSN (Burgerservicenummer, Dutch national identification number)
126-
* nl.btw: BTW-nummer (Omzetbelastingnummer, the Dutch VAT number)
127-
* nl.onderwijsnummer: Onderwijsnummer (Dutch student school number)
128-
* nl.postcode: Postcode (Dutch postal code)
129-
* no.mva: MVA (Merverdiavgift, Norwegian VAT number)
130-
* no.orgnr: Orgnr (Organisasjonsnummer, Norwegian organisation number)
131-
* pl.nip: NIP (Numer Identyfikacji Podatkowej, Polish VAT number)
132-
* pl.pesel: PESEL (Polish national identification number)
133-
* pl.regon: REGON (Rejestr Gospodarki Narodowej, Polish register of economic units)
134-
* pt.nif: NIF (Número de identificação fiscal, Portuguese VAT number)
135-
* ro.cf: CF (Cod de înregistrare în scopuri de TVA, Romanian VAT number)
136-
* ro.cnp: CNP (Cod Numeric Personal, Romanian Numerical Personal Code)
137-
* rs.pib: PIB (Poreski Identifikacioni Broj, Serbian tax identification number)
138-
* ru.inn: ИНН (Идентификационный номер налогоплательщика, Russian tax identifier)
139-
* se.orgnr: Orgnr (Organisationsnummer, Swedish company number)
140-
* se.vat: VAT (Moms, Mervärdesskatt, Swedish VAT number)
141-
* si.ddv: ID za DDV (Davčna številka, Slovenian VAT number)
142-
* sk.dph: IČ DPH (IČ pre daň z pridanej hodnoty, Slovak VAT number)
143-
* sk.rc: RČ (Rodné číslo, the Slovak birth number)
144-
* sm.coe: COE (Codice operatore economico, San Marino national tax number)
145-
* tr.tckimlik: T.C. Kimlik No. (Turkish personal identification number)
146-
* us.atin: ATIN (U.S. Adoption Taxpayer Identification Number)
147-
* us.ein: EIN (U.S. Employer Identification Number)
148-
* us.itin: ITIN (U.S. Individual Taxpayer Identification Number)
149-
* us.ptin: PTIN (U.S. Preparer Tax Identification Number)
150-
* us.rtn: RTN (Routing transport number)
151-
* us.ssn: SSN (U.S. Social Security Number)
152-
* us.tin: TIN (U.S. Taxpayer Identification Number)
153-
154-
Furthermore a number of generic check digit algorithms are available:
155-
156-
* damm: The Damm algorithm
157-
* iso7064.mod_11_10: The ISO 7064 Mod 11, 10 algorithm
158-
* iso7064.mod_11_2: The ISO 7064 Mod 11, 2 algorithm
159-
* iso7064.mod_37_2: The ISO 7064 Mod 37, 2 algorithm
160-
* iso7064.mod_37_36: The ISO 7064 Mod 37, 36 algorithm
161-
* iso7064.mod_97_10: The ISO 7064 Mod 97, 10 algorithm
162 546B -
* luhn: The Luhn and Luhn mod N algorithms
163-
* verhoeff: The Verhoeff algorithm
164-
16526
All modules implement a common interface:
16627
16728
>>> from stdnum import isbn

0 commit comments

Comments
 (0)
0