Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.0.0 #155

Merged
merged 61 commits into from
Sep 29, 2023
Merged

Release 1.0.0 #155

merged 61 commits into from
Sep 29, 2023

Conversation

fjork3
Copy link
Contributor

@fjork3 fjork3 commented Sep 29, 2023

No description provided.

JacobGinsparg and others added 30 commits July 31, 2023 15:04
Things added:
* Setup script and setup/test data
* FastAPI client with routers for /card and /cards endpoints
* Database IO file, using motor and MongoDB
* Pydantic models to interface between CRUD endpoints and db IO
* Some tests for /card/add_card endpoint
---------

Co-authored-by: broadband <iambroadband@gmail.com>
Co-authored-by: Ben Horkley <ben.horkley@gmail.com>
* Add data/db/README.md and data/db/.gitignore to keep data/db in clones of the repo

* Added Ben and Jacob as authors in the pyproject.toml

* Changed all instances of the name slurrk --> scooze
Release 0.1.0 merge into dev
* Created the Deck model.

* Added dependencies for the Deck model.

* Updated the Card model to better support the Deck model.

* Created the MatchData model to support the Deck model.
* Added some validation for deck size based on Format.

* Added more tests for Deck, including tests on the validations

* Created follow-up tickets related to Deck
- update Card field names to match Scryfall data
- data models for sub-components of cards: ImageUris, CardFace, Prices, Preview, RelatedCard
- model for DecklistCard
- model for FullCard, with all fields Scryfall supports
- update card and deck tests for new models
* Update all TODOs to be like `TODO(# Ticket): <description>`
- Add a flag to mutating functions to allow for optional revalidation
(default: False)
- Update tests to use non-validating model_construct() instead of
model_validate() except where validation is relevant.
- Implement remove_card() and remove_cards(). Counter.subtract(Counter)
vs counter1 - counter2
- Add comments for remove_card() and remove_cards()
- Write tests for remove_card() and remove_cards()
- Add tests to test_deck for `__str__` and `__eq__`
- Update Deck to use DecklistCard
- Create tests for Deck related utils
- Update references to Format and other Enums to point to the new
enums.py file
* main app's root now mounts to a simple index.html file with links to Swagger and ReDoc
* Remove dist/ directory
Co-authored-by: Ben Horkley <ben.horkley@gmail.com>

* Refactored CardModel to only be responsible for representing cards in the database.
* Created the new scooze.card class for representing and manipulating cards outside of the database.
1. Refactored Deck -> DeckModel
2. Created Deck class to manipulate deck data Pythonically. Also created
DeckPart class as a dependency
3. Added commander support to format_size (in utils), DeckModel, and
Deck
4. DeckPart has a complete set of tests
5. DeckModel has additional tests for size validation and cmdr
6. Deck Python object has a complete set of tests

---------

Co-authored-by: Ben Horkley <ben.horkley@gmail.com>
Co-authored-by: Jacob Ginsparg <jacobginsparg@gmail.com>
Scryfall uses `object` as a marker for which type of object is currently
being looked at in their JSON data; we're not using that marker to
construct these objects at any point, and that meta-tag isn't useful
downstream when we already know the instance of a class, so we shouldn't
need to support this field.
### Description
We want to be able to convert between CardModel and Card easily in both
directions.

### Done
- it seems like methods with underscores in the name aren't able to go
from json -> Model -> Card object. Investigate.
   - fixed with "populate_by_name" in the model config
- write code to get from Card -> json -> Card Model. This might be as
easy as model_validate(**card.__dict__)
- Do we want to have CardFaces on the regular cards? probably not? idk
   - no, we do not want CardFaces on regular cards.
- Figure out if Card.from_model() should use model_dump() or dict().
Investigate the key differences.
- dict does not recursively unpack objects inside of JSON. Therefore we
will use .model_dump()
- Add a token to the test suite
- halfway did this. The actual tests will need to be written in the next
PR, but I added the token to the jsonl file and made a fixture for it
   
### Follow-Up
#61
#65

---------

Co-authored-by: Jacob Ginsparg <jacobginsparg@gmail.com>
Updated our existing docstrings to match Google's Python style guide.

https://google.github.io/styleguide/pyguide.html
Prices were not normalizing correctly. `cmc` was also technically not
normalizing correctly.

- Update all `float` fields to accept `[float, int, str]`
- Update Prices to normalize all its attributes
On CardModel - should be `illustration_id`, not `illustation_id`
On CardFaceModel - should be `str` not `int`
1. Add tests for json -> Card objects
2. Add tests for json -> CardModels
3. Add tests for CardModels -> Card objects
4. BUGFIXes discovered during this work:
  - #90
  - #91
  - #92
  - #93
- There are a few tiny changes to defaults in card.py because Optional
fields should generally default to `None`
---------

Co-authored-by: Jacob Ginsparg <jacobginsparg@gmail.com>
- Add hashing to Card, OracleCard, and FullCard
Issue #19
fjork3 and others added 26 commits September 14, 2023 11:12
Co-authored-by: broadband <iambroadband@gmail.com>
)

- CardRouter docs
- CardsRouter docs
- Update defaults for Card / parts for better clarity
- Add examples for CardModels
- Update CardModelIn and CardModelOut to use FullCardModel
- Fixed Deck.decklist_equals() to behave correctly
- Wrote tests to demonstrate
- DeckRouter docstrings
- DeckModel examples
Had the wrong names. They should be testing Card, not CardModel
Many more tests for the card and cards routers.

---------

Co-authored-by: Ben Horkley <ben.horkley@gmail.com>
I am now able to load the app from outside of the project directory.
This may be important for allowing users to run the web UI for their
REST API locally.

Also updated some dependencies and removed packagr from the
pyproject.toml.
Added templates for "Bug report" and "Feature request"
- Fix Args so we don't have double type reminders
- Fix Returns so we don't have extraneous return object names
Clarify imports of Magic related enums by moving them to the Scryfall standard of "catalogs"
…sion (#142)

We will need to do something like

```
card = Card()
model = CardModel.model_validate(card.__dict__)
```

when we are writing the CLI and API. This is important because users
will mostly be using Card objects and we will then need to convert to
models to write to the database.

I wrote validators for all of the sub-models on a CardModel so we can do
this without any validation errors.
DONE
- Create Python API endpoints for cards, decks, bulkdata
- Write tests for the new API endpoints
- Update existing synchronous code to use these endpoints instead of
asyncio.run(db.endpoint)
- Add docstrings for new endpoints


TODO
- get_cards_by_format convenience method seems a little tricky, maybe
make that a new issue?
- There is a follow-up ticket to implement deck endpoints (#145), but it
is dependent on #70

---------

Co-authored-by: broadband <iambroadband@gmail.com>
Co-authored-by: Jacob Ginsparg <jacobginsparg@gmail.com>
@iambroadband iambroadband merged commit bfcdf48 into main Sep 29, 2023
@fjork3 fjork3 deleted the release-1-0-0 branch September 29, 2023 21:15
iambroadband added a commit that referenced this pull request Oct 11, 2023
Co-authored-by: Jacob Ginsparg <jacobginsparg@gmail.com>
Co-authored-by: broadband <iambroadband@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants