semvec/pypi-packages huggingface dataset:
zootopia3 1.2
Fitting simple torch models
Requires Python: >=3.9

# Fitting PyTorch models

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)

<img src="icon.png" align="center" width="400px"/>

This repository follows a workshop to set up a Python package, build some neural networks with `torch`, and publish the models on HuggingFace. 

There are two datasets that we simulate:
1. Colored shapes (circle, rectangle, triangle, diamond) in a pixellated image
2. One-dimensional sinusoids

Alongside these datasets, we fit the following model objectives:
1. (Classification) Predict the shape and color in the image
2. (Regression) Predict the next time steps of the sine function

## Usage

Learn how to train neural networks from scratch.

1. Run `answers/simulate-exercise.ipynb` to get data.
2. Fill in the ` # TO DO ` parts in `examples/modeling-exercise-*.ipynb`. 
3. Compare to solutions in `answers/modeling-exercise-*.ipynb`.
4. You can explore different parameters on big models with `scripts/modeling.py`.
    - Write a shell script that invokes `scripts/modeling.py` and pass args to `slurm`.
5. Run `scripts/modeling-final.py` for best model choice (train + val data).
6. (Optional) Compare to the benchmark [here](https://huggingface.co/datasets/sdtemple/colored-shapes).

The package defined under `src/` provides:
- A class `Shape` that instantiates an image with 1 colored shape
- A function `simulate_shapes()` to make many images for an image classifier
- A model class `MyCNN` to fit a standard architecture

Caution: you may need GPU resources if your models or data are large.

## Requirements

- Python 3.10+

## Install

If you want to install the package only from the internet:

```
pip install zootopia3
```

If you want to set up an isolated environment and build locally:

```
python -m venv path-to/your-environment
source path-to/your-environment/bin/activate
pip install -e .
```

You run the `pip` command within this repo.

## Data

I made a training and validation set with:
- 2000 samples for each combo
- `mix_x = 20`
- `max_x = 100`
- `shades = True`
- `magnitude = 50`

I made a testing set with:
- 20 samples for each combo
- `min_x = 10`
- `max_x = 50`

Therefore, the test set is a more difficult prediction problem.

You can find the test data [here](https://huggingface.co/datasets/sdtemple/colored-shapes).

## Sharing your work

To upload your model to Hugging Face, run these short scripts.
```
python hf-push.py your-model.pth sdtemple/color-prediction-model
```

A less elegant solution where you have to manually write the `config.json` data is:
```
python scripts/hf-convert.py your-model.pt your-model.safetensors
python scripts/hf-model.py your-model.safetensors sdtemple/color-prediction-model
```

To upload your data to Hugging Face, run this script.
```
python scripts/hf-dataset.py images.npy target_color.txt target_shape.txt your-username/colored-shapes
```

If you successfully uploaded a pretrained model to Hugging Face, you can run it on a CPU with `answers/inference-exercise.ipynb`.

## Test

You can run the test scripts in `tests/` with the following:

```
python -m pytest
```
pyaxm 2026.1.23
Query Apple Business Manager using Python
Requires Python: >=3.10
Keywords: abm, apple business manager, axm

The purpose of this repo is to create a python library to easily get information using the Apple Business Manager API using Python.

A CLI command is also included, `pyacm-cli`.

https://developer.apple.com/documentation/applebusinessmanagerapi

## Setup
If you want to setup the authentication using envvars, do the following:

You will need to setup 2 environmental variables that are provided
when creating the private key in ABM:

`AXM_CLIENT_ID` and `AXM_KEY_ID`

Place the private key in your home directory inside the `.config/pyaxm` folder
and rename it `key.pem`

This location will be used to store a cached access_token that can be reused
until it expires. While testing I have experienced that requesting too many
access tokens will result in a response with status code 400 when 
trying to get a new token.

Otherwise you will have to pass the client id, key id and private key as arguments
to the client like so:

```python
from pyaxm.client import Client

axm_client = Client(
    axm_client_id="CLIENT_ID",
    axm_key_id="KEY_ID",
    key_path="PRIVATE_KEY",
    token_path="TOKEN_PATH"
)
```
The token path is the location where the access token will be stored.

## Installation:
`pip install pyaxm`

## CLI:
A command-line interface (CLI) tool called `pyaxm-cli` is included for easy access to the API.

### Overview
The CLI provides a convenient way to interact with the Apple Business Manager API directly from your terminal. It includes commands for managing devices, MDM servers, and retrieving device information.

### Detailed Documentation
For comprehensive documentation of all available commands, options, and usage examples, please refer to the [CLI documentation](docs/cli.md).

### Updating Documentation
The CLI documentation is automatically generated from the code. To update it after making changes to the CLI implementation, run:
```bash
typer pyaxm.cli utils docs --name pyaxm-cli --output docs/cli.md
```

A GitHub workflow automatically checks that the documentation stays in sync.

# Client:
Example usage:
```python
from pyaxm.client import Client

axm_client = Client()

devices = axm_client.list_devices()
print(devices)

device = axm_client.get_device(device_id='SERIAL_NUMBER')
print(device)

mdm_servers = axm_client.list_mdm_servers()
print(mdm_servers)

# The MDM server ID can be extracted from listing all mdm servers
mdm_server = axm_client.list_devices_in_mdm_server(server_id="MDM_SERVER_ID")
print(mdm_server)

device_assigned_server = axm_client.list_devices_in_mdm_server(device_id='SERIAL_NUMBER')
print(device_assigned_server)

assignment_result = axm_client.assign_unassign_device_to_mdm_server(
    device_ids=['SERIAL_NUMBER', "ANOTHER_SERIAL_NUMBER"],
    server_id="MDM_SERVER_ID",
    action="ASSIGN_DEVICES"|"UNASSIGN_DEVICES"
)
print(assignment_result)

apple_care_coverage = axm_client.get_apple_care_coverage(device_id='SERIAL_NUMBER')
print(apple_care_coverage)
```

## Issues:
* need to add tests

This is still a work in progress
pipx-isolate 0.1.1
a pipx script installer supporting inline metadata for python scripts
Requires Python: >=3.10

# pipx_isolate

a [`pipx`](https://pipx.pypa.io/latest/installation/) script installer supporting [inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) for python scripts

The purpose for this is to be able to isolate the dependencies for small scripts into a virtual environment.

Inline Script Metadata looks like this:

```python
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "beautifulsoup4",
#     "click>=8.3.1",
# ]
# ///

import os
import sys
import contextlib
from typing import Sequence, NamedTuple
import click
from bs4 import BeautifulSoup, Doctype
```

You could either manually add that to your script, or use [`uv`](https://docs.astral.sh/uv/) like: `uv add --script <PATH> click beautifulsoup4`. `pipx_isolate add-metadata <PATH>` shows you all the import statements and wraps `uv add --script`.

Once you have a script that has metadata, you can use `pipx run --path /path/to/script`, which parses the metadata at the top, installs anything that is needed into a venv into `~/.cache/pipx`, and then runs the script in that environment.

Running `pipx_isolate install <name>` looks up the name of the script in your `$PATH`, and creates a wrapper script that looks like this:

```
#!/bin/sh
exec /home/username/.local/bin/pipx run --path /full/path/to/name "$@"
```

This way, if you ever update the metadata at the top, `pipx` picks up the new changes, and runs it with the correct dependencies in a virtual environment.
If you want to pass arguments to `pipx run` in the generated script, you can do so like: `pipx_isolate install <file> --run --no-cache`

`pipx_isolate install` by default creates a `bin` directory at `~/.local/share/pipx_isolate/bin/` so in order to call the wrapper scripts instead of the original, you should update your `$PATH` to put that directory near the front of your `$PATH`:

```bash
export PATH="$HOME/.local/share/pipx_isolate/bin:$PATH"
```

To find/install all the scripts with inline script metadata, I run a command like this:

```bash
rg --files-with-matches -e '/// script' | xargs -I{} sh -c "test -x {} && uv export --script {} --quiet >/dev/null && echo {}" | parallel pipx_isolate install
```

See [`rg`](https://github.com/BurntSushi/ripgrep) and [`parallel`](https://www.gnu.org/software/parallel/)

## Installation

Requires `python3.10+`

To install with pip, run:

```
pip install pipx_isolate
```

## Usage

```
pipx_isolate --help
```

### Tests

```bash
git clone 'https://github.com/purarue/pipx_isolate'
cd ./pipx_isolate
pip install '.[testing]'
flake8 ./pipx_isolate
mypy ./pipx_isolate
```
edc-he 1.5.4
Base django classes for health economics
Requires Python: <3.14,>=3.12
Keywords: Edc, clinical, clinicedc, django, economics, health, trials

|pypi| |actions| |codecov| |downloads|

edc-he
------

Health economics model, form mixins for clinicedc / Django


Declare in `settings` if using concrete models not included in this app::

    EDC_HE_ASSETS_MODEL = "<label_lower>"
    EDC_HE_HOUSEHOLDHEAD_MODEL = "<label_lower>"
    EDC_HE_INCOME_MODEL = "<label_lower>"
    EDC_HE_PATIENT_MODEL = "<label_lower>"
    EDC_HE_PROPERTY_MODEL = "<label_lower>"

See also module ``intecomm_subject`` at https://github.com/intecomm-trial/intecomm-edc.

If you need to declare the Health Economics models in your app, use the provided model mixins.

For example, the ``HealthEconomicsHouseholdHead`` model would be declared like this:

.. code-block:: python

    # models.py

    class HealthEconomicsHouseholdHead(
        SingletonCrfModelMixin,
        HouseholdHeadModelMixin,
        HouseholdModelMixin,
        CrfModelMixin,
        BaseUuidModel,
    ):

        class Meta(CrfModelMixin.Meta, BaseUuidModel.Meta):
            verbose_name = "Health Economics: Household head"
            verbose_name_plural = "Health Economics: Household head"


.. code-block:: python

    # forms.py

    class HealthEconomicsHouseholdHeadForm(
        CrfSingletonModelFormMixin, CrfModelFormMixin, forms.ModelForm
    ):
        form_validator_cls = HealthEconomicsHouseholdHeadFormValidator

        def clean(self):
            self.raise_if_singleton_exists()
            raise_if_clinical_review_does_not_exist(self.cleaned_data.get("subject_visit"))
            return super().clean()

.. code-block:: python

    # admin.py


    @admin.register(HealthEconomicsHouseholdHead, site=intecomm_subject_admin)
    class HealthEconomicsHouseholdHeadAdmin(
        HealthEconomicsHouseholdHeadModelAdminMixin, CrfModelAdmin
    ):
        form = HealthEconomicsHouseholdHeadForm


The metadata rules may also be declared locally


.. code-block:: python

    # metadata_rules.py

    from edc_he.rule_groups import Predicates as BaseHealthEconomicsPredicates
    from edc_he.rule_groups import HealthEconomicsRuleGroup as BaseHealthEconomicsRuleGroup

    class HealthEconomicsPredicates(BaseHealthEconomicsPredicates):
        app_label = "intecomm_subject"
        visit_model = "intecomm_subject.subjectvisit"

    @register()
    class HealthEconomicsRuleGroup(BaseHealthEconomicsRuleGroup):
        class Meta:
            app_label = "intecomm_subject"
            source_model = "intecomm_subject.subjectvisit"
            predicates = HealthEconomicsPredicates()



.. |pypi| image:: https://img.shields.io/pypi/v/edc-he.svg
    :target: https://pypi.python.org/pypi/edc-he

.. |actions| image:: https://github.com/clinicedc/edc-he/actions/workflows/build.yml/badge.svg
  :target: https://github.com/clinicedc/edc-he/actions/workflows/build.yml

.. |codecov| image:: https://codecov.io/gh/clinicedc/edc-he/branch/develop/graph/badge.svg
  :target: https://codecov.io/gh/clinicedc/edc-he

.. |downloads| image:: https://pepy.tech/badge/edc-he
   :target: https://pepy.tech/project/edc-he
astromodels 2.5.1
Astromodels contains models to be used in likelihood or Bayesian 
Requires Python: >=3.9.0

# astromodels

![CI](https://github.com/threeML/astromodels/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/threeML/astromodels/branch/master/graph/badge.svg)](https://codecov.io/gh/threeML/astromodels)
[![Documentation Status](https://readthedocs.org/projects/astromodels/badge/?version=latest)](http://astromodels.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
![GitHub contributors](https://img.shields.io/github/contributors/threeML/astromodels)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5646925.svg)](https://doi.org/10.5281/zenodo.5646925)



![GitHub pull requests](https://img.shields.io/github/issues-pr/threeML/astromodels)
![GitHub issues](https://img.shields.io/github/issues/threeML/astromodels)
## PyPi

[![PyPI version fury.io](https://badge.fury.io/py/astromodels.svg)](https://pypi.python.org/pypi/astromodels/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/astromodels)

## Conda
![Conda](https://img.shields.io/conda/pn/threeml/astromodels)
![Conda](https://img.shields.io/conda/dn/threeml/astromodels)


![alt text](https://raw.githubusercontent.com/threeml/astromodels/master/docs/media/large_logo.png)

Astromodels is a very flexible framework to define models for likelihood or Bayesian analysis of astrophysical data.

Even though it has been designed having in mind analysis in the spectral domain, it can be used also as a toolbox containing functions of any variable.

Astromodels is not a modeling package, it only gives you the tools to build a model as complex as you need. You then need a separate package (such as [3ML](github.com/threeML/threeML)) to fit that model to the data.

Some of the features which distinguish astromodels from other similar packages are:
- a model can contain an arbitrary number of sources at different positions in the sky
- parameters can be linked through any function (not only identity) 
- parameters can vary with auxiliary variables such as time. For example, you can build a model where some parameters vary with time, and you can fit the parameters of the function which describe this variability. Similary you can build models where parameters vary with the phase of a pulsar, and so on. 
- models can be saved in and loaded from YAML file (a human-readable format)
- physical units are fully supported in input, but they are handled so that they don’t slow down the actualy computation of the models.

Astromodels has been designed with performance as priority, and is considerably faster than other python-based solution for the same problem, such as astropy.modeling and the modeling part of sherpa.

Documentation: [https://astromodels.readthedocs.org/en/latest/](https://astromodels.readthedocs.org/en/latest/)