vincentarelbundock / pycountrycode Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Implement .github/worfklows
to do the following:
pylint
, black
, etc)Implementing basic checks early in the development process and provide needed velocity as this port matures.
pylint
and black
are good starting pointsI am a long time user of countrycode
since my time in graduate school and am very excited to see a Python port!
Packages sometimes employ custom templates for features and / or bugs. A minimally viable template would include the following:
Thanks! :)
@Nadjim10 could you please convert all the R tests at these links into Python tests in the present repository?
https://github.com/vincentarelbundock/countrycode/blob/main/tests/testthat/test-corner-cases.R
https://github.com/vincentarelbundock/countrycode/blob/main/tests/testthat/test-known-name-variations.R
https://github.com/vincentarelbundock/countrycode/blob/main/tests/testthat/data-known-name-variations.R
We can use the hypothesis
package to make unit testing more robust. Property-based testing will allow us to generate examples and edge cases either through random strings or strategies that can be based on codelist
.
For example the test_invalid_iso3c_to_country_name
function in tests/test_basic.py
could be rewritten as follows:
codelist
's iso3c
column.countrycode(code, "iso3c", "country.name")
is always None
for all inputs generated with the above strategyAs someone raised with Legos, specifically Lego Star Wars, I appreciate your profile picture on GitHub and Twitter.
As of the most recent commit CI formatting checks are failing. The linting failures prevent tests from being run. On my local fork test suites such as test_regex_internal
fail due to missing the polars
import. While this behavior is expected as a result of making both polars
and pandas
optional the tests must be updated in a manner that allows for such dependencies to be optional.
polars
and pandas
are not installedcountrycode.py
can be mirrored in the test suite to handle optional imports. I find myself falling back on the conventions laid out in a 2014 stackoverflow answer0.4.0
to 0.4.1
.I can jump on the first to-do item within the next day and have time to devote to the second item later in the week.
One of the most compelling features of the R package countrycode
is the ability to manually manipulate the codelist
Dataframe for use in other projects. As presently constructed the codelist
variable exported from countrycode
does not integrate with pandas
or numpy
. More specifically the following script will fail when countrycode
is installed via pip
:
from countrycode import codelist
codelist.to_pandas()
codelist.to_numpy()
numpy
and pandas
functionality requires installation of those packagespyproject.toml
to include pandas
and numpy
.data
dependencies section that includes numpy
and pandas
. With this approach a user can optionally install the additional packages:pip install countrycode[data]
codelist
to a pandas.DataFrame
and remove substitute polars
for pandas
Of the potential options I am partial to 3 and 4. Option 3 leaves the structure of the package untouched and shifts the choice to install additional dependencies to the user if they wish to use the codelist
data in a pandas
or numpy
environment. My predilection for option 4 stems from python's reliance on pandas
to manipulate data.
Your statement in the last issue about "real work" resonated with me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.