semvec/pypi-packages huggingface dataset:
mongoday 0.0.4
A simple way to create documents in MongoDB
Requires Python: >=3.6

# mongoday

`mongoday` is a Python library that simplifies document creation in MongoDB. It does not depend on specific library as
it is agnostic but built using `pymongo` library. This README provides a brief overview of how to use `mongoday` to work
with documents in MongoDB.

Its development is undergoing but it provides a good starting point for creating documents in MongoDB.

## Installation

You can install `mongoday` using pip:

```bash
pip install mongoday
```

# Getting Started

To get started with `mongoday`, you'll need to create a model for your MongoDB documents. Here's an example of how to
create a simple model using `mongoday`:

```
from mongoday.field import BaseField, MongoIDField, StringField
from mongoday.model import BaseModel, IndexStore
from pymongo import MongoClient

class User(BaseModel):
    def __init__(self, collection):
        self.username = StringField()
        super(User, self).__init__(collection)

# Connect to MongoDB
client = MongoClient("mongodb://localhost:27017/")
db = client["mydatabase"]
collection = db["users"]

# Setup the store (mentioned below) for tracking indexes
index_store = IndexStore(collection=db["index_store"])

# Initialize a User document
user = User(collection)
user.username = "John"
user.save()

# Retrieve a User document
retrieved_user = User(collection).get(user.id)
print("Username:", retrieved_user.username)
```

## Indexes

````
# Before using indexes, make sure to setup store index which tracks the indexes and recreates automatically if changed
index_store = IndexStore(collection=db["index_store"])
````

To specify indexes, add an indexes attribute to your model class. Here's an example:


````
class User(BaseModel):
    indexes = [
        [('username', 1)],  # Create an ascending index on the 'username' field
        [('created', -1)]  # Create a descending index on the 'created' field
    ]
````

Or could be specified in the constructor, this way it won't override the default indexes specified by the BaseModel
class but will be added to them.

````
class User(BaseModel):
    def __init__(self, collection):
        .....
        
        # Specify indexes
        indexes = [
            [('username', 1)],  # Create an ascending index on the 'username' field
            [('created', -1)]   # Create a descending index on the 'created' field
        ]
        self.add_indexes(indexes)
````

# Contribution

Feel free to contribute to this project by opening issues or submitting pull requests
on [GitHub](https://github.com/abrararshad/mongoday).

License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
CalculatorPackageTuringRokasSertvytis 1.2
A simple python package that allows users to perform the most basic arithmetic functions.
Requires Python: >=3.7

## CalclculatorPackage

### Description
'Calculator' is a simple python package that allows users to perform the most basic arithmetic functions.

### Available functions:
- Addition (`.add(n)`)
- Subtraction (`.subtract(n)`)
- Multiplication (`.multiply(n)`)
- Division (`.divide(n)`)
- N Root (`.n_root(n)`)
- Reset memory (`.reset()`)

### Prerequisites
- Python
- Git

### Installation and test run
Package can be installed and tested in the following way:
##### 1. Create a Virtual Environment
Open your Command Prompt (CMD) and execute:
```
python -m venv {environment_name}
```
Replace `{environment_name}` with the desired name for your virtual environment.
##### 2. Activate the Virtual Environment
In CMD, type:
```
{environment_name}\Scripts\activate
```
##### 3. Install the package
With the virtual environment active, install the package using pip:
```
pip install CalculatorPackageTuringRokasSertvytis==1.2
```
##### 4. Navigate to your .py script directory
Change your directory to where your Python script (that will use the package) is located:
```
cd {PATH_TO_PYTHON_SCRIPT_DIRECTORY}
```
Replace `{PATH_TO_PYTHON_SCRIPT_DIRECTORY}` with the path to your script.
##### 5. Import package to the script (in .py file)
```
from calculator import Calculator
```
##### 6. Create Calculator object (in .py file)
```
{calculator_variable_name} = calculator.Calculator()
```
Replace `{calculator_variable_name}` with a suitable variable name.
##### 7. Use Calculator Functions (in .py file)
As an example, you can add numbers like so:
```
{calculator_variable_name}.add(2)
```
##### 8. Run the script from Command Prompt (CMD)
```
python {python_script_name}.py
```
Replace `{python_script_name}` with the name of your Python script.


Package could also be imported more elegantly by just running the following command in the command line
`pip install git+https://github.com/TuringCollegeSubmissions/rsertv-DWWP.1#egg=Calculator`
,but since the project is currently in a private GitHub directory, this method will not work.

### Function tests
Here are the expected results of each function:
```
calculator.add(5)      #OUTPUT: 0 + 5 = 5  
calculator.subtract(2) #OUTPUT: 5 - 2 = 3  
calculator.multiply(9) #OUTPUT: 3 * 9 = 27  
calculator.divide(3)   #OUTPUT: 27 / 3 = 9  
calculator.nRoot(2)    #OUTPUT: 9 ^ (1/2) = 3  
calculator.reset()     #OUTPUT: Memory cleared
```

### Tests
Package also includes tests which are located inside tests/calculator_test.py. One of the ways to run the test is to simply run `calculator_test.py` from command line when inside the test directory.