APOLLO_LIBRARY is a template PyPI package designed to provide all the necessary components for creating your own package. Follow the instructions below to utilize it effectively in your projects. Note that this package is a placeholder, featuring only three modules that manage sample timestamps.
This template includes several essential shell scripts in the scripts
directory to streamline the management and development of the library. Ensure Python is installed on your computer before proceeding.
-
Change the Library Name:
python ./scripts/rename_package.py --old APOLLO_LIBRARY --new YourNewLibraryName
Example:
python ./scripts/rename_package.py --old APOLLO_LIBRARY --new Artemis_program
-
Change the Library Version:
./scripts/change_version.sh X.Y.Z
For detailed versioning information, refer to the Versioning section below.
-
Create and Activate a Virtual Environment:
./scripts/virtualenv_create.sh source ./scripts/virtualenv_activate.sh
-
Develop Your Library:
Place your code in the
APOLLO_LIBRARY/
directory. Ensure that__init__.py
files are present in each directory and subdirectory of the library. -
Document Your Code:
Use the Google docstring format for all functions, classes, and files to ensure consistent and comprehensive documentation.
-
Generate the Documentation:
./scripts/generate_doc.sh
Documentation will be available in the
/docs/API/
directory.
To utilize the placeholder functionality, you can import the provided modules and use them as follows:
from APOLLO_LIBRARY.time.converter import unix_to_iso, iso_to_datetime
# Convert UNIX timestamp to ISO 8601 format
timestamp = 1626797436
iso_time = unix_to_iso(timestamp)
print(iso_time) # Output: '2021-07-20T12:50:36'
# Convert ISO 8601 format to Python datetime object
iso_time = '2021-07-20T12:50:36'
datetime_obj = iso_to_datetime(iso_time)
print(datetime_obj) # Output: datetime.datetime(2021, 7, 20, 12, 50, 36)
We follow Semantic Versioning (SemVer) for version numbering vX.Y.Z:
- X: Major version (backward-incompatible changes)
- Y: Minor version (backward-compatible new features)
- Z: Patch version (backward-compatible bug fixes)
When creating a new release:
- Make necessary changes and improvements.
- Update the version number in
setup.py
. - Commit your changes and push them to the repository.
- Add a tag to the commit for the new version:
git tag vX.Y.Z git push origin vX.Y.Z
This will trigger the CI process to build and publish the package on PyPI.
The APOLLO_LIBRARY template includes utility functions for handling time-related tasks, such as time conversion, calculations, and formatting. The time_converter
module enables conversions between various time formats, including UNIX timestamps, ISO 8601, and Python datetime objects.
Special thanks to the Apollo team for their insightful guide on efficient production methods. Their comprehensive approach and innovative solutions significantly enhance productivity and operational efficiency. If you are curious, the report is available here.