Metadata-Version: 2.4
Name: django-name
Version: 5.0.0
Summary: Name Authority App for Django.
Author-email: University of North Texas Libraries <mark.phillips@unt.edu>
License: Copyright © 2017, Regents of the University of North Texas
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are
        met:
        
        * Redistributions of source code must retain the above copyright notice,
          this list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
        
        * Neither the name of the University of North Texas Libraries nor the
          names of its contributors may be used to endorse or promote products
          derived from this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
        BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
        FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
        COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
        INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
        BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
        OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
        ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
        TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
        USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
        DAMAGE.
        
Project-URL: Homepage, https://github.com/unt-libraries/django-name
Project-URL: Repository, https://github.com/unt-libraries/django-name
Keywords: django,name,citation
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: End Users/Desktop
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Requires-Python: <4.0,>=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-dateutil==2.7.3
Requires-Dist: markdown2>=2.4.0
Requires-Dist: djangorestframework~=3.15.2
Requires-Dist: pynaco==1.0.1
Provides-Extra: codestyle
Requires-Dist: flake8; extra == "codestyle"
Provides-Extra: dev
Requires-Dist: Django==4.2.27; extra == "dev"
Requires-Dist: django-debug-toolbar==3.8.1; extra == "dev"
Requires-Dist: mysqlclient==2.0.1; extra == "dev"
Provides-Extra: test
Requires-Dist: tox>=3.3.0; extra == "test"
Requires-Dist: markdown2>=2.4.0; extra == "test"
Requires-Dist: pytest>=7.1.0; extra == "test"
Requires-Dist: pytest-django>=4.6.2; extra == "test"
Requires-Dist: pytest-cov>=7.0.0; extra == "test"
Requires-Dist: psycopg2-binary>=2.9.9; extra == "test"
Requires-Dist: tomli>=2.0.1; extra == "test"
Dynamic: license-file

# Django Name [![Build Status](https://github.com/unt-libraries/django-name/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/unt-libraries/django-name/actions) [![Docs Status](https://img.shields.io/badge/docs-latest-blue.svg)](https://django-name.readthedocs.io) [![PyPI Version](https://img.shields.io/pypi/v/django-name.svg)](https://pypi.python.org/pypi/django-name)
Python Implementation of NACO Normalization Rules

The Name App is a tool originally developed for documenting names used by the UNT Libraries in its various digital library systems and collections. The app provides a consistent way of communicating the authorized version of a name and information about the name that is useful for reuse. The Name App generates a unique URL for each name that can be used to unambiguously refer to a person, organization, event, building or piece of software. In addition to an HTML page for each name there are a number of other formats available for each record including a MADS XML version and a simple JSON representation. A key feature of the UNT Name App is the ability to link to other vocabularies such as the Virtual International Authority File (VIAF), the Library of Congress Name Authority File, or Wikipedia.  
 
 ---

## Installation

For installation instructions, see the [Installation](https://django-name.readthedocs.io/en/latest/installation.html) page in the docs.
 
## License

See LICENSE.

## Acknowledgements

django-name was developed at the UNT Libraries.

Contributors:

- [Joey Liechty](https://github.com/yeahdef)
- [Damon Kelley](https://github.com/damonkelley)
- [Lauren Ko](https://github.com/ldko)
- [Mark Phillips](https://github.com/vphill)
- [Gio Gottardi](https://github.com/somexpert)
- [Madhulika Bayyavarapu](https://github.com/madhulika95b)
- [Gracie Flores-Hays](https://github.com/gracieflores)
- [Trey Clark](https://github.com/clarktr1)


## Requirements
- Python 3.9 or later 


## Development

There are three ways to set up this environment locally.

## Docker

Install [Docker](https://docs.docker.com). Instructions differ based on installation method. 

Clone the repository.
```sh
$ git clone https://github.com/unt-libraries/django-name.git
$ cd django-name
```

Warm up the Mariadb database. This only needs to be done when the database container doesn't exist yet. This will take about a minute once the image has been pulled.
```sh
$ docker compose up -d mariadb
```

Start the app and run the migrations.
```sh
# start the app
$ docker compose up -d

# run the migrations
$ docker compose run --rm web ./manage.py migrate

# optional: add a superuser in order to login to the admin interface
$ docker compose run --rm web ./manage.py createsuperuser
```
At this point you should be able to access your local instance of the site by visiting `<dockerhost>:8000/name/`

The code is in a volume that is shared between your workstation and the web container, which means any edits you make on your workstation will also be reflected in the Docker container. No need to rebuild the container to pick up changes in the code.

However, if the requirements files change, it is important that you rebuild the web container for those packages to be installed. This is something that could happen when switching between feature branches, or when pulling updates from the remote.

```sh
# stop the app
$ docker compose stop

# remove the web container
$ docker compose rm web

# rebuild the web container
$ docker compose build web

# start the app
$ docker compose up -d
```

## Developing with Podman and Podman-Compose
[Install or Enable Podman](https://podman.io/getting-started/installation).

[Install Podman Compose](https://github.com/containers/podman-compose).
```sh
$ sudo dnf install podman-compose
```

You will follow the same steps as above, starting with `Clone the repository`. For all of the docker steps, you will have to replace the word `docker` with `podman`.

If you have SELinux, you may need to temporarily add `:Z` to the web volumes in the docker-compose.yml. It will look like `.:/app/:Z`. You may also need to use `sudo` for your podman-compose commands.

## Traditional Setup

Clone the repository.
```sh
$ git clone https://github.com/unt-libraries/django-name.git
$ cd django-name
```

Install the mysql development package. The command depends on your system:
```sh
# Red Hat
sudo dnf install mysql-devel

# Ubuntu / Windows (WSL)
sudo apt install libmysqlclient-dev

# macOS via Homebrew
brew install mysql-client
```

Create a virtual environment and activate it
```sh
$ python -m venv env
$ source env/bin/activate
```

Install the dev dependencies
```sh
$ pip install .'[dev,test,codestyle]'
```

Replace the `DATABASES` Django setting in `./tests/settings/dev.py` with
```python
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': './db.sqlite3', 
    }
}
```
Add table data
```sh
$ python manage.py migrate
```

Start dev instance
```sh
$ python manage.py runserver
```

The app should be available at `http://localhost:8000/name/`

## Running the Tests
NOTE: tests will not pass without the mariadb and postgres databases available. 

To run the tests via Tox, use this command. If you are using podman-compose, swap the word `docker` with `podman` for the commands below.
```sh
$ docker compose run --rm web tox
```
