├── .github ├── FUNDING.yml └── workflows │ └── python-package.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── assets ├── vizel_banner@2x.jpg └── vizel_demo.gif ├── poetry.lock ├── pyproject.toml ├── tests ├── .cache │ └── v │ │ └── cache │ │ └── lastfailed ├── __init__.py ├── data │ ├── zettelkasten_md │ │ ├── 03242020003215-eda-explained.md │ │ ├── 03272020061037-electrodermal-activity.md │ │ ├── 202002241029_Broken_references_Zettel.md │ │ ├── 202002251025_This_is_the_first_test_zettel.md │ │ ├── 202003211727_This_is_the_second_test_zettel.md │ │ ├── 202005011017_All_by_myself.md │ │ └── 202006112225_broken_utf8.md │ └── zettelkasten_txt │ │ ├── 03242020003215-eda-explained.txt │ │ ├── 03272020061037-electrodermal-activity.txt │ │ ├── 202002241029_Broken_references_Zettel.txt │ │ ├── 202002251025_This_is_the_first_test_zettel.txt │ │ ├── 202003211727_This_is_the_second_test_zettel.txt │ │ ├── 202005011017_All_by_myself.txt │ │ └── 202006112225_broken_utf8.txt └── test_vizel.py └── vizel ├── __init__.py └── cli.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: BasilPH 2 | 3 | -------------------------------------------------------------------------------- /.github/workflows/python-package.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 3 | 4 | name: Python package 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"] 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v2 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - uses: psf/black@stable 28 | with: 29 | options: "--check --verbose" 30 | - name: Install dependencies 31 | run: | 32 | python -m pip install --upgrade pip 33 | python -m pip install poetry 34 | sudo apt-get update 35 | sudo apt-get -y install graphviz 36 | poetry install 37 | - name: Test with pytest 38 | run: | 39 | poetry run pytest 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | 4 | .pytest_cache 5 | __pycache__ 6 | dist 7 | vizel.egg-info/ 8 | 9 | *.pyc 10 | .python-version 11 | 12 | vizel_graph.pdf 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "2.7" 5 | - "3.5" 6 | - "3.6" 7 | - "3.7" 8 | - "3.8" 9 | 10 | before_install: 11 | - sudo apt-get update 12 | - sudo apt-get -y install graphviz 13 | - pip install poetry 14 | 15 | install: poetry install 16 | 17 | script: pytest 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Vizel](assets/vizel_banner@2x.jpg) 2 | 3 | [![Build Status](https://travis-ci.com/BasilPH/vizel.svg?branch=master)](https://travis-ci.com/BasilPH/vizel) 4 | 5 | See the stats and connections of your Zettelkasten. 6 | 7 | ![Demo](assets/vizel_demo.gif) 8 | 9 | ## Getting Started 10 | 11 | ### Required Zettelkasten structure 12 | 13 | Vizel tries to be format agnostic without requiring configuration. 14 | 15 | Vizel makes the following assumptions: 16 | 17 | * The Zettel files have an `.md` or `.txt` extension. 18 | * All Zettel are in one single directory. 19 | * References use the `[[REFERENCE]]` or `[LABEL](REFERENCE)` format. 20 | * References of a Zettel pointing to itself are ignored. 21 | 22 | Vizel was first developed for the format used by the 23 | [The Archive](https://zettelkasten.de/the-archive/). Other formats are 24 | now supported as well, thanks to the help from the community. 25 | 26 | ### Installing 27 | 28 | Run `pip install vizel`. Vizel supports Python 2.7 and 3.6 - 3.10. 29 | 30 | If you get an error about missing graphviz when running the `graph-pdf` 31 | command, you might need to install it with 32 | 33 | ` brew install graphviz` on OS X or 34 | 35 | `sudo apt-get install graphviz` on Ubuntu. 36 | 37 | ## Usage 38 | 39 | `vizel` has the following commands: 40 | 41 | #### graph-pdf 42 | 43 | ``` 44 | vizel graph-pdf [OPTIONS] DIRECTORY 45 | 46 | Generates a PDF displaying the graph created spanned by Zettel and their connections in the folder DIRECTORY. 47 | 48 | Options: 49 | --pdf-name TEXT Name of the PDF file the graph is written into. Default: 50 | vizel_graph 51 | --help Show this message and exit. 52 | ``` 53 | 54 | #### stats 55 | 56 | ``` 57 | 58 | Usage: vizel stats [OPTIONS] DIRECTORY 59 | 60 | Prints the stats of the graph spanned by Zettel in DIRECTORY. 61 | 62 | Stats calculated: 63 | - Number of Zettel 64 | - Number of references between Zettel (including bi-directional and duplicate) 65 | - Number of Zettel without any reference from or to a Zettel 66 | - Number of connected components 67 | 68 | Options: 69 | -q, --quiet Quiet mode 70 | --help Show this message and exit. 71 | ``` 72 | 73 | ##### A note on connected components 74 | 75 | The fewer connected components your Zettelkasten has, the better. The 76 | ideal number is 1. It means that you can reach any Zettel by following 77 | links. This, in turn, should increase the likelihood of making new 78 | semantic connections. 79 | 80 | Connected components are a concept from graph theory. In the context of 81 | a Zettelkasten and vizel, a connected component is a set of Zettel, 82 | which can be reached from any other Zettel in the same component by 83 | following links. Those links do not need to be direct but can pass 84 | through other Zettel. The direction of the links also doesn't matter. 85 | 86 | Two Zettel are not in the same component if there is no way to reach one 87 | from the other through links. 88 | 89 | Connected components will show up as separate clusters of Zettel when 90 | using `graph-pdf`. Use the `components` command to get a list of your 91 | components, and the Zettel contained in each. 92 | 93 | #### unconnected 94 | 95 | ``` 96 | Usage: vizel unconnected [OPTIONS] DIRECTORY 97 | 98 | Prints all of the Zettel in DIRECTORY that have no in- or outgoing 99 | references. 100 | 101 | Options: 102 | -q, --quiet Quiet mode 103 | --help Show this message and exit. 104 | ``` 105 | 106 | #### components 107 | 108 | ``` 109 | Usage: vizel components [OPTIONS] DIRECTORY 110 | 111 | Lists the connected components and their Zettel in DIRECTORY. 112 | 113 | Options: 114 | -q, --quiet Quiet mode 115 | --help Show this message and exit. 116 | ``` 117 | 118 | ## Built With 119 | 120 | * [NetworkX](https://networkx.github.io/): Network analysis in Python 121 | * [click](https://click.palletsprojects.com): Python composable 122 | command-line interface toolkit 123 | * [Graphviz](https://github.com/xflr6/graphviz): Simple Python interface 124 | for Graphviz 125 | 126 | ## Updates & Contributing 127 | 128 | Feel free to open issues and pull-requests. Subscribe to the 129 | [vizel newsletter](https://tinyletter.com/vizel) to be informed about 130 | new releases and features in development. 131 | 132 | You can reach out to me for feedback or questions on 133 | [Twitter](https://twitter.com/BasilPH) or through 134 | [my website](https://interdimensional-television.com/). 135 | 136 | If you've found vizel useful, please consider 137 | [sponsoring](https://github.com/sponsors/BasilPH) maintenance and 138 | further development. Or 139 | [buying me a coffee](https://www.buymeacoffee.com/interdimension). 140 | 141 | 142 | ### Development install 143 | 144 | The project uses [Poetry](https://python-poetry.org/). 145 | 146 | 1. Install Poetry. 147 | 2. Clone this repository. 148 | 3. Run `poetry install` in the root of this project. 149 | 150 | ### Running tests 151 | 152 | Run `py.test` in the `tests` directory. 153 | 154 | 155 | ## Versioning 156 | 157 | Vizel uses [SemVer](http://semver.org/) for versioning. For the versions 158 | available, see the 159 | [tags on the repository](https://github.com/BasilPH/vizel/tags). 160 | 161 | ## Authors 162 | 163 | * **Basil Philipp** - *Owner* 164 | 165 | ## License 166 | 167 | This project is licensed under GNU GPLv3. 168 | 169 | ## Acknowledgments 170 | 171 | * Thank you Christian Tietze and Sascha Fast for creating 172 | [The Archive](https://zettelkasten.de/the-archive/) app and writing a 173 | [book](https://zettelkasten.de/book/de/) (German only) on the 174 | Zettelkasten method. 175 | 176 | -------------------------------------------------------------------------------- /assets/vizel_banner@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BasilPH/vizel/21415d2913b0f6df34171f6120c6c37602f60c49/assets/vizel_banner@2x.jpg -------------------------------------------------------------------------------- /assets/vizel_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BasilPH/vizel/21415d2913b0f6df34171f6120c6c37602f60c49/assets/vizel_demo.gif -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "atomicwrites" 3 | version = "1.4.0" 4 | description = "Atomic file writes." 5 | category = "dev" 6 | optional = false 7 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 8 | 9 | [[package]] 10 | name = "attrs" 11 | version = "21.2.0" 12 | description = "Classes Without Boilerplate" 13 | category = "dev" 14 | optional = false 15 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 16 | 17 | [package.extras] 18 | dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] 19 | docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] 20 | tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] 21 | tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] 22 | 23 | [[package]] 24 | name = "backports.functools-lru-cache" 25 | version = "1.6.4" 26 | description = "Backport of functools.lru_cache" 27 | category = "dev" 28 | optional = false 29 | python-versions = ">=2.6" 30 | 31 | [package.extras] 32 | docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] 33 | testing = ["pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-mypy", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-checkdocs (>=2.4)"] 34 | 35 | [[package]] 36 | name = "click" 37 | version = "7.1.2" 38 | description = "Composable command line interface toolkit" 39 | category = "main" 40 | optional = false 41 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 42 | 43 | [[package]] 44 | name = "colorama" 45 | version = "0.4.4" 46 | description = "Cross-platform colored terminal text." 47 | category = "dev" 48 | optional = false 49 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 50 | 51 | [[package]] 52 | name = "configparser" 53 | version = "4.0.2" 54 | description = "Updated configparser from Python 3.7 for Python 2.6+." 55 | category = "dev" 56 | optional = false 57 | python-versions = ">=2.6" 58 | 59 | [package.extras] 60 | docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] 61 | testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2)", "pytest-flake8", "pytest-black-multipy"] 62 | 63 | [[package]] 64 | name = "contextlib2" 65 | version = "0.6.0.post1" 66 | description = "Backports and enhancements for the contextlib module" 67 | category = "dev" 68 | optional = false 69 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 70 | 71 | [[package]] 72 | name = "decorator" 73 | version = "4.4.2" 74 | description = "Decorators for Humans" 75 | category = "main" 76 | optional = false 77 | python-versions = ">=2.6, !=3.0.*, !=3.1.*" 78 | 79 | [[package]] 80 | name = "decorator" 81 | version = "5.1.0" 82 | description = "Decorators for Humans" 83 | category = "main" 84 | optional = false 85 | python-versions = ">=3.5" 86 | 87 | [[package]] 88 | name = "funcsigs" 89 | version = "1.0.2" 90 | description = "Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+" 91 | category = "dev" 92 | optional = false 93 | python-versions = "*" 94 | 95 | [[package]] 96 | name = "graphviz" 97 | version = "0.13.2" 98 | description = "Simple Python interface for Graphviz" 99 | category = "main" 100 | optional = false 101 | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" 102 | 103 | [package.extras] 104 | dev = ["tox (>=3.0)", "flake8", "pep8-naming", "wheel", "twine"] 105 | docs = ["sphinx (>=1.7)", "sphinx-rtd-theme"] 106 | test = ["mock (>=2)", "pytest (>=3.4,!=3.10.0)", "pytest-mock (>=1.8)", "pytest-cov"] 107 | 108 | [[package]] 109 | name = "importlib-metadata" 110 | version = "2.1.2" 111 | description = "Read metadata from Python packages" 112 | category = "dev" 113 | optional = false 114 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 115 | 116 | [package.dependencies] 117 | configparser = {version = ">=3.5", markers = "python_version < \"3\""} 118 | contextlib2 = {version = "*", markers = "python_version < \"3\""} 119 | pathlib2 = {version = "*", markers = "python_version < \"3\""} 120 | zipp = ">=0.5" 121 | 122 | [package.extras] 123 | docs = ["sphinx", "rst.linker"] 124 | testing = ["packaging", "pep517", "unittest2", "importlib-resources (>=1.3)"] 125 | 126 | [[package]] 127 | name = "importlib-metadata" 128 | version = "4.8.3" 129 | description = "Read metadata from Python packages" 130 | category = "dev" 131 | optional = false 132 | python-versions = ">=3.6" 133 | 134 | [package.dependencies] 135 | typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} 136 | zipp = ">=0.5" 137 | 138 | [package.extras] 139 | docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] 140 | perf = ["ipython"] 141 | testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] 142 | 143 | [[package]] 144 | name = "iniconfig" 145 | version = "1.1.1" 146 | description = "iniconfig: brain-dead simple config-ini parsing" 147 | category = "dev" 148 | optional = false 149 | python-versions = "*" 150 | 151 | [[package]] 152 | name = "more-itertools" 153 | version = "5.0.0" 154 | description = "More routines for operating on iterables, beyond itertools" 155 | category = "dev" 156 | optional = false 157 | python-versions = "*" 158 | 159 | [package.dependencies] 160 | six = ">=1.0.0,<2.0.0" 161 | 162 | [[package]] 163 | name = "networkx" 164 | version = "2.2" 165 | description = "Python package for creating and manipulating graphs and networks" 166 | category = "main" 167 | optional = false 168 | python-versions = "*" 169 | 170 | [package.dependencies] 171 | decorator = ">=4.3.0" 172 | 173 | [package.extras] 174 | all = ["numpy", "scipy", "pandas", "matplotlib", "pygraphviz", "pydot", "pyyaml", "gdal", "lxml", "nose"] 175 | gdal = ["gdal"] 176 | lxml = ["lxml"] 177 | matplotlib = ["matplotlib"] 178 | nose = ["nose"] 179 | numpy = ["numpy"] 180 | pandas = ["pandas"] 181 | pydot = ["pydot"] 182 | pygraphviz = ["pygraphviz"] 183 | pyyaml = ["pyyaml"] 184 | scipy = ["scipy"] 185 | 186 | [[package]] 187 | name = "networkx" 188 | version = "2.4" 189 | description = "Python package for creating and manipulating graphs and networks" 190 | category = "main" 191 | optional = false 192 | python-versions = ">=3.5" 193 | 194 | [package.dependencies] 195 | decorator = ">=4.3.0" 196 | 197 | [package.extras] 198 | all = ["numpy", "scipy", "pandas", "matplotlib", "pygraphviz", "pydot", "pyyaml", "gdal", "lxml", "pytest"] 199 | gdal = ["gdal"] 200 | lxml = ["lxml"] 201 | matplotlib = ["matplotlib"] 202 | numpy = ["numpy"] 203 | pandas = ["pandas"] 204 | pydot = ["pydot"] 205 | pygraphviz = ["pygraphviz"] 206 | pytest = ["pytest"] 207 | pyyaml = ["pyyaml"] 208 | scipy = ["scipy"] 209 | 210 | [[package]] 211 | name = "packaging" 212 | version = "20.9" 213 | description = "Core utilities for Python packages" 214 | category = "dev" 215 | optional = false 216 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 217 | 218 | [package.dependencies] 219 | pyparsing = ">=2.0.2" 220 | 221 | [[package]] 222 | name = "packaging" 223 | version = "21.3" 224 | description = "Core utilities for Python packages" 225 | category = "dev" 226 | optional = false 227 | python-versions = ">=3.6" 228 | 229 | [package.dependencies] 230 | pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" 231 | 232 | [[package]] 233 | name = "pathlib2" 234 | version = "2.3.6" 235 | description = "Object-oriented filesystem paths" 236 | category = "dev" 237 | optional = false 238 | python-versions = "*" 239 | 240 | [package.dependencies] 241 | scandir = {version = "*", markers = "python_version < \"3.5\""} 242 | six = "*" 243 | 244 | [[package]] 245 | name = "pluggy" 246 | version = "0.13.1" 247 | description = "plugin and hook calling mechanisms for python" 248 | category = "dev" 249 | optional = false 250 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 251 | 252 | [package.dependencies] 253 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 254 | 255 | [package.extras] 256 | dev = ["pre-commit", "tox"] 257 | 258 | [[package]] 259 | name = "pluggy" 260 | version = "1.0.0" 261 | description = "plugin and hook calling mechanisms for python" 262 | category = "dev" 263 | optional = false 264 | python-versions = ">=3.6" 265 | 266 | [package.dependencies] 267 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 268 | 269 | [package.extras] 270 | dev = ["pre-commit", "tox"] 271 | testing = ["pytest", "pytest-benchmark"] 272 | 273 | [[package]] 274 | name = "py" 275 | version = "1.11.0" 276 | description = "library with cross-python path, ini-parsing, io, code, log facilities" 277 | category = "dev" 278 | optional = false 279 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 280 | 281 | [[package]] 282 | name = "pyparsing" 283 | version = "2.4.7" 284 | description = "Python parsing module" 285 | category = "dev" 286 | optional = false 287 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 288 | 289 | [[package]] 290 | name = "pyparsing" 291 | version = "3.0.6" 292 | description = "Python parsing module" 293 | category = "dev" 294 | optional = false 295 | python-versions = ">=3.6" 296 | 297 | [package.extras] 298 | diagrams = ["jinja2", "railroad-diagrams"] 299 | 300 | [[package]] 301 | name = "pytest" 302 | version = "4.6.11" 303 | description = "pytest: simple powerful testing with Python" 304 | category = "dev" 305 | optional = false 306 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" 307 | 308 | [package.dependencies] 309 | atomicwrites = ">=1.0" 310 | attrs = ">=17.4.0" 311 | colorama = {version = "*", markers = "sys_platform == \"win32\" and python_version != \"3.4\""} 312 | funcsigs = {version = ">=1.0", markers = "python_version < \"3.0\""} 313 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 314 | more-itertools = [ 315 | {version = ">=4.0.0,<6.0.0", markers = "python_version <= \"2.7\""}, 316 | {version = ">=4.0.0", markers = "python_version > \"2.7\""}, 317 | ] 318 | packaging = "*" 319 | pathlib2 = {version = ">=2.2.0", markers = "python_version < \"3.6\""} 320 | pluggy = ">=0.12,<1.0" 321 | py = ">=1.5.0" 322 | six = ">=1.10.0" 323 | wcwidth = "*" 324 | 325 | [package.extras] 326 | testing = ["argcomplete", "hypothesis (>=3.56)", "nose", "requests", "mock"] 327 | 328 | [[package]] 329 | name = "pytest" 330 | version = "6.2.5" 331 | description = "pytest: simple powerful testing with Python" 332 | category = "dev" 333 | optional = false 334 | python-versions = ">=3.6" 335 | 336 | [package.dependencies] 337 | atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} 338 | attrs = ">=19.2.0" 339 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 340 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 341 | iniconfig = "*" 342 | packaging = "*" 343 | pluggy = ">=0.12,<2.0" 344 | py = ">=1.8.2" 345 | toml = "*" 346 | 347 | [package.extras] 348 | testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] 349 | 350 | [[package]] 351 | name = "scandir" 352 | version = "1.10.0" 353 | description = "scandir, a better directory iterator and faster os.walk()" 354 | category = "dev" 355 | optional = false 356 | python-versions = "*" 357 | 358 | [[package]] 359 | name = "six" 360 | version = "1.16.0" 361 | description = "Python 2 and 3 compatibility utilities" 362 | category = "main" 363 | optional = false 364 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" 365 | 366 | [[package]] 367 | name = "toml" 368 | version = "0.10.2" 369 | description = "Python Library for Tom's Obvious, Minimal Language" 370 | category = "dev" 371 | optional = false 372 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 373 | 374 | [[package]] 375 | name = "typing-extensions" 376 | version = "4.0.1" 377 | description = "Backported and Experimental Type Hints for Python 3.6+" 378 | category = "dev" 379 | optional = false 380 | python-versions = ">=3.6" 381 | 382 | [[package]] 383 | name = "wcwidth" 384 | version = "0.2.5" 385 | description = "Measures the displayed width of unicode strings in a terminal" 386 | category = "dev" 387 | optional = false 388 | python-versions = "*" 389 | 390 | [package.dependencies] 391 | "backports.functools-lru-cache" = {version = ">=1.2.1", markers = "python_version < \"3.2\""} 392 | 393 | [[package]] 394 | name = "zipp" 395 | version = "1.2.0" 396 | description = "Backport of pathlib-compatible object wrapper for zip files" 397 | category = "dev" 398 | optional = false 399 | python-versions = ">=2.7" 400 | 401 | [package.dependencies] 402 | contextlib2 = {version = "*", markers = "python_version < \"3.4\""} 403 | 404 | [package.extras] 405 | docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] 406 | testing = ["pathlib2", "unittest2", "jaraco.itertools", "func-timeout"] 407 | 408 | [[package]] 409 | name = "zipp" 410 | version = "3.6.0" 411 | description = "Backport of pathlib-compatible object wrapper for zip files" 412 | category = "dev" 413 | optional = false 414 | python-versions = ">=3.6" 415 | 416 | [package.extras] 417 | docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] 418 | testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] 419 | 420 | [metadata] 421 | lock-version = "1.1" 422 | python-versions = "^2.7 || ^3.6" 423 | content-hash = "a308c8da35af38160054f912f9a29f853c581d93ec3c7fc6f23a98362d16c425" 424 | 425 | [metadata.files] 426 | atomicwrites = [ 427 | {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, 428 | {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, 429 | ] 430 | attrs = [ 431 | {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"}, 432 | {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, 433 | ] 434 | "backports.functools-lru-cache" = [ 435 | {file = "backports.functools_lru_cache-1.6.4-py2.py3-none-any.whl", hash = "sha256:dbead04b9daa817909ec64e8d2855fb78feafe0b901d4568758e3a60559d8978"}, 436 | {file = "backports.functools_lru_cache-1.6.4.tar.gz", hash = "sha256:d5ed2169378b67d3c545e5600d363a923b09c456dab1593914935a68ad478271"}, 437 | ] 438 | click = [ 439 | {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, 440 | {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, 441 | ] 442 | colorama = [ 443 | {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, 444 | {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, 445 | ] 446 | configparser = [ 447 | {file = "configparser-4.0.2-py2.py3-none-any.whl", hash = "sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c"}, 448 | {file = "configparser-4.0.2.tar.gz", hash = "sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df"}, 449 | ] 450 | contextlib2 = [ 451 | {file = "contextlib2-0.6.0.post1-py2.py3-none-any.whl", hash = "sha256:3355078a159fbb44ee60ea80abd0d87b80b78c248643b49aa6d94673b413609b"}, 452 | {file = "contextlib2-0.6.0.post1.tar.gz", hash = "sha256:01f490098c18b19d2bd5bb5dc445b2054d2fa97f09a4280ba2c5f3c394c8162e"}, 453 | ] 454 | decorator = [ 455 | {file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"}, 456 | {file = "decorator-4.4.2.tar.gz", hash = "sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"}, 457 | {file = "decorator-5.1.0-py3-none-any.whl", hash = "sha256:7b12e7c3c6ab203a29e157335e9122cb03de9ab7264b137594103fd4a683b374"}, 458 | {file = "decorator-5.1.0.tar.gz", hash = "sha256:e59913af105b9860aa2c8d3272d9de5a56a4e608db9a2f167a8480b323d529a7"}, 459 | ] 460 | funcsigs = [ 461 | {file = "funcsigs-1.0.2-py2.py3-none-any.whl", hash = "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca"}, 462 | {file = "funcsigs-1.0.2.tar.gz", hash = "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"}, 463 | ] 464 | graphviz = [ 465 | {file = "graphviz-0.13.2-py2.py3-none-any.whl", hash = "sha256:241fb099e32b8e8c2acca747211c8237e40c0b89f24b1622860075d59f4c4b25"}, 466 | {file = "graphviz-0.13.2.zip", hash = "sha256:60acbeee346e8c14555821eab57dbf68a169e6c10bce40e83c1bf44f63a62a01"}, 467 | ] 468 | importlib-metadata = [ 469 | {file = "importlib_metadata-2.1.2-py2.py3-none-any.whl", hash = "sha256:cd6a92d78385dd145f5f233b3a6919acf5e8e43922aa9b9dbe78573e3540eb56"}, 470 | {file = "importlib_metadata-2.1.2.tar.gz", hash = "sha256:09db40742204610ef6826af16e49f0479d11d0d54687d0169ff7fddf8b3f557f"}, 471 | {file = "importlib_metadata-4.8.3-py3-none-any.whl", hash = "sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e"}, 472 | {file = "importlib_metadata-4.8.3.tar.gz", hash = "sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668"}, 473 | ] 474 | iniconfig = [ 475 | {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, 476 | {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, 477 | ] 478 | more-itertools = [ 479 | {file = "more-itertools-5.0.0.tar.gz", hash = "sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4"}, 480 | {file = "more_itertools-5.0.0-py2-none-any.whl", hash = "sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc"}, 481 | {file = "more_itertools-5.0.0-py3-none-any.whl", hash = "sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9"}, 482 | ] 483 | networkx = [ 484 | {file = "networkx-2.2.zip", hash = "sha256:45e56f7ab6fe81652fb4bc9f44faddb0e9025f469f602df14e3b2551c2ea5c8b"}, 485 | {file = "networkx-2.4-py3-none-any.whl", hash = "sha256:cdfbf698749a5014bf2ed9db4a07a5295df1d3a53bf80bf3cbd61edf9df05fa1"}, 486 | {file = "networkx-2.4.tar.gz", hash = "sha256:f8f4ff0b6f96e4f9b16af6b84622597b5334bf9cae8cf9b2e42e7985d5c95c64"}, 487 | ] 488 | packaging = [ 489 | {file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"}, 490 | {file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"}, 491 | {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, 492 | {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, 493 | ] 494 | pathlib2 = [ 495 | {file = "pathlib2-2.3.6-py2.py3-none-any.whl", hash = "sha256:3a130b266b3a36134dcc79c17b3c7ac9634f083825ca6ea9d8f557ee6195c9c8"}, 496 | {file = "pathlib2-2.3.6.tar.gz", hash = "sha256:7d8bcb5555003cdf4a8d2872c538faa3a0f5d20630cb360e518ca3b981795e5f"}, 497 | ] 498 | pluggy = [ 499 | {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, 500 | {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, 501 | {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, 502 | {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, 503 | ] 504 | py = [ 505 | {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, 506 | {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, 507 | ] 508 | pyparsing = [ 509 | {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, 510 | {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, 511 | {file = "pyparsing-3.0.6-py3-none-any.whl", hash = "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4"}, 512 | {file = "pyparsing-3.0.6.tar.gz", hash = "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"}, 513 | ] 514 | pytest = [ 515 | {file = "pytest-4.6.11-py2.py3-none-any.whl", hash = "sha256:a00a7d79cbbdfa9d21e7d0298392a8dd4123316bfac545075e6f8f24c94d8c97"}, 516 | {file = "pytest-4.6.11.tar.gz", hash = "sha256:50fa82392f2120cc3ec2ca0a75ee615be4c479e66669789771f1758332be4353"}, 517 | {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, 518 | {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, 519 | ] 520 | scandir = [ 521 | {file = "scandir-1.10.0-cp27-cp27m-win32.whl", hash = "sha256:92c85ac42f41ffdc35b6da57ed991575bdbe69db895507af88b9f499b701c188"}, 522 | {file = "scandir-1.10.0-cp27-cp27m-win_amd64.whl", hash = "sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac"}, 523 | {file = "scandir-1.10.0-cp34-cp34m-win32.whl", hash = "sha256:2c712840c2e2ee8dfaf36034080108d30060d759c7b73a01a52251cc8989f11f"}, 524 | {file = "scandir-1.10.0-cp34-cp34m-win_amd64.whl", hash = "sha256:2586c94e907d99617887daed6c1d102b5ca28f1085f90446554abf1faf73123e"}, 525 | {file = "scandir-1.10.0-cp35-cp35m-win32.whl", hash = "sha256:2b8e3888b11abb2217a32af0766bc06b65cc4a928d8727828ee68af5a967fa6f"}, 526 | {file = "scandir-1.10.0-cp35-cp35m-win_amd64.whl", hash = "sha256:8c5922863e44ffc00c5c693190648daa6d15e7c1207ed02d6f46a8dcc2869d32"}, 527 | {file = "scandir-1.10.0-cp36-cp36m-win32.whl", hash = "sha256:2ae41f43797ca0c11591c0c35f2f5875fa99f8797cb1a1fd440497ec0ae4b022"}, 528 | {file = "scandir-1.10.0-cp36-cp36m-win_amd64.whl", hash = "sha256:7d2d7a06a252764061a020407b997dd036f7bd6a175a5ba2b345f0a357f0b3f4"}, 529 | {file = "scandir-1.10.0-cp37-cp37m-win32.whl", hash = "sha256:67f15b6f83e6507fdc6fca22fedf6ef8b334b399ca27c6b568cbfaa82a364173"}, 530 | {file = "scandir-1.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d"}, 531 | {file = "scandir-1.10.0.tar.gz", hash = "sha256:4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae"}, 532 | ] 533 | six = [ 534 | {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, 535 | {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, 536 | ] 537 | toml = [ 538 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, 539 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, 540 | ] 541 | typing-extensions = [ 542 | {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, 543 | {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, 544 | ] 545 | wcwidth = [ 546 | {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, 547 | {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, 548 | ] 549 | zipp = [ 550 | {file = "zipp-1.2.0-py2.py3-none-any.whl", hash = "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921"}, 551 | {file = "zipp-1.2.0.tar.gz", hash = "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1"}, 552 | {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, 553 | {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, 554 | ] 555 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "vizel" 3 | version = "0.3.2-beta.1" 4 | description = "Vizualise a Zettelkasten" 5 | authors = ["Basil Philipp "] 6 | license = "GPL-3.0-only" 7 | readme = "README.md" 8 | homepage = "https://github.com/BasilPH/vizel" 9 | repository = "https://github.com/BasilPH/vizel" 10 | keywords = ["zettelkasten", "knowledge-management"] 11 | classifiers = [ 12 | "Environment :: Console", 13 | "Operating System :: OS Independent", 14 | "Natural Language :: English", 15 | "Topic :: Utilities", 16 | "Topic :: Text Processing", 17 | ] 18 | 19 | [tool.poetry.dependencies] 20 | python = "^2.7 || ^3.6" 21 | networkx = [ 22 | {version = "2.2", python="^2.7"}, 23 | {version = "2.4", python="^3.6"} 24 | ] 25 | click = "^7.1.1" 26 | graphviz = "^0.13.2" 27 | six="^1.14.0" 28 | 29 | [tool.poetry.dev-dependencies] 30 | pytest = [ 31 | {version = "^4.6", python="^2.7"}, 32 | {version = "*", python="^3.6"} 33 | ] 34 | 35 | [tool.poetry.scripts] 36 | vizel = 'vizel.cli:main' 37 | [build-system] 38 | requires = ["poetry>=0.12"] 39 | build-backend = "poetry.masonry.api" 40 | 41 | -------------------------------------------------------------------------------- /tests/.cache/v/cache/lastfailed: -------------------------------------------------------------------------------- 1 | { 2 | "test_vizel.py": true 3 | } -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BasilPH/vizel/21415d2913b0f6df34171f6120c6c37602f60c49/tests/__init__.py -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/03242020003215-eda-explained.md: -------------------------------------------------------------------------------- 1 | # EDA Explained 2 | 3 | 4 | This is a Test Zettel. 03272020061037-electrodermal-activity.md points at it with a markdown link. -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/03272020061037-electrodermal-activity.md: -------------------------------------------------------------------------------- 1 | --- 2 | bibliography: zettel.bib 3 | csl: ieee.csl 4 | nocite: | 5 | 6 | --- 7 | 8 | # Electrodermal Activity 9 | 10 | > **Date:** Mon 23 Mar 2020 11:51:54 PM UTC 11 | > 12 | > **Summary:** A summary of what electrodermal activity is and its use as a biomarker and use in signal processing. 13 | > 14 | > **Keywords:** ##summary ##signalprocessing ##healthcare #informatics #health #signalprocessing #signal #biomarker 15 | 16 | ## **Note Linked From:** 17 | 18 | ## Overview 19 | 20 | ### [What Is Electrodermal Activity?](03242020003215-eda-explained.md) 21 | - **Summary:** What electrodermal activity is and its pros and cons as a biomarker 22 | 23 | ### [Common Causes of Artifact in EDA Signals](03272020061037-eda-artifacts.md) 24 | - **Summary:** An overview of common artifacts in EDA signals 25 | 26 | 30 | 31 | --- 32 | --- 33 | 34 | Here we have to links on one line to test the regex. [A first link](202002251025_This_is_the_first_test_zettel.md) and a [second line](202003211727_This_is_the_second_test_zettel.md). 35 | 36 | 37 | ### **References:** -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/202002241029_Broken_references_Zettel.md: -------------------------------------------------------------------------------- 1 | # 202002241029 Broken references Zettel 2 | tags: #fun 3 | 4 | This Zettel references a Zettel that doesn't exist [[202005171153]]. 5 | 6 | It also uses a non-unique reference [[2020]]. 7 | 8 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/202002251025_This_is_the_first_test_zettel.md: -------------------------------------------------------------------------------- 1 | # 202002251025 This is the first test Zettel 2 | tags: #artificialintelligence #zettelkasten 3 | 4 | This Zettel references this other Zettel here[[202002241029]]. It points to the second Zettel [[202003211727]]. 5 | 6 | 7 | ## It also has subtitles, fancy 8 | Philosophically we address the need to recontextualize stories[^gaga]. 9 | 10 | ## And References 11 | [^gaga]: See https://gaga.lol 12 | 13 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/202003211727_This_is_the_second_test_zettel.md: -------------------------------------------------------------------------------- 1 | # 202003211727 This is the second test zettel 2 | tags: #artificialintelligence #zettelkasten 3 | 4 | The second Zettel references back to the first one[[202002251025]]. 5 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/202005011017_All_by_myself.md: -------------------------------------------------------------------------------- 1 | # 202005011017 All by myself 2 | tags: #lonely 3 | 4 | This Zettel is alone in the vast darkness of space. As we all are. 5 | 6 | Pointing at itself [[202005011017]]. 7 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_md/202006112225_broken_utf8.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BasilPH/vizel/21415d2913b0f6df34171f6120c6c37602f60c49/tests/data/zettelkasten_md/202006112225_broken_utf8.md -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/03242020003215-eda-explained.txt: -------------------------------------------------------------------------------- 1 | # EDA Explained 2 | 3 | 4 | This is a Test Zettel. 03272020061037-electrodermal-activity.txt points at it with a markdown link. -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/03272020061037-electrodermal-activity.txt: -------------------------------------------------------------------------------- 1 | --- 2 | bibliography: zettel.bib 3 | csl: ieee.csl 4 | nocite: | 5 | 6 | --- 7 | 8 | # Electrodermal Activity 9 | 10 | > **Date:** Mon 23 Mar 2020 11:51:54 PM UTC 11 | > 12 | > **Summary:** A summary of what electrodermal activity is and its use as a biomarker and use in signal processing. 13 | > 14 | > **Keywords:** ##summary ##signalprocessing ##healthcare #informatics #health #signalprocessing #signal #biomarker 15 | 16 | ## **Note Linked From:** 17 | 18 | ## Overview 19 | 20 | ### [What Is Electrodermal Activity?](03242020003215-eda-explained.txt) 21 | - **Summary:** What electrodermal activity is and its pros and cons as a biomarker 22 | 23 | ### [Common Causes of Artifact in EDA Signals](03272020061037-eda-artifacts.txt) 24 | - **Summary:** An overview of common artifacts in EDA signals 25 | 26 | 30 | 31 | --- 32 | --- 33 | 34 | Here we have to links on one line to test the regex. [A first link](202002251025_This_is_the_first_test_zettel.txt) and a [second line](202003211727_This_is_the_second_test_zettel.txt). 35 | 36 | ### **References:** -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/202002241029_Broken_references_Zettel.txt: -------------------------------------------------------------------------------- 1 | # 202002241029 Broken references Zettel 2 | tags: #fun 3 | 4 | This Zettel references a Zettel that doesn't exist [[202005171153]]. 5 | 6 | It also uses a non-unique reference [[2020]]. 7 | 8 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/202002251025_This_is_the_first_test_zettel.txt: -------------------------------------------------------------------------------- 1 | # 202002251025 This is the first test Zettel 2 | tags: #artificialintelligence #zettelkasten 3 | 4 | This Zettel references this other Zettel here[[202002241029]]. It points to the second Zettel [[202003211727]]. 5 | 6 | 7 | ## It also has subtitles, fancy 8 | Philosophically we address the need to recontextualize stories[^gaga]. 9 | 10 | ## And References 11 | [^gaga]: See https://gaga.lol 12 | 13 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/202003211727_This_is_the_second_test_zettel.txt: -------------------------------------------------------------------------------- 1 | # 202003211727 This is the second test zettel 2 | tags: #artificialintelligence #zettelkasten 3 | 4 | The second Zettel references back to the first one[[202002251025]]. 5 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/202005011017_All_by_myself.txt: -------------------------------------------------------------------------------- 1 | # 202005011017 All by myself 2 | tags: #lonely 3 | 4 | This Zettel is alone in the vast darkness of space. As we all are. 5 | 6 | Pointing at itself [[202005011017]]. 7 | -------------------------------------------------------------------------------- /tests/data/zettelkasten_txt/202006112225_broken_utf8.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BasilPH/vizel/21415d2913b0f6df34171f6120c6c37602f60c49/tests/data/zettelkasten_txt/202006112225_broken_utf8.txt -------------------------------------------------------------------------------- /tests/test_vizel.py: -------------------------------------------------------------------------------- 1 | from os import stat, unlink, path 2 | 3 | import pytest 4 | import six 5 | from click.testing import CliRunner 6 | from vizel.cli import main 7 | 8 | 9 | @pytest.fixture(params=["data/zettelkasten_txt/", "data/zettelkasten_md/"]) 10 | def zettelkasten_directory(request): 11 | # Path to the `tests` folder 12 | base_dir = path.dirname(path.abspath(__file__)) 13 | return path.join(base_dir, request.param) 14 | 15 | 16 | @pytest.fixture() 17 | def stderr_expected(zettelkasten_directory): 18 | # Python 2.7 has a different default codec and therefore a different UnicodeDecodeError message 19 | python2_unicode_decode_message = ( 20 | "Skipping 202006112225_broken_utf8.{ext}: 'ascii' codec can't decode" 21 | " byte 0xff in position 0: ordinal not in range(128)\n" 22 | ) 23 | python3_unicode_decode_message = ( 24 | "Skipping 202006112225_broken_utf8.{ext}: 'utf-8' codec can't decode" 25 | " byte 0xff in position 0: invalid start byte\n" 26 | ) 27 | 28 | expected_file_ending = zettelkasten_directory.rpartition("_")[2].rstrip("/") 29 | 30 | stderr_out = ( 31 | 'No matching Zettel for reference "03272020061037-eda-artifacts.{ext}" ' 32 | "in 03272020061037-electrodermal-activity.{ext}\n" 33 | 'No matching Zettel for reference "LINK" in 03272020061037-electrodermal-activity.{ext}\n' 34 | 'No matching Zettel for reference "202005171153" in 202002241029_Broken_references_Zettel.{ext}\n' 35 | 'Skipping non-unique reference "2020" in 202002241029_Broken_references_Zettel.{ext}. Candidates: ' 36 | "202002241029_Broken_references_Zettel.{ext}, 202002251025_This_is_the_first_test_zettel.{ext}, " 37 | "202003211727_This_is_the_second_test_zettel.{ext}, 202005011017_All_by_myself.{ext}, " 38 | "202006112225_broken_utf8.{ext}\n" 39 | ) 40 | 41 | stderr_out += ( 42 | python2_unicode_decode_message if six.PY2 else python3_unicode_decode_message 43 | ) 44 | 45 | return stderr_out.format(ext=expected_file_ending) 46 | 47 | 48 | def test_stats(zettelkasten_directory, stderr_expected): 49 | runner = CliRunner(mix_stderr=False) 50 | result = runner.invoke(main, ["stats", zettelkasten_directory]) 51 | 52 | assert result.exit_code == 0 53 | stdout_output = ( 54 | "7 Zettel\n" 55 | "6 references between Zettel\n" 56 | "2 Zettel with no references\n" 57 | "3 connected components\n" 58 | "257 words\n" 59 | ) 60 | assert result.stdout == stdout_output 61 | 62 | assert result.stderr == stderr_expected 63 | 64 | 65 | def test_graph_pdf_default(zettelkasten_directory): 66 | runner = CliRunner() 67 | pdf_path = "vizel_graph.pdf" 68 | result = runner.invoke(main, ["graph-pdf", zettelkasten_directory]) 69 | 70 | assert result.exit_code == 0 71 | assert stat(pdf_path).st_size > 0 72 | 73 | unlink(pdf_path) 74 | 75 | 76 | def test_graph_pdf_set_name(tmp_path, zettelkasten_directory): 77 | runner = CliRunner() 78 | pdf_path = path.join(str(tmp_path), "zettelkasten_custom_name.pdf") 79 | result = runner.invoke( 80 | main, ["graph-pdf", zettelkasten_directory, "--pdf-name", pdf_path] 81 | ) 82 | 83 | assert result.exit_code == 0 84 | assert stat(pdf_path).st_size > 0 85 | 86 | unlink(pdf_path) 87 | 88 | 89 | def test_unconnected(zettelkasten_directory, stderr_expected): 90 | runner = CliRunner(mix_stderr=False) 91 | result = runner.invoke(main, ["unconnected", zettelkasten_directory]) 92 | 93 | assert result.exit_code == 0 94 | 95 | expected_file_ending = zettelkasten_directory.rpartition("_")[2].rstrip("/") 96 | 97 | stdout_expected = ( 98 | "202005011017_All_by_myself.{ext}\n" "202006112225_broken_utf8.{ext}\n" 99 | ) 100 | assert result.stdout == stdout_expected.format(ext=expected_file_ending) 101 | 102 | assert result.stderr == stderr_expected.format(ext=expected_file_ending) 103 | 104 | 105 | def test_components(zettelkasten_directory, stderr_expected): 106 | runner = CliRunner(mix_stderr=False) 107 | result = runner.invoke(main, ["components", zettelkasten_directory]) 108 | 109 | assert result.exit_code == 0 110 | 111 | expected_file_ending = zettelkasten_directory.rpartition("_")[2].rstrip("/") 112 | 113 | stdout_expected = ( 114 | "# Component 1\n" 115 | "03242020003215-eda-explained.{ext}\n" 116 | "03272020061037-electrodermal-activity.{ext}\n" 117 | "202002241029_Broken_references_Zettel.{ext}\n" 118 | "202002251025_This_is_the_first_test_zettel.{ext}\n" 119 | "202003211727_This_is_the_second_test_zettel.{ext}\n\n" 120 | "# Component 2\n" 121 | "202005011017_All_by_myself.{ext}\n\n" 122 | "# Component 3\n" 123 | "202006112225_broken_utf8.{ext}\n\n" 124 | ) 125 | assert result.stdout == stdout_expected.format(ext=expected_file_ending) 126 | 127 | assert result.stderr == stderr_expected.format(ext=expected_file_ending) 128 | 129 | 130 | def test_quiet_flag_stats(zettelkasten_directory): 131 | for quiet_flag in ["-q", "--quiet"]: 132 | runner = CliRunner(mix_stderr=False) 133 | result = runner.invoke(main, ["stats", quiet_flag, zettelkasten_directory]) 134 | 135 | assert result.exit_code == 0 136 | assert result.stderr == "" 137 | 138 | 139 | def test_quiet_flag_unconnected(zettelkasten_directory): 140 | for quiet_flag in ["-q", "--quiet"]: 141 | runner = CliRunner(mix_stderr=False) 142 | result = runner.invoke( 143 | main, ["unconnected", quiet_flag, zettelkasten_directory] 144 | ) 145 | 146 | assert result.exit_code == 0 147 | assert result.stderr == "" 148 | 149 | 150 | def test_quiet_flag_components(zettelkasten_directory): 151 | for quiet_flag in ["-q", "--quiet"]: 152 | runner = CliRunner(mix_stderr=False) 153 | result = runner.invoke(main, ["components", quiet_flag, zettelkasten_directory]) 154 | 155 | assert result.exit_code == 0 156 | assert result.stderr == "" 157 | -------------------------------------------------------------------------------- /vizel/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.1.0" 2 | -------------------------------------------------------------------------------- /vizel/cli.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import os.path 3 | import re 4 | from operator import itemgetter 5 | 6 | import click 7 | import networkx as nx 8 | import six 9 | from graphviz import Digraph 10 | 11 | 12 | class Logger: 13 | """ 14 | This class wraps `click.echo` and provides two log-levels: info and warning. 15 | 16 | The class is instantiated with `Logger.initialize`. If `suppress_warnings=True` is passed, all calls to `warning` 17 | will not result in any output. 18 | 19 | After initialization the singleton instance needs to be retrieved with `Logger.get`. 20 | """ 21 | 22 | __instance = None 23 | 24 | def __init__(self, suppress_warnings): 25 | self.suppress_warnings = suppress_warnings 26 | Logger.__instance = self 27 | 28 | @staticmethod 29 | def initialize(suppress_warnings): 30 | """ 31 | Initialize the Logger singleton instance. 32 | 33 | :param suppress_warnings: If set to `True`, all calls to `warning` will not result in any output. 34 | :return: None 35 | """ 36 | Logger(suppress_warnings) 37 | 38 | @staticmethod 39 | def get(): 40 | """ 41 | Returns a singleton Logger instance. `Logger.initialize` must have been called at least once before. 42 | 43 | :return: Logger instance 44 | """ 45 | if Logger.__instance is None: 46 | raise Exception("Logger not initialized. Call `initialize` first.") 47 | return Logger.__instance 48 | 49 | def info(self, message): 50 | """ 51 | Prints a message to stdout using `click.echo`. 52 | 53 | :param message: Info message to be printed. 54 | :return: None 55 | """ 56 | click.echo(message) 57 | 58 | def warning(self, message): 59 | """ 60 | Prints a message to stderr using `click.echo`. If `suppress_warnings=True`, nothing is printed. 61 | :param message: Warning message to be printed. 62 | :return: None 63 | """ 64 | if not self.suppress_warnings: 65 | click.echo(message, err=True) 66 | 67 | 68 | @click.group() 69 | def main(): 70 | """ 71 | See the stats and connections of your Zettelkasten. 72 | \f 73 | 74 | :return: None 75 | """ 76 | pass 77 | 78 | 79 | def _extract_valid_references( 80 | zettel_content, reference_regexp, zettel_path, zettel_filenames 81 | ): 82 | """ 83 | Extracts references from a Zettel that match a reference and that point to exactly one existing file. 84 | 85 | Throws a UnicodeDecodeError if the file content can't be converted to unicode. 86 | 87 | :param zettel_content: File content of the Zettel. 88 | :param zettel_path: Path to the Zettel we parse for references. 89 | :param reference_regexp: Regexp that matches the references with one matching group. 90 | :param zettel_path: Path to the Zettel we parse for references. 91 | :param zettel_filenames: List of filenames in the Zettel directory. 92 | :return: Filenames of Zettel that are referenced. 93 | """ 94 | 95 | logger = Logger.get() 96 | 97 | references = [] 98 | 99 | reference_texts = re.findall(reference_regexp, zettel_content) 100 | for reference_text in reference_texts: 101 | matching_zettel_filenames = [] 102 | for zettel_filename in zettel_filenames: 103 | if zettel_filename.startswith(reference_text): 104 | matching_zettel_filenames.append(zettel_filename) 105 | 106 | if len(matching_zettel_filenames) == 1: 107 | references += matching_zettel_filenames 108 | elif len(matching_zettel_filenames) > 1: 109 | logger.warning( 110 | 'Skipping non-unique reference "{}" in {}. Candidates: {}'.format( 111 | reference_text, 112 | os.path.basename(zettel_path), 113 | ", ".join(matching_zettel_filenames), 114 | ) 115 | ) 116 | else: 117 | logger.warning( 118 | 'No matching Zettel for reference "{}" in {}'.format( 119 | reference_text, os.path.basename(zettel_path) 120 | ) 121 | ) 122 | return references 123 | 124 | 125 | def _load_references(zettel_content, zettel_path, zettel_directory_path): 126 | """ 127 | Parses the content of `zettel_path` for references to other Zettel. 128 | 129 | :param zettel_content: File content of the Zettel. 130 | :param zettel_path: Path to the Zettel we parse for references. 131 | :param zettel_directory_path Path to directory where the Zettel are stored. 132 | :return List of filenames of referenced Zettel. 133 | """ 134 | references = [] 135 | if not zettel_content: 136 | return references 137 | zettel_filenames = sorted( 138 | [ 139 | os.path.basename(f) 140 | for f in glob.glob(os.path.join(zettel_directory_path, "*[.md|.txt]")) 141 | ] 142 | ) 143 | 144 | # Extract references for the [[ID]] link format 145 | # Look for [[, and then match anything that isn't ]]. End with ]]. 146 | references += _extract_valid_references( 147 | zettel_content, "\[\[([^\]\]]+)\]\]", zettel_path, zettel_filenames 148 | ) 149 | 150 | # Extract references for the markdown link format 151 | # Look for [, and then match anything that isn't ]. Then look for ( and match anything that isn't ). End with ). 152 | references += _extract_valid_references( 153 | zettel_content, "\[[^\]]+\]\(([^\)]+)\)", zettel_path, zettel_filenames 154 | ) 155 | 156 | return references 157 | 158 | 159 | def _get_short_description(zettel_filename): 160 | """ 161 | Creates a short description out of the Zettel filename. 162 | :param zettel_filename: Filename of the Zettel 163 | :return: 50 character long string 164 | """ 165 | 166 | # Create a short, 50 character, description 167 | replace_with_space = ["_", "-"] 168 | remove = [".md", ".txt"] 169 | short_des = zettel_filename 170 | 171 | for replace_char in replace_with_space: 172 | short_des = short_des.replace(replace_char, " ") 173 | 174 | for remove_char in remove: 175 | short_des = short_des.replace(remove_char, "") 176 | 177 | return short_des 178 | 179 | 180 | def _get_digraph(zettel_directory_path): 181 | """ 182 | Parses the Zettel in `zettel_directory` and returns a digraph. 183 | 184 | :param zettel_directory_path Path to directory where the Zettel are stored. 185 | :return DiGraph object representing the Zettel graph. 186 | """ 187 | logger = Logger.get() 188 | digraph = nx.DiGraph() 189 | 190 | for zettel_path in sorted( 191 | glob.glob(os.path.join(zettel_directory_path, "*[.md|.txt]")) 192 | ): 193 | 194 | zettel_filename = os.path.basename(zettel_path) 195 | short_des = _get_short_description(zettel_filename) 196 | zettel_content = "" 197 | try: 198 | with open(zettel_path, "r") as zettel_file: 199 | zettel_content = zettel_file.read() 200 | if six.PY2: 201 | zettel_content = unicode(zettel_content, errors="strict") 202 | except UnicodeDecodeError as e: 203 | logger.warning("Skipping {}: {}".format(zettel_filename, e)) 204 | zettel_content = "" 205 | digraph.add_node( 206 | zettel_filename, 207 | content=zettel_content, 208 | short_description=short_des, 209 | path=zettel_path, 210 | ) 211 | 212 | for reference_zettel_filename in _load_references( 213 | zettel_content, zettel_path, zettel_directory_path 214 | ): 215 | if zettel_filename != reference_zettel_filename: 216 | digraph.add_edge(zettel_filename, reference_zettel_filename) 217 | return digraph 218 | 219 | 220 | def _get_zero_degree_nodes(digraph): 221 | """ 222 | Get all the nodes that have degree zero 223 | 224 | :param digraph: DiGraph object representing the Zettel graph. 225 | :return: List of nodes from `digraph` where degree is 0. 226 | """ 227 | 228 | return [node for node, degree in digraph.degree() if degree == 0] 229 | 230 | 231 | def _get_total_word_count(digraph): 232 | """ 233 | Get the total number of words in all the Zettel. Aims to match the results from the `wc` utility. Per `man wc`, 234 | the function iswspace(3) is used to determine the word boundaries. We are using `str.isspace`, which seems to behave 235 | the same on our (small) test set. 236 | 237 | :param digraph: DiGraph object representing the Zettel graph. 238 | :return: Total number of words of all the Zettel in `digraph`. 239 | """ 240 | 241 | word_count = 0 242 | for (node, data) in digraph.nodes(data=True): 243 | previous_is_space = True 244 | zettel_word_count = 0 245 | for character in data["content"]: 246 | if character.isspace(): 247 | previous_is_space = True 248 | else: 249 | if previous_is_space: 250 | zettel_word_count += 1 251 | previous_is_space = False 252 | word_count += zettel_word_count 253 | return word_count 254 | 255 | 256 | @main.command(short_help="PDF of Zettel graph") 257 | @click.argument("directory", type=click.Path(exists=True, dir_okay=True)) 258 | @click.option( 259 | "--pdf-name", 260 | default="vizel_graph.pdf", 261 | help="Name of the PDF file the graph is written into. Default: vizel_graph.pdf", 262 | ) 263 | def graph_pdf(directory, pdf_name): 264 | """ 265 | Generates a PDF of the graph spanned by Zettel in DIRECTORY. 266 | \f 267 | 268 | :param directory: Directory where all the Zettel are. 269 | :param pdf_name: Name of the PDF file the graph is written into. 270 | :return None 271 | """ 272 | 273 | digraph = _get_digraph(directory) 274 | 275 | dot = Digraph(comment="Zettelkasten Graph") 276 | 277 | for (node, data) in digraph.nodes(data=True): 278 | dot.node(node, data["short_description"]) 279 | 280 | for u, v in digraph.edges: 281 | dot.edge(u, v) 282 | 283 | # Remove the last `.pdf` ending if present 284 | if pdf_name.endswith(".pdf"): 285 | pdf_name = pdf_name.rpartition(".pdf")[0] 286 | dot.render(pdf_name, cleanup=True) 287 | 288 | 289 | @main.command(short_help="Stats of Zettel graph") 290 | @click.argument("directory", type=click.Path(exists=True, dir_okay=True)) 291 | @click.option("-q", "--quiet", is_flag=True, help="Quiet mode") 292 | def stats(directory, quiet): 293 | """ 294 | Prints the stats of the graph spanned by Zettel in DIRECTORY. 295 | 296 | \b 297 | Stats calculated : 298 | - Number of Zettel 299 | - Number of references between Zettel (including bi-directional and duplicate) 300 | - Number of Zettel without any reference from or to a Zettel 301 | - Number of connected components 302 | - Number of words in all the Zettel (aims to match the `wc` command) 303 | \f 304 | 305 | :param quiet: When set to True, warnings will not be printed. 306 | :param directory: Directory where all the Zettel are. 307 | :return None 308 | """ 309 | Logger.initialize(suppress_warnings=quiet) 310 | logger = Logger.get() 311 | digraph = _get_digraph(directory) 312 | 313 | logger.info("{} Zettel".format(digraph.number_of_nodes())) 314 | logger.info("{} references between Zettel".format(digraph.number_of_edges())) 315 | 316 | n_nodes_no_edges = len(_get_zero_degree_nodes(digraph)) 317 | logger.info("{} Zettel with no references".format(n_nodes_no_edges)) 318 | 319 | logger.info( 320 | "{} connected components".format( 321 | nx.number_connected_components(digraph.to_undirected()) 322 | ) 323 | ) 324 | 325 | logger.info("{} words".format(_get_total_word_count(digraph))) 326 | 327 | 328 | @main.command(short_help="Zettel without references") 329 | @click.argument("directory", type=click.Path(exists=True, dir_okay=True)) 330 | @click.option("-q", "--quiet", is_flag=True, default=False, help="Quiet mode") 331 | def unconnected(directory, quiet): 332 | """ 333 | Prints all of the Zettel in DIRECTORY that have no in- or outgoing references. 334 | 335 | \f 336 | 337 | :param directory: Directory where all the Zettel are. 338 | :param quiet: When set to True, warnings will not be printed. 339 | :return None 340 | """ 341 | Logger.initialize(suppress_warnings=quiet) 342 | logger = Logger.get() 343 | digraph = _get_digraph(directory) 344 | 345 | zero_degree_nodes = _get_zero_degree_nodes(digraph) 346 | 347 | for node in sorted(zero_degree_nodes): 348 | logger.info("{}".format(node)) 349 | 350 | 351 | @main.command(short_help="Connected components") 352 | @click.argument("directory", type=click.Path(exists=True, dir_okay=True)) 353 | @click.option("-q", "--quiet", is_flag=True, default=False, help="Quiet mode") 354 | def components(directory, quiet): 355 | """ 356 | Lists the connected components and their Zettel in DIRECTORY. 357 | 358 | \f 359 | 360 | :param directory: Directory where all the Zettel are. 361 | :param quiet: When set to True, warnings will not be printed. 362 | :return None 363 | """ 364 | Logger.initialize(suppress_warnings=quiet) 365 | logger = Logger.get() 366 | digraph = _get_digraph(directory) 367 | undirected_graph = digraph.to_undirected() 368 | 369 | conn_components = nx.connected_components(undirected_graph) 370 | 371 | # Sort the Zettel in each component 372 | conn_components = [sorted(component) for component in conn_components] 373 | 374 | # Sort the conn_components by their size and break ties with the name of their first Zettel 375 | conn_components = sorted(conn_components, key=itemgetter(0)) 376 | conn_components = sorted(conn_components, key=len, reverse=True) 377 | 378 | for i, component in enumerate(conn_components, start=1): 379 | logger.info("# Component {}".format(i)) 380 | for zettel in component: 381 | logger.info(zettel) 382 | 383 | logger.info("") 384 | --------------------------------------------------------------------------------