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

Use attrs everywhere #44

Merged
merged 7 commits into from Nov 6, 2019
Merged

Use attrs everywhere #44

merged 7 commits into from Nov 6, 2019

Conversation

astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Nov 6, 2019

This already passes all the tests locally.

Things that will have to be reworked:

  • Shortcuts, converters

Things I removed and I'd like to bring back:

  • Docstrings

Things I'd like to review:

  • Defaults (we should probably be using default=None everywhere)
  • isinstance (we are inconsistently using positive and negative checks)
  • Validation (we use __attrs_post_init__ but we could use @x.validator instead http://www.attrs.org/en/stable/init.html#decorator)
  • Mixins (are they necessary?)
  • KNOWN_PROPERTIES (can I iterate over attrs properties now instead?)

Things I'd like to add in the future:

"Generally speaking, the moment you think that
you need finer control over how your class is instantiated
than what attrs offers,
it's usually best to use a classmethod factory
or to apply the builder pattern."

http://www.attrs.org/en/stable/init.html#post-init-hook
@astrojuanlu
Copy link
Member Author

I also removed converters, which means that I broke the API and will probably have to replace them by classmethods, as advised in the attrs documentation:

Generally speaking, the moment you think that you need finer control over how your class is instantiated than what attrs offers, it’s usually best to use a classmethod factory or to apply the builder pattern.

@codecov-io
Copy link

codecov-io commented Nov 6, 2019

Codecov Report

Merging #44 into master will increase coverage by 1.41%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   97.56%   98.98%   +1.41%     
==========================================
  Files          12       12              
  Lines        1027      590     -437     
==========================================
- Hits         1002      584     -418     
+ Misses         25        6      -19
Impacted Files Coverage Δ
src/czml3/types.py 98.2% <100%> (+5.06%) ⬆️
src/czml3/core.py 100% <100%> (ø) ⬆️
src/czml3/examples/simple.py 100% <100%> (ø) ⬆️
src/czml3/properties.py 100% <100%> (+1.35%) ⬆️
src/czml3/base.py 94.59% <100%> (-0.15%) ⬇️
src/czml3/common.py 100% <100%> (ø) ⬆️
src/czml3/utils.py 100% <100%> (ø) ⬆️
src/czml3/enums.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 587e4eb...1a5bb54. Read the comment docs.

@astrojuanlu astrojuanlu mentioned this pull request Nov 6, 2019
9 tasks
@astrojuanlu
Copy link
Member Author

All tests are passing, so I'll go ahead and merge this.

@astrojuanlu astrojuanlu merged commit 2e83b28 into poliastro:master Nov 6, 2019
@astrojuanlu astrojuanlu deleted the attrs branch November 6, 2019 11:25
@astrojuanlu astrojuanlu mentioned this pull request Nov 6, 2019
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.

None yet

2 participants