Skip to content

ankur-gupta/rain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌧️ rain

GitHub build codecov GitHub Repo stars GitHub forks

A live example to illustrate python packaging, testing, building, & deploying

Updates

rain has been updated to version 2

  • Uses the new src directory structure for python prokects
  • Uses the new pyproject.toml metadata structure based on PEP 621
  • More informative tests than version 1.0.0
  • More informative names than version 1.0.0
  • Python 2 cruft has been removed
  • Main branch renamed from master to main
  • Uses hatch to run tests, build packages, and update versions
  • You can still access v1 code and README here

Aims

rain is an online reference that can be explored by humans. It provides a living, dynamic alternative to commonly available static documentation. This repository covers the following topics.

rain is a live and unencumbered reference that aims to educate not execute.

Online reference

rain uses hatch to build package, run tests, update version, and more. If you want to create an empty scaffold for a new package you should use hatch new my-project. rain provides an online reference you can peruse to learn about the topics mentioned above.

Learn by examples

You can find all the details in a written, textual documentation. But, if you don't want to read the documentation and instead want to see a living example, try rain.

Less code to browse through

You can find examples in any of the famous packages such as numpy but you'll have to browse through a lot of complexity. rain provides a small code base that is only sufficient to explain python packaging.

Learn one topic at a time

Most of the topics above are explained in individual modules and files. For example, circular_imports module only deals with circular imports without having to deal with other issues such as logging.

Tests and builds via GitHub Actions

CI/CD is often best explained via live, working examples instead of written textual documentation.

Clone/fork and experiment

Clone or fork rain to quickly test out something without having to write a new package from scratch or messing your own important package.

Directory Structure

.
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ src
β”‚ └── rain
β”‚     β”œβ”€β”€ __init__.py
β”‚     β”œβ”€β”€ circular_imports
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ β”œβ”€β”€ array.py
β”‚     β”‚ └── grouped_array.py
β”‚     β”œβ”€β”€ cli
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ └── rain_maker.py
β”‚     β”œβ”€β”€ directory_module_with_selective_imports
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ β”œβ”€β”€ main.py
β”‚     β”‚ └── utils.py
β”‚     β”œβ”€β”€ local_imports
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ β”œβ”€β”€ main.py
β”‚     β”‚ └── variables.py
β”‚     β”œβ”€β”€ logging_example
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ └── main.py
β”‚     β”œβ”€β”€ resources
β”‚     β”‚ └── mathematicians.txt
β”‚     β”œβ”€β”€ this_directory_is_a_module
β”‚     β”‚ β”œβ”€β”€ __init__.py
β”‚     β”‚ └── this_file_is_a_submodule.py
β”‚     β”œβ”€β”€ this_file_is_a_module.py
β”‚     └── version.py
└── tests
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ not_a_test_file.py
    β”œβ”€β”€ test_a_function_in_a_module.py
    β”œβ”€β”€ test_a_function_in_a_submodule.py
    β”œβ”€β”€ test_circular_imports.py
    β”œβ”€β”€ test_demo_use_of_local_imports.py
    β”œβ”€β”€ test_errors.py
    β”œβ”€β”€ test_how_to_import_from_package.py
    β”œβ”€β”€ test_markers.py
    β”œβ”€β”€ test_naming_conventions.py
    β”œβ”€β”€ test_root.py
    β”œβ”€β”€ test_this_function_will_be_imported.py
    β”œβ”€β”€ test_using_a_class.py
    └── test_version.py

License

MIT

Contributing

Contributions are welcome. If you find errors or identify need for improvement, please look into Issues and open an issue.