Git Product home page Git Product logo

seal-rookery's Introduction

Welcome to the Court Seal Rookery

This is a collection of court seals that works in tandem with the Free Law Project court seals service. You can use this system to integrate picture of court seals directly into your applications.

Original files can be found in the orig directory and an index file can be found at seals.json.

Using this Project

This system is exceedingly simple. To use this it, install the judge pics package from pypi:

pip install seal-rookery

And then use that package to get the URL of a court's seal:

>>> from seal_rookery.search import seal, ImageSizes
>>> seal("ca9", ImageSizes.SMALL)
'https://seals.free.law/v2/128/ca9.png'

Now that you have the URL of the court's seal in a useful size, just embed it in your application. Perhaps:

<img src="https://seals.free.law/v2/128/ca9.png" 
     height=128 />

One thing we don't currently do is provide a consistent width for the photos. This is because our sources are not consistent, and we opted to set the height consistently instead of the width. You can work around this by using the width attribute of the img tag instead of the height (in which case the browser will scale it for you), or by just ignoring the width attribute and letting the photo have slightly varying widths on your page.

You can request images in one of the following heights:

class ImageSizes(Enum):
    SMALL = 128
    MEDIUM = 256
    LARGE = 512
    XLARGE = 1024
    ORIGINAL = "orig"

Selecting ImageSizes.ORIGINAL will give you a link to the original image that we have in our collection. You'd want to use this to make custom sized images, say.

For questions about the reliability, pricing, versioning, privacy, and security of the service see the readme file for the judge-pics repository.

Contributing

  1. Find the image and ensure it follows our quality guidelines (below).

  2. Add the image file to the orig directory.

  3. Edit seals.json to include the relevant fields for your new file.

Quality Guidelines

  1. Convert your original file to png or svg, as appropriate. If you have the ps file, include that as well.

  2. If you use transparency or the file has it, make sure the file looks OK on a background other than white. If it looks bizarre on an orange or blue background, fix it by adding a white layer on the bottom.

  3. Trim any extraneous margins and if the seal is circular, make the corners transparent.

  4. If the item was previously a jpeg or gif, it's good to clean up the splotchiness created by the jpeg compression. You'll see it if you zoom in.

Usage

We know of no instances where courts have requested a take down of their seal, however usage of government seals has caused a few stirs in the past. Don't attempt to represent the government or its agents.

Testing

Testing can run with the following command.

python -m unittest -v test

Tests are also run on every push to Github at https://github.com/freelawproject/seal-rookery

For more information on testing checkout the Github workflows directory.

New Releases

Deploying can be handled in two ways.

  1. Update the version info in setup.py.

  2. Commit to github with a tag in format v*.. (ex. v1.0.0)

or

  1. Update the version info in setup.py.

  2. Install the requirements in requirements-dev.txt

  3. Set up a config file at ~/.pypirc containing the upload locations and authentication credentials.

  4. Generate a distribution:

    python setup.py sdist

  5. Upload the distribution:

    twine upload dist/* -r pypi

Copyright

Two things. First, if you are creating original work, please consider signing and emailing a contributor license to us so that we may protect the work later, if needed. We do this because we have a lot of experience with IP litigation, and this is a good way to protect a project.

Second, if you're just curious about the copyright of this repository, see the License file for details. The short version of this is you can pretty much use it however you desire.

Credit Where Due

This project inspired by the initial visualization work of @nowherenearithaca.

seal-rookery's People

Contributors

flooie avatar mlissner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seal-rookery's Issues

Unable to install from pip using Python 3 due to missing sdist or py3 wheel

When I try to install this package from PyPI using pip with Python 3, pip is only able to find versions 0.9.20 and 0.9.24 (which are not the most recent versions of the package, nor are they compatible with Python 3).

If you look at the full data for the package (see: https://pypi.org/pypi/seal_rookery/json) you can see all the different distributions that have been downloaded for each release.

If you look at 0.9.20 and 0.9.24 you can see that they both have an sdist release (i.e. source distribution) while the others only have bdist_wheel (a binary format) releases which are Python 2 only (because they were created with Python 2). As such, it looks like in order to allow Python 3 users to install the package from pip, you need to either:

  • upload an sdist as well as a bdist_wheel for each release (official recommendation is to always upload an sdist as it's used by pip as a fallback)
  • upload a bdist_wheel for Python 3 as well as Python 2 for each release
  • both of the above (recommended)

This should be simple to do with twine, the docs here have detailed step-by-step instructions: https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives.

Three Tests are broken

Tests broke after a large revision to convert_images occurred in March of 2019. The command line arguments were altered and how they were shared changed.

The shift moved toward a global args that is not replicated, and easily fixed in tests. The three tests are

1

FAIL: test_base_initialization (test.PackagingTests)
Simple test of calling convert_images to make sure things are wired.
----------------------------------------------------------------------

2

ERROR: test_convert_images_tool_accepts_args (test.SealGenerationTest)
Test we can pass command line args to the update-seals script.
----------------------------------------------------------------------

3

ERROR: test_can_force_regeneration_of_seals (test.SealGenerationTest)
Test we can force image conversions from the originals
----------------------------------------------------------------------

See Revision 014dd4c for more details on the changes that occurred.

In the meantime, the code appears to be working fine but these tests should be fixed.

Need to analyze/update license

The current license is one that I grabbed from the default Github collection because it looked kinda OK. It's not great though, really.

I imagine we'd do better with some combination of Creative Commons license (CC0?) for images and MIT for code.

@brianwc, if you don't mind, I'll leave this to your greater wisdom?

Python 3 support in setup.py seems broken due to ez_setup.py

If running setup.py with a CPython 3 interpreter, you get the following error:

Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    ez_setup.use_setuptools()
  File "/home/vagrant/seal-rookery/ez_setup.py", line 149, in use_setuptools
    version = _resolve_version(version)
  File "/home/vagrant/seal-rookery/ez_setup.py", line 364, in _resolve_version
    reader = codecs.getreader(charset)
  File "/usr/lib/python3.5/codecs.py", line 998, in getreader
    return lookup(encoding).streamreader
TypeError: lookup() argument must be str, not None

I'd presume the ez_setup.py stuff isn't even needed at this point? Honestly don't know why it's there.

Update-seals command is FAR too noisy

It's now part of our every upgrade, and it's kind of insanely chatty -- hundreds of lines of output.

Instead it should just do something really simple, like:

Updating seals: 3 of 88...
Done.

That'd be much better.

update-seals returns non-zero exit code

Running the update-seals command that setup.py is installing returns a non-zero exit status to the shell (looks like a value of 1) which causes tools like Ansible to think the command execution resulted in failure.

Looks like it's based on how I originally implemented the call to the method. Needs a minor refactor.

Convert seal pics into a cloud-first repository and service

In freelawproject/judge-pics#15, I lay out the path to upgrade judge-pics to version 2.0 and in freelawproject/courtlistener#1943, I discuss the need to remove seal-rookery from CourtListener.

Although we're not going to use seal rookery much anymore, I believe it should be easy to give it the same treatment as the judge-pics so that we're consistent in our offerings. The only extra bits to consider are:

  1. We need a domain for the seals. Let's go with rookery.free.law.

I think that's it. :)

We just need to bring the seals along for the ride. If this becomes a complicated thing, we can just say sorry, and abandon seals, but I'd prefer not to just because we don't usually roll that way.

Provide helpful error messages when ImageMagick's convert isn't present

Instead of a traceback when running tests like:

Traceback (most recent call last):
  File "/home/vagrant/seal-rookery/test.py", line 63, in test_can_force_regeneration_of_seals
    changed, skipped = convert_images.convert_images(forced=True)
  File "/home/vagrant/seal-rookery/seal_rookery/convert_images.py", line 84, in convert_images
    subprocess.Popen(command, shell=False).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Or a vague error when running update-seals -f like: [Errno 2] No such file or directory

There should be a more descriptive message suggesting that ImageMagick is not installed or on the current PATH.

Need to update readme

Things to include:

  • Contributing
  • Image requirements (svg or png, no borders, good background, no alpha problems, (c) safe)
  • License reference
  • What's included
  • Building minor files and dependencies for that
  • Other stuff?

Minor changes to rendered graphics via different versions or implementations of ImageMagick

I used ImageMagick 6.9.0 Q16 to process some new and changed orig files, and it altered files by 3 to 4 bytes that should not have been changed.

Potential options:

  • .gitignore the rendered folders, but that doesn't allow this repository to hold all four sizes.
  • alter convert_images.py to only generate files altered after a certain date.
  • determine what the 3 or 4 byte difference is and normalize for it.

update-seals doesn't work on new installation

The idea here is that we run update-seals whenever we pull new seals and when we first install the package.

But update-seals makes a decision for each seal: "Is the hash on disk the same as the one in the JSON?" If so, it does nothing. If not, it updates the seal.

We need to tweak this to either:

  • Have a new parameter that forces all seals to be updated, which we can run on first installation, or
  • Have it check if the seal exists at various sizes in addition to checking the hash.

I think I'm partial to the former. It seems simpler.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.